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

The registry contains a unique mapping between functions and their ID. More...

#include <ReproducerInstrumentation.h>

Inheritance diagram for lldb_private::repro::Registry:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::repro::Registry:
Collaboration graph
[legend]

Classes

struct  SignatureStr
 

Public Member Functions

 Registry ()=default
 
virtual ~Registry ()=default
 
template<typename Signature >
void Register (Signature *f, llvm::StringRef result={}, llvm::StringRef scope={}, llvm::StringRef name={}, llvm::StringRef args={})
 Register a default replayer for a function. More...
 
template<typename Signature >
void Register (Signature *f, Signature *g, llvm::StringRef result={}, llvm::StringRef scope={}, llvm::StringRef name={}, llvm::StringRef args={})
 Register a replayer that invokes a custom function with the same signature as the replayed function. More...
 
bool Replay (const FileSpec &file)
 Replay functions from a file. More...
 
bool Replay (llvm::StringRef buffer)
 Replay functions from a buffer. More...
 
bool Replay (Deserializer &deserializer)
 Replay functions from a deserializer. More...
 
unsigned GetID (uintptr_t addr)
 Returns the ID for a given function address. More...
 
ReplayerGetReplayer (unsigned id)
 Get the replayer matching the given ID. More...
 
std::string GetSignature (unsigned id)
 
void CheckID (unsigned expected, unsigned actual)
 

Protected Member Functions

void DoRegister (uintptr_t RunID, std::unique_ptr< Replayer > replayer, SignatureStr signature)
 Register the given replayer for a function (and the ID mapping). More...
 

Private Attributes

std::map< uintptr_t, std::pair< std::unique_ptr< Replayer >, unsigned > > m_replayers
 Mapping of function addresses to replayers and their ID. More...
 
std::map< unsigned, std::pair< Replayer *, SignatureStr > > m_ids
 Mapping of IDs to replayer instances. More...
 

Detailed Description

The registry contains a unique mapping between functions and their ID.

The IDs can be serialized and deserialized to replay a function. Functions need to be registered with the registry for this to work.

Definition at line 517 of file ReproducerInstrumentation.h.

Constructor & Destructor Documentation

◆ Registry()

lldb_private::repro::Registry::Registry ( )
default

◆ ~Registry()

virtual lldb_private::repro::Registry::~Registry ( )
virtualdefault

Member Function Documentation

◆ CheckID()

void Registry::CheckID ( unsigned  expected,
unsigned  actual 
)

Definition at line 164 of file ReproducerInstrumentation.cpp.

References GetSignature().

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

◆ DoRegister()

void Registry::DoRegister ( uintptr_t  RunID,
std::unique_ptr< Replayer replayer,
SignatureStr  signature 
)
protected

Register the given replayer for a function (and the ID mapping).

Definition at line 144 of file ReproducerInstrumentation.cpp.

References m_ids, and m_replayers.

◆ GetID()

unsigned Registry::GetID ( uintptr_t  addr)

Returns the ID for a given function address.

Definition at line 153 of file ReproducerInstrumentation.cpp.

References m_replayers.

Referenced by lldb_private::repro::Recorder::Record(), and lldb_private::repro::Recorder::Replay().

◆ GetReplayer()

Replayer * Registry::GetReplayer ( unsigned  id)

Get the replayer matching the given ID.

Definition at line 180 of file ReproducerInstrumentation.cpp.

References m_ids.

Referenced by Replay(), and lldb_private::repro::Recorder::Replay().

◆ GetSignature()

std::string Registry::GetSignature ( unsigned  id)

Definition at line 159 of file ReproducerInstrumentation.cpp.

References m_ids.

Referenced by CheckID(), and Replay().

◆ Register() [1/2]

template<typename Signature >
void lldb_private::repro::Registry::Register ( Signature *  f,
llvm::StringRef  result = {},
llvm::StringRef  scope = {},
llvm::StringRef  name = {},
llvm::StringRef  args = {} 
)
inline

Register a default replayer for a function.

Definition at line 538 of file ReproducerInstrumentation.h.

Referenced by lldb_private::repro::RegisterMethods< SBDebugger >().

◆ Register() [2/2]

template<typename Signature >
void lldb_private::repro::Registry::Register ( Signature *  f,
Signature *  g,
llvm::StringRef  result = {},
llvm::StringRef  scope = {},
llvm::StringRef  name = {},
llvm::StringRef  args = {} 
)
inline

Register a replayer that invokes a custom function with the same signature as the replayed function.

Definition at line 548 of file ReproducerInstrumentation.h.

◆ Replay() [1/3]

bool Registry::Replay ( const FileSpec file)

Replay functions from a file.

Definition at line 101 of file ReproducerInstrumentation.cpp.

References lldb_private::FileSpec::GetPath().

Referenced by lldb::SBReproducer::Replay(), and Replay().

◆ Replay() [2/3]

bool Registry::Replay ( Deserializer deserializer)

◆ Replay() [3/3]

bool Registry::Replay ( llvm::StringRef  buffer)

Replay functions from a buffer.

Definition at line 109 of file ReproducerInstrumentation.cpp.

References Replay().

Member Data Documentation

◆ m_ids

std::map<unsigned, std::pair<Replayer *, SignatureStr> > lldb_private::repro::Registry::m_ids
private

Mapping of IDs to replayer instances.

Definition at line 585 of file ReproducerInstrumentation.h.

Referenced by DoRegister(), GetReplayer(), and GetSignature().

◆ m_replayers

std::map<uintptr_t, std::pair<std::unique_ptr<Replayer>, unsigned> > lldb_private::repro::Registry::m_replayers
private

Mapping of function addresses to replayers and their ID.

Definition at line 582 of file ReproducerInstrumentation.h.

Referenced by DoRegister(), and GetID().


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