LLDB  mainline
Classes | Namespaces | Macros | Functions
ReproducerInstrumentation.h File Reference
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Logging.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ErrorHandling.h"
#include <map>
#include <thread>
#include <type_traits>
Include dependency graph for ReproducerInstrumentation.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  lldb_private::repro::is_trivially_serializable< T >
 
class  lldb_private::repro::IndexToObject
 Mapping between serialized indices and their corresponding objects. More...
 
struct  lldb_private::repro::PointerTag
 We need to differentiate between pointers to fundamental and non-fundamental types. More...
 
struct  lldb_private::repro::ReferenceTag
 
struct  lldb_private::repro::ValueTag
 
struct  lldb_private::repro::FundamentalPointerTag
 
struct  lldb_private::repro::FundamentalReferenceTag
 
struct  lldb_private::repro::serializer_tag< T >
 Return the deserialization tag for the given type T. More...
 
struct  lldb_private::repro::serializer_tag< T * >
 
struct  lldb_private::repro::serializer_tag< T & >
 
class  lldb_private::repro::Deserializer
 Deserializes data from a buffer. More...
 
struct  lldb_private::repro::DeserializationHelper< Remaining >
 Helpers to auto-synthesize function replay code. More...
 
struct  lldb_private::repro::DeserializationHelper< Head, Tail... >
 
struct  lldb_private::repro::DeserializationHelper< Head, Tail... >::deserialized< Result, Deserialized >
 
struct  lldb_private::repro::DeserializationHelper<>
 
struct  lldb_private::repro::DeserializationHelper<>::deserialized
 
struct  lldb_private::repro::Replayer
 The replayer interface. More...
 
struct  lldb_private::repro::DefaultReplayer< Signature >
 The default replayer deserializes the arguments and calls the function. More...
 
struct  lldb_private::repro::DefaultReplayer< Result(Args...)>
 
struct  lldb_private::repro::DefaultReplayer< void(Args...)>
 Partial specialization for function returning a void type. More...
 
class  lldb_private::repro::Registry
 The registry contains a unique mapping between functions and their ID. More...
 
struct  lldb_private::repro::Registry::SignatureStr
 
class  lldb_private::repro::ObjectToIndex
 Maps an object to an index for serialization. More...
 
class  lldb_private::repro::Serializer
 Serializes functions, their arguments and their return type to a stream. More...
 
class  lldb_private::repro::InstrumentationData
 
struct  lldb_private::repro::EmptyArg
 
class  lldb_private::repro::Recorder
 RAII object that records function invocations and their return value. More...
 
struct  lldb_private::repro::construct< Signature >
 To be used as the "Runtime ID" of a constructor. More...
 
struct  lldb_private::repro::construct< Class(Args...)>
 
struct  lldb_private::repro::invoke< Signature >
 To be used as the "Runtime ID" of a member function. More...
 
struct  lldb_private::repro::invoke< Result(Class::*)(Args...)>
 
struct  lldb_private::repro::invoke< Result(Class::*)(Args...)>::method< m >
 
struct  lldb_private::repro::invoke< void(Class::*)(Args...)>
 
struct  lldb_private::repro::invoke< void(Class::*)(Args...)>::method< m >
 
struct  lldb_private::repro::invoke< Result(Class::*)(Args...) const >
 
struct  lldb_private::repro::invoke< Result(Class::*)(Args...) const >::method< m >
 
struct  lldb_private::repro::invoke< void(Class::*)(Args...) const >
 
struct  lldb_private::repro::invoke< void(Class::*)(Args...) const >::method< m >
 
struct  lldb_private::repro::replay< Signature >
 
struct  lldb_private::repro::replay< Result(Class::*)(Args...)>
 
struct  lldb_private::repro::replay< Result(Class::*)(Args...)>::method< m >
 
struct  lldb_private::repro::invoke< Result(*)(Args...)>
 
struct  lldb_private::repro::invoke< Result(*)(Args...)>::method< m >
 
struct  lldb_private::repro::invoke< void(*)(Args...)>
 
struct  lldb_private::repro::invoke< void(*)(Args...)>::method< m >
 
struct  lldb_private::repro::invoke_char_ptr< Signature >
 Special handling for functions returning strings as (char*, size_t). More...
 
struct  lldb_private::repro::invoke_char_ptr< Result(Class::*)(Args...) const >
 
struct  lldb_private::repro::invoke_char_ptr< Result(Class::*)(Args...) const >::method< m >
 
struct  lldb_private::repro::invoke_char_ptr< Signature >
 Special handling for functions returning strings as (char*, size_t). More...
 
struct  lldb_private::repro::invoke_char_ptr< Result(Class::*)(Args...)>
 
struct  lldb_private::repro::invoke_char_ptr< Result(Class::*)(Args...)>::method< m >
 
struct  lldb_private::repro::invoke_char_ptr< Result(*)(Args...)>
 
struct  lldb_private::repro::invoke_char_ptr< Result(*)(Args...)>::method< m >
 

Namespaces

 lldb_private
 A class that represents a running process on the host machine.
 
 lldb_private::repro
 

Macros

#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
 
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature)
 
#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature)
 
#define LLDB_REGISTER_STATIC_METHOD(Result, Class, Method, Signature)
 
#define LLDB_REGISTER_CHAR_PTR_METHOD_STATIC(Result, Class, Method)
 
#define LLDB_REGISTER_CHAR_PTR_METHOD(Result, Class, Method)
 
#define LLDB_REGISTER_CHAR_PTR_METHOD_CONST(Result, Class, Method)
 
#define LLDB_CONSTRUCT_(T, Class, ...)
 
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature, ...)   LLDB_CONSTRUCT_(Class Signature, this, __VA_ARGS__)
 
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class)   LLDB_CONSTRUCT_(Class(), this, lldb_private::repro::EmptyArg())
 
#define LLDB_RECORD_(T1, T2, ...)
 
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature, ...)   LLDB_RECORD_(Result(Class::*) Signature, (&Class::Method), this, __VA_ARGS__)
 
#define LLDB_RECORD_METHOD_CONST(Result, Class, Method, Signature, ...)
 
#define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method)   LLDB_RECORD_(Result (Class::*)(), (&Class::Method), this)
 
#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)   LLDB_RECORD_(Result (Class::*)() const, (&Class::Method), this)
 
#define LLDB_RECORD_STATIC_METHOD(Result, Class, Method, Signature, ...)   LLDB_RECORD_(Result(*) Signature, (&Class::Method), __VA_ARGS__)
 
#define LLDB_RECORD_STATIC_METHOD_NO_ARGS(Result, Class, Method)   LLDB_RECORD_(Result (*)(), (&Class::Method), lldb_private::repro::EmptyArg())
 
#define LLDB_RECORD_CHAR_PTR_(T1, T2, StrOut, ...)
 
#define LLDB_RECORD_CHAR_PTR_METHOD(Result, Class, Method, Signature, StrOut, ...)
 
#define LLDB_RECORD_CHAR_PTR_METHOD_CONST(Result, Class, Method, Signature, StrOut, ...)
 
#define LLDB_RECORD_CHAR_PTR_STATIC_METHOD(Result, Class, Method, Signature, StrOut, ...)
 
#define LLDB_RECORD_RESULT(Result)   _recorder.RecordResult(Result, true);
 
#define LLDB_RECORD_DUMMY(Result, Class, Method, Signature, ...)   lldb_private::repro::Recorder _recorder;
 The LLDB_RECORD_DUMMY macro is special because it doesn't actually record anything. More...
 
#define LLDB_RECORD_DUMMY_NO_ARGS(Result, Class, Method)   lldb_private::repro::Recorder _recorder;
 

Functions

template<typename T , typename std::enable_if< std::is_fundamental< T >::value, int >::type = 0>
void stringify_append (llvm::raw_string_ostream &ss, const T &t)
 
template<typename T >
void stringify_append (llvm::raw_string_ostream &ss, T *t)
 
template<typename T >
void stringify_append (llvm::raw_string_ostream &ss, const T *t)
 
template<>
void stringify_append< char > (llvm::raw_string_ostream &ss, const char *t)
 
template<>
void stringify_append< std::nullptr_t > (llvm::raw_string_ostream &ss, const std::nullptr_t &t)
 
template<typename Head >
void stringify_helper (llvm::raw_string_ostream &ss, const Head &head)
 
template<typename Head , typename... Tail>
void stringify_helper (llvm::raw_string_ostream &ss, const Head &head, const Tail &... tail)
 
template<typename... Ts>
std::string stringify_args (const Ts &... ts)
 

Macro Definition Documentation

◆ LLDB_CONSTRUCT_

#define LLDB_CONSTRUCT_ (   T,
  Class,
  ... 
)
Value:
lldb_private::repro::Recorder _recorder(LLVM_PRETTY_FUNCTION); \
lldb_private::repro::construct<T>::handle(LLDB_GET_INSTRUMENTATION_DATA(), \
_recorder, Class, __VA_ARGS__);

Definition at line 128 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_

#define LLDB_RECORD_ (   T1,
  T2,
  ... 
)
Value:
lldb_private::repro::Recorder _recorder(LLVM_PRETTY_FUNCTION, \
stringify_args(__VA_ARGS__)); \
if (lldb_private::repro::Serializer *_serializer = \
_data.GetSerializer()) { \
_recorder.Record(*_serializer, _data.GetRegistry(), \
__VA_ARGS__); \
} else if (lldb_private::repro::Deserializer *_deserializer = \
_data.GetDeserializer()) { \
if (_recorder.ShouldCapture()) { \
_recorder, *_deserializer, _data.GetRegistry()); \
} \
} \
}

Definition at line 139 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_CHAR_PTR_

#define LLDB_RECORD_CHAR_PTR_ (   T1,
  T2,
  StrOut,
  ... 
)
Value:
lldb_private::repro::Recorder _recorder(LLVM_PRETTY_FUNCTION, \
stringify_args(__VA_ARGS__)); \
if (lldb_private::repro::Serializer *_serializer = \
_data.GetSerializer()) { \
_recorder.Record(*_serializer, _data.GetRegistry(), \
__VA_ARGS__); \
} else if (lldb_private::repro::Deserializer *_deserializer = \
_data.GetDeserializer()) { \
if (_recorder.ShouldCapture()) { \
_recorder, *_deserializer, _data.GetRegistry(), StrOut); \
} \
} \
}

Definition at line 177 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_CHAR_PTR_METHOD

#define LLDB_RECORD_CHAR_PTR_METHOD (   Result,
  Class,
  Method,
  Signature,
  StrOut,
  ... 
)
Value:
LLDB_RECORD_CHAR_PTR_(Result(Class::*) Signature, (&Class::Method), StrOut, \
this, __VA_ARGS__)

Definition at line 196 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_CHAR_PTR_METHOD_CONST

#define LLDB_RECORD_CHAR_PTR_METHOD_CONST (   Result,
  Class,
  Method,
  Signature,
  StrOut,
  ... 
)
Value:
LLDB_RECORD_CHAR_PTR_(Result(Class::*) Signature const, (&Class::Method), \
StrOut, this, __VA_ARGS__)

Definition at line 201 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_CHAR_PTR_STATIC_METHOD

#define LLDB_RECORD_CHAR_PTR_STATIC_METHOD (   Result,
  Class,
  Method,
  Signature,
  StrOut,
  ... 
)
Value:
LLDB_RECORD_CHAR_PTR_(Result(*) Signature, (&Class::Method), StrOut, \
__VA_ARGS__)

Definition at line 206 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_CONSTRUCTOR

#define LLDB_RECORD_CONSTRUCTOR (   Class,
  Signature,
  ... 
)    LLDB_CONSTRUCT_(Class Signature, this, __VA_ARGS__)

Definition at line 133 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_CONSTRUCTOR_NO_ARGS

#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS (   Class)    LLDB_CONSTRUCT_(Class(), this, lldb_private::repro::EmptyArg())

Definition at line 136 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_DUMMY

#define LLDB_RECORD_DUMMY (   Result,
  Class,
  Method,
  Signature,
  ... 
)    lldb_private::repro::Recorder _recorder;

The LLDB_RECORD_DUMMY macro is special because it doesn't actually record anything.

It's used to track API boundaries when we cannot record for technical reasons.

Definition at line 216 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_DUMMY_NO_ARGS

#define LLDB_RECORD_DUMMY_NO_ARGS (   Result,
  Class,
  Method 
)    lldb_private::repro::Recorder _recorder;

Definition at line 219 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_METHOD

#define LLDB_RECORD_METHOD (   Result,
  Class,
  Method,
  Signature,
  ... 
)    LLDB_RECORD_(Result(Class::*) Signature, (&Class::Method), this, __VA_ARGS__)

Definition at line 158 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_METHOD_CONST

#define LLDB_RECORD_METHOD_CONST (   Result,
  Class,
  Method,
  Signature,
  ... 
)
Value:
LLDB_RECORD_(Result(Class::*) Signature const, (&Class::Method), this, \
__VA_ARGS__)

Definition at line 161 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_METHOD_CONST_NO_ARGS

#define LLDB_RECORD_METHOD_CONST_NO_ARGS (   Result,
  Class,
  Method 
)    LLDB_RECORD_(Result (Class::*)() const, (&Class::Method), this)

Definition at line 168 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_METHOD_NO_ARGS

#define LLDB_RECORD_METHOD_NO_ARGS (   Result,
  Class,
  Method 
)    LLDB_RECORD_(Result (Class::*)(), (&Class::Method), this)

Definition at line 165 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_RESULT

#define LLDB_RECORD_RESULT (   Result)    _recorder.RecordResult(Result, true);

Definition at line 211 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_STATIC_METHOD

#define LLDB_RECORD_STATIC_METHOD (   Result,
  Class,
  Method,
  Signature,
  ... 
)    LLDB_RECORD_(Result(*) Signature, (&Class::Method), __VA_ARGS__)

Definition at line 171 of file ReproducerInstrumentation.h.

◆ LLDB_RECORD_STATIC_METHOD_NO_ARGS

#define LLDB_RECORD_STATIC_METHOD_NO_ARGS (   Result,
  Class,
  Method 
)    LLDB_RECORD_(Result (*)(), (&Class::Method), lldb_private::repro::EmptyArg())

Definition at line 174 of file ReproducerInstrumentation.h.

◆ LLDB_REGISTER_CHAR_PTR_METHOD

#define LLDB_REGISTER_CHAR_PTR_METHOD (   Result,
  Class,
  Method 
)
Value:
R.Register(&invoke<Result (Class::*)(char *, size_t)>::method<( \
&Class::Method)>::record, \
&invoke_char_ptr<Result (Class::*)(char *, size_t)>::method<( \
&Class::Method)>::record, \
#Result, #Class, #Method, "(char*, size_t");

Definition at line 114 of file ReproducerInstrumentation.h.

◆ LLDB_REGISTER_CHAR_PTR_METHOD_CONST

#define LLDB_REGISTER_CHAR_PTR_METHOD_CONST (   Result,
  Class,
  Method 
)
Value:
R.Register(&invoke<Result (Class::*)(char *, size_t) \
const>::method<(&Class::Method)>::record, \
&invoke_char_ptr<Result (Class::*)(char *, size_t) \
const>::method<(&Class::Method)>::record, \
#Result, #Class, #Method, "(char*, size_t");

Definition at line 121 of file ReproducerInstrumentation.h.

◆ LLDB_REGISTER_CHAR_PTR_METHOD_STATIC

#define LLDB_REGISTER_CHAR_PTR_METHOD_STATIC (   Result,
  Class,
  Method 
)
Value:
R.Register( \
&invoke<Result (*)(char *, size_t)>::method<(&Class::Method)>::record, \
&invoke_char_ptr<Result (*)(char *, \
size_t)>::method<(&Class::Method)>::record, \
#Result, #Class, #Method, "(char*, size_t");

Definition at line 107 of file ReproducerInstrumentation.h.

◆ LLDB_REGISTER_CONSTRUCTOR

#define LLDB_REGISTER_CONSTRUCTOR (   Class,
  Signature 
)
Value:
R.Register<Class * Signature>(&construct<Class Signature>::record, "", \
#Class, #Class, #Signature)

Definition at line 89 of file ReproducerInstrumentation.h.

◆ LLDB_REGISTER_METHOD

#define LLDB_REGISTER_METHOD (   Result,
  Class,
  Method,
  Signature 
)
Value:
R.Register( \
&invoke<Result(Class::*) Signature>::method<(&Class::Method)>::record, \
#Result, #Class, #Method, #Signature)

Definition at line 93 of file ReproducerInstrumentation.h.

◆ LLDB_REGISTER_METHOD_CONST

#define LLDB_REGISTER_METHOD_CONST (   Result,
  Class,
  Method,
  Signature 
)
Value:
R.Register(&invoke<Result(Class::*) \
Signature const>::method<(&Class::Method)>::record, \
#Result, #Class, #Method, #Signature)

Definition at line 98 of file ReproducerInstrumentation.h.

◆ LLDB_REGISTER_STATIC_METHOD

#define LLDB_REGISTER_STATIC_METHOD (   Result,
  Class,
  Method,
  Signature 
)
Value:
R.Register(&invoke<Result(*) Signature>::method<(&Class::Method)>::record, \
#Result, #Class, #Method, #Signature)

Definition at line 103 of file ReproducerInstrumentation.h.

Function Documentation

◆ stringify_append() [1/3]

template<typename T , typename std::enable_if< std::is_fundamental< T >::value, int >::type = 0>
void stringify_append ( llvm::raw_string_ostream &  ss,
const T &  t 
)
inline

Definition at line 25 of file ReproducerInstrumentation.h.

Referenced by stringify_helper().

◆ stringify_append() [2/3]

template<typename T >
void stringify_append ( llvm::raw_string_ostream &  ss,
const T *  t 
)
inline

Definition at line 41 of file ReproducerInstrumentation.h.

◆ stringify_append() [3/3]

template<typename T >
void stringify_append ( llvm::raw_string_ostream &  ss,
T *  t 
)
inline

Definition at line 36 of file ReproducerInstrumentation.h.

◆ stringify_append< char >()

template<>
void stringify_append< char > ( llvm::raw_string_ostream &  ss,
const char *  t 
)
inline

Definition at line 46 of file ReproducerInstrumentation.h.

◆ stringify_append< std::nullptr_t >()

template<>
void stringify_append< std::nullptr_t > ( llvm::raw_string_ostream &  ss,
const std::nullptr_t &  t 
)
inline

Definition at line 52 of file ReproducerInstrumentation.h.

◆ stringify_args()

template<typename... Ts>
std::string stringify_args ( const Ts &...  ts)
inline

◆ stringify_helper() [1/2]

template<typename Head >
void stringify_helper ( llvm::raw_string_ostream &  ss,
const Head &  head 
)
inline

Definition at line 58 of file ReproducerInstrumentation.h.

References stringify_append().

Referenced by stringify_args(), and stringify_helper().

◆ stringify_helper() [2/2]

template<typename Head , typename... Tail>
void stringify_helper ( llvm::raw_string_ostream &  ss,
const Head &  head,
const Tail &...  tail 
)
inline

Definition at line 63 of file ReproducerInstrumentation.h.

References stringify_append(), and stringify_helper().

LLDB_GET_INSTRUMENTATION_DATA
#define LLDB_GET_INSTRUMENTATION_DATA()
Definition: SBReproducerPrivate.h:23
lldb_private::repro::Deserializer
Deserializes data from a buffer.
Definition: ReproducerInstrumentation.h:318
lldb_private::repro::invoke
To be used as the "Runtime ID" of a member function.
Definition: ReproducerInstrumentation.h:948
lldb_private::repro::invoke_char_ptr
Special handling for functions returning strings as (char*, size_t).
Definition: ReproducerInstrumentation.h:1037
_data
uint32_t _data
Definition: NSArray.cpp:108
lldb_private::repro::InstrumentationData
Definition: ReproducerInstrumentation.h:698
stringify_args
std::string stringify_args(const Ts &... ts)
Definition: ReproducerInstrumentation.h:70
lldb_private::repro::Serializer
Serializes functions, their arguments and their return type to a stream.
Definition: ReproducerInstrumentation.h:606
lldb_private::CompilerContextKind::Class
@ Class
LLDB_RECORD_
#define LLDB_RECORD_(T1, T2,...)
Definition: ReproducerInstrumentation.h:139
LLDB_RECORD_CHAR_PTR_
#define LLDB_RECORD_CHAR_PTR_(T1, T2, StrOut,...)
Definition: ReproducerInstrumentation.h:177
lldb_private::repro::Recorder
RAII object that records function invocations and their return value.
Definition: ReproducerInstrumentation.h:747