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

RAII object that records function invocations and their return value. More...

#include <ReproducerInstrumentation.h>

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

Public Member Functions

 Recorder ()
 
 Recorder (llvm::StringRef pretty_func, std::string &&pretty_args={})
 
 ~Recorder ()
 
template<typename Result , typename... FArgs, typename... RArgs>
void Record (Serializer &serializer, Registry &registry, Result(*f)(FArgs...), const RArgs &... args)
 Records a single function call. More...
 
template<typename... Args>
void Record (Serializer &serializer, Registry &registry, void(*f)(Args...), const Args &... args)
 Records a single function call. More...
 
template<typename Result >
void Record (Serializer &serializer, Registry &registry, Result(*f)(), const EmptyArg &arg)
 Specializations for the no-argument methods. More...
 
template<typename Result >
Result RecordResult (Result &&r, bool update_boundary)
 Record the result of a function call. More...
 
template<typename Result , typename T >
Result Replay (Deserializer &deserializer, Registry &registry, uintptr_t addr, bool update_boundary)
 
void Replay (Deserializer &deserializer, Registry &registry, uintptr_t addr)
 
template<typename Result >
Result ReplayResult (Result &&r, bool update_boundary)
 
bool ShouldCapture ()
 

Private Member Functions

void UpdateBoundary ()
 

Private Attributes

Serializerm_serializer
 
llvm::StringRef m_pretty_func
 Pretty function for logging. More...
 
std::string m_pretty_args
 
bool m_local_boundary
 Whether this function call was the one crossing the API boundary. More...
 
bool m_result_recorded
 Whether the return value was recorded explicitly. More...
 

Static Private Attributes

static bool g_global_boundary
 Whether we're currently across the API boundary. More...
 

Friends

template<typename T >
struct replay
 

Detailed Description

RAII object that records function invocations and their return value.

API calls are only captured when the API boundary is crossed. Once we're in the API layer, and another API function is called, it doesn't need to be recorded.

When a call is recored, its result is always recorded as well, even if the function returns a void. For functions that return by value, RecordResult should be used. Otherwise a sentinel value (0) will be serialized.

Because of the functional overlap between logging and recording API calls, this class is also used for logging.

Definition at line 727 of file ReproducerInstrumentation.h.

Constructor & Destructor Documentation

◆ Recorder() [1/2]

Recorder::Recorder ( )

Definition at line 182 of file ReproducerInstrumentation.cpp.

References g_global_boundary, and m_local_boundary.

◆ Recorder() [2/2]

Recorder::Recorder ( llvm::StringRef  pretty_func,
std::string &&  pretty_args = {} 
)

◆ ~Recorder()

Recorder::~Recorder ( )

Definition at line 204 of file ReproducerInstrumentation.cpp.

References m_result_recorded, and UpdateBoundary().

Member Function Documentation

◆ Record() [1/3]

template<typename Result , typename... FArgs, typename... RArgs>
void lldb_private::repro::Recorder::Record ( Serializer serializer,
Registry registry,
Result(*)(FArgs...)  f,
const RArgs &...  args 
)
inline

◆ Record() [2/3]

template<typename... Args>
void lldb_private::repro::Recorder::Record ( Serializer serializer,
Registry registry,
void(*)(Args...)  f,
const Args &...  args 
)
inline

Records a single function call.

Definition at line 761 of file ReproducerInstrumentation.h.

References lldb_private::repro::Registry::GetID(), and lldb_private::repro::Serializer::SerializeAll().

◆ Record() [3/3]

template<typename Result >
void lldb_private::repro::Recorder::Record ( Serializer serializer,
Registry registry,
Result(*)()  f,
const EmptyArg arg 
)
inline

Specializations for the no-argument methods.

These are passed an empty dummy argument so the same variadic macro can be used. These methods strip the arguments before forwarding them.

Definition at line 785 of file ReproducerInstrumentation.h.

◆ RecordResult()

template<typename Result >
Result lldb_private::repro::Recorder::RecordResult ( Result &&  r,
bool  update_boundary 
)
inline

Record the result of a function call.

Definition at line 792 of file ReproducerInstrumentation.h.

Referenced by lldb_private::repro::construct< Class(Args...)>::handle().

◆ Replay() [1/2]

template<typename Result , typename T >
Result lldb_private::repro::Recorder::Replay ( Deserializer deserializer,
Registry registry,
uintptr_t  addr,
bool  update_boundary 
)
inline

◆ Replay() [2/2]

void lldb_private::repro::Recorder::Replay ( Deserializer deserializer,
Registry registry,
uintptr_t  addr 
)
inline

◆ ReplayResult()

template<typename Result >
Result lldb_private::repro::Recorder::ReplayResult ( Result &&  r,
bool  update_boundary 
)
inline

◆ ShouldCapture()

bool lldb_private::repro::Recorder::ShouldCapture ( )
inline

◆ UpdateBoundary()

void lldb_private::repro::Recorder::UpdateBoundary ( )
inlineprivate

Definition at line 839 of file ReproducerInstrumentation.h.

Referenced by ~Recorder().

Friends And Related Function Documentation

◆ replay

template<typename T >
friend struct replay
friend

Definition at line 838 of file ReproducerInstrumentation.h.

Member Data Documentation

◆ g_global_boundary

bool lldb_private::repro::Recorder::g_global_boundary
staticprivate

Whether we're currently across the API boundary.

Definition at line 864 of file ReproducerInstrumentation.h.

Referenced by lldb_private::repro::InstrumentationData::InstanceImpl(), and Recorder().

◆ m_local_boundary

bool lldb_private::repro::Recorder::m_local_boundary
private

Whether this function call was the one crossing the API boundary.

Definition at line 858 of file ReproducerInstrumentation.h.

Referenced by Recorder().

◆ m_pretty_args

std::string lldb_private::repro::Recorder::m_pretty_args
private

Definition at line 855 of file ReproducerInstrumentation.h.

Referenced by Recorder().

◆ m_pretty_func

llvm::StringRef lldb_private::repro::Recorder::m_pretty_func
private

Pretty function for logging.

Definition at line 854 of file ReproducerInstrumentation.h.

Referenced by Recorder().

◆ m_result_recorded

bool lldb_private::repro::Recorder::m_result_recorded
private

Whether the return value was recorded explicitly.

Definition at line 861 of file ReproducerInstrumentation.h.

Referenced by ~Recorder().

◆ m_serializer

Serializer* lldb_private::repro::Recorder::m_serializer
private

Definition at line 851 of file ReproducerInstrumentation.h.


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