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
 
void SetExpectedSequence (unsigned sequence)
 
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...
 
void CheckSequence (unsigned sequence)
 Verify that the given sequence number matches what we expect. More...
 

Private Attributes

IndexToObject m_index_to_object
 Mapping of indices to objects. More...
 
llvm::StringRef m_buffer
 Buffer containing the serialized data. More...
 
llvm::Optional< unsigned > m_expected_sequence
 The result's expected sequence number. 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 318 of file ReproducerInstrumentation.h.

Constructor & Destructor Documentation

◆ Deserializer()

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

Definition at line 320 of file ReproducerInstrumentation.h.

Member Function Documentation

◆ CheckSequence()

void Deserializer::CheckSequence ( unsigned  sequence)
private

Verify that the given sequence number matches what we expect.

Definition at line 91 of file ReproducerInstrumentation.cpp.

References m_expected_sequence.

Referenced by HandleReplayResult(), and HandleReplayResultVoid().

◆ Deserialize() [1/13]

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

Definition at line 50 of file ReproducerInstrumentation.cpp.

◆ Deserialize() [2/13]

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

Definition at line 54 of file ReproducerInstrumentation.cpp.

◆ Deserialize() [3/13]

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

Definition at line 58 of file ReproducerInstrumentation.cpp.

◆ Deserialize() [4/13]

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

Definition at line 62 of file ReproducerInstrumentation.cpp.

◆ Deserialize() [5/13]

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

Definition at line 66 of file ReproducerInstrumentation.cpp.

References HasData(), and m_buffer.

◆ Deserialize() [6/13]

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

Definition at line 80 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

◆ 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 345 of file ReproducerInstrumentation.h.

References lldb_private::repro::IndexToObject::AddObjectForIndex(), CheckSequence(), and m_index_to_object.

◆ 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 355 of file ReproducerInstrumentation.h.

References lldb_private::repro::IndexToObject::AddObjectForIndex(), CheckSequence(), and m_index_to_object.

◆ 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 365 of file ReproducerInstrumentation.h.

References CheckSequence().

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 323 of file ReproducerInstrumentation.h.

References m_buffer.

Referenced by Deserialize(), Read(), and lldb_private::repro::Registry::Replay().

◆ Read() [1/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 406 of file ReproducerInstrumentation.h.

◆ Read() [2/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 415 of file ReproducerInstrumentation.h.

◆ Read() [3/5]

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

Definition at line 389 of file ReproducerInstrumentation.h.

References m_index_to_object.

◆ Read() [4/5]

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

Definition at line 395 of file ReproducerInstrumentation.h.

References m_index_to_object.

◆ Read() [5/5]

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

Definition at line 381 of file ReproducerInstrumentation.h.

References HasData(), and m_buffer.

◆ SetExpectedSequence()

void lldb_private::repro::Deserializer::SetExpectedSequence ( unsigned  sequence)
inline

Member Data Documentation

◆ m_buffer

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

Buffer containing the serialized data.

Definition at line 428 of file ReproducerInstrumentation.h.

Referenced by Deserialize(), HasData(), and Read().

◆ m_expected_sequence

llvm::Optional<unsigned> lldb_private::repro::Deserializer::m_expected_sequence
private

The result's expected sequence number.

Definition at line 431 of file ReproducerInstrumentation.h.

Referenced by CheckSequence(), and SetExpectedSequence().

◆ m_index_to_object

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

Mapping of indices to objects.

Definition at line 425 of file ReproducerInstrumentation.h.

Referenced by GetAllObjects(), HandleReplayResult(), and Read().


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