LLDB  mainline
Public Member Functions | Private Member Functions | Private Attributes | List of all members
lldb_private::repro::Deserializer Class Reference

Deserializes data from a buffer. More...

#include <ReproducerInstrumentation.h>

Collaboration diagram for lldb_private::repro::Deserializer:
Collaboration graph
[legend]

Public Member Functions

 Deserializer (llvm::StringRef buffer)
 
bool HasData (unsigned size)
 Returns true when the buffer has unread data. More...
 
template<typename T >
Deserialize ()
 Deserialize and interpret value as T. More...
 
template<typename T >
const T & HandleReplayResult (const T &t)
 
template<typename T >
T & HandleReplayResult (T &t)
 Store the returned value in the index-to-object mapping. More...
 
template<typename T >
T * HandleReplayResult (T *t)
 Store the returned value in the index-to-object mapping. More...
 
void HandleReplayResultVoid ()
 All returned types are recorded, even when the function returns a void. More...
 
std::vector< void * > GetAllObjects () const
 
template<>
const char * Deserialize ()
 Partial specialization for C-style strings. More...
 
template<>
const char ** Deserialize ()
 
template<>
const uint8_t * Deserialize ()
 
template<>
const void * Deserialize ()
 
template<>
char * Deserialize ()
 
template<>
void * Deserialize ()
 
template<>
const uint8_t * Deserialize ()
 
template<>
void * Deserialize ()
 
template<>
const void * Deserialize ()
 
template<>
char * Deserialize ()
 
template<>
const char * Deserialize ()
 
template<>
const char ** Deserialize ()
 

Private Member Functions

template<typename T >
Read (ValueTag)
 
template<typename T >
Read (PointerTag)
 
template<typename T >
Read (ReferenceTag)
 
template<typename T >
Read (FundamentalPointerTag)
 This method is used to parse references to fundamental types. More...
 
template<typename T >
Read (FundamentalReferenceTag)
 This method is used to parse references to fundamental types. More...
 

Private Attributes

IndexToObject m_index_to_object
 Mapping of indices to objects. More...
 
llvm::StringRef m_buffer
 Buffer containing the serialized data. More...
 

Detailed Description

Deserializes data from a buffer.

It is used to deserialize function indices to replay, their arguments and return values.

Fundamental types and strings are read by value. Objects are read by their index, which get translated by the IndexToObject mapping maintained in this class.

Additional bookkeeping with regards to the IndexToObject is required to deserialize objects. When a constructor is run or an object is returned by value, we need to capture the object and add it to the index together with its index. This is the job of HandleReplayResult(Void).

Definition at line 310 of file ReproducerInstrumentation.h.

Constructor & Destructor Documentation

◆ Deserializer()

lldb_private::repro::Deserializer::Deserializer ( llvm::StringRef  buffer)
inline

Definition at line 312 of file ReproducerInstrumentation.h.

Member Function Documentation

◆ Deserialize() [1/13]

template<>
const uint8_t* lldb_private::repro::Deserializer::Deserialize ( )

Definition at line 46 of file ReproducerInstrumentation.cpp.

◆ Deserialize() [2/13]

template<>
void* lldb_private::repro::Deserializer::Deserialize ( )

Definition at line 50 of file ReproducerInstrumentation.cpp.

◆ Deserialize() [3/13]

template<>
const void* lldb_private::repro::Deserializer::Deserialize ( )

Definition at line 54 of file ReproducerInstrumentation.cpp.

◆ Deserialize() [4/13]

template<>
char* lldb_private::repro::Deserializer::Deserialize ( )

Definition at line 58 of file ReproducerInstrumentation.cpp.

◆ Deserialize() [5/13]

template<>
const char* lldb_private::repro::Deserializer::Deserialize ( )

Definition at line 62 of file ReproducerInstrumentation.cpp.

◆ Deserialize() [6/13]

template<>
const char** lldb_private::repro::Deserializer::Deserialize ( )

Definition at line 76 of file ReproducerInstrumentation.cpp.

◆ Deserialize() [7/13]

template<typename T >
T lldb_private::repro::Deserializer::Deserialize ( )
inline

◆ Deserialize() [8/13]

template<>
const char* lldb_private::repro::Deserializer::Deserialize ( )

Partial specialization for C-style strings.

We read the string value instead of treating it as pointer.

◆ Deserialize() [9/13]

template<>
const char** lldb_private::repro::Deserializer::Deserialize ( )

◆ Deserialize() [10/13]

template<>
const uint8_t* lldb_private::repro::Deserializer::Deserialize ( )

◆ Deserialize() [11/13]

template<>
const void* lldb_private::repro::Deserializer::Deserialize ( )

◆ Deserialize() [12/13]

template<>
char* lldb_private::repro::Deserializer::Deserialize ( )

◆ Deserialize() [13/13]

template<>
void* lldb_private::repro::Deserializer::Deserialize ( )

◆ GetAllObjects()

std::vector<void *> lldb_private::repro::Deserializer::GetAllObjects ( ) const
inline

Definition at line 360 of file ReproducerInstrumentation.h.

◆ HandleReplayResult() [1/3]

template<typename T >
const T& lldb_private::repro::Deserializer::HandleReplayResult ( const T &  t)
inline

◆ HandleReplayResult() [2/3]

template<typename T >
T& lldb_private::repro::Deserializer::HandleReplayResult ( T &  t)
inline

Store the returned value in the index-to-object mapping.

Definition at line 336 of file ReproducerInstrumentation.h.

◆ HandleReplayResult() [3/3]

template<typename T >
T* lldb_private::repro::Deserializer::HandleReplayResult ( T *  t)
inline

Store the returned value in the index-to-object mapping.

Definition at line 345 of file ReproducerInstrumentation.h.

◆ HandleReplayResultVoid()

void lldb_private::repro::Deserializer::HandleReplayResultVoid ( )
inline

All returned types are recorded, even when the function returns a void.

The latter requires special handling.

Definition at line 354 of file ReproducerInstrumentation.h.

Referenced by lldb_private::repro::DefaultReplayer< void(Args...)>::Replay().

◆ HasData()

bool lldb_private::repro::Deserializer::HasData ( unsigned  size)
inline

Returns true when the buffer has unread data.

Definition at line 315 of file ReproducerInstrumentation.h.

Referenced by lldb_private::repro::Registry::Replay().

◆ Read() [1/5]

template<typename T >
T lldb_private::repro::Deserializer::Read ( ValueTag  )
inlineprivate

Definition at line 365 of file ReproducerInstrumentation.h.

◆ Read() [2/5]

template<typename T >
T lldb_private::repro::Deserializer::Read ( PointerTag  )
inlineprivate

Definition at line 373 of file ReproducerInstrumentation.h.

◆ Read() [3/5]

template<typename T >
T lldb_private::repro::Deserializer::Read ( ReferenceTag  )
inlineprivate

Definition at line 379 of file ReproducerInstrumentation.h.

◆ Read() [4/5]

template<typename T >
T lldb_private::repro::Deserializer::Read ( FundamentalPointerTag  )
inlineprivate

This method is used to parse references to fundamental types.

Because they're not recorded in the object table we have serialized their value. We read its value, allocate a copy on the heap, and return a pointer to the copy.

Definition at line 390 of file ReproducerInstrumentation.h.

◆ Read() [5/5]

template<typename T >
T lldb_private::repro::Deserializer::Read ( FundamentalReferenceTag  )
inlineprivate

This method is used to parse references to fundamental types.

Because they're not recorded in the object table we have serialized their value. We read its value, allocate a copy on the heap, and return a reference to the copy.

Definition at line 399 of file ReproducerInstrumentation.h.

Member Data Documentation

◆ m_buffer

llvm::StringRef lldb_private::repro::Deserializer::m_buffer
private

Buffer containing the serialized data.

Definition at line 409 of file ReproducerInstrumentation.h.

◆ m_index_to_object

IndexToObject lldb_private::repro::Deserializer::m_index_to_object
private

Mapping of indices to objects.

Definition at line 406 of file ReproducerInstrumentation.h.


The documentation for this class was generated from the following files: