|
virtual void | Dump (Stream *s) const =0 |
| Dump the trace data that this plug-in has access to. More...
|
|
virtual llvm::Error | SaveLiveTraceToDisk (FileSpec directory)=0 |
| Save the trace of a live process to the specified directory, which will be created if needed. More...
|
|
virtual lldb::CommandObjectSP | GetProcessTraceStartCommand (CommandInterpreter &interpreter)=0 |
| Get the command handle for the "process trace start" command. More...
|
|
virtual lldb::CommandObjectSP | GetThreadTraceStartCommand (CommandInterpreter &interpreter)=0 |
| Get the command handle for the "thread trace start" command. More...
|
|
virtual llvm::StringRef | GetSchema ()=0 |
|
virtual llvm::Expected< lldb::TraceCursorUP > | CreateNewCursor (Thread &thread)=0 |
| Get a TraceCursor for the given thread's trace. More...
|
|
virtual void | DumpTraceInfo (Thread &thread, Stream &s, bool verbose)=0 |
| Dump general info about a given thread's trace. More...
|
|
virtual bool | IsTraced (lldb::tid_t tid)=0 |
| Check if a thread is currently traced by this object. More...
|
|
virtual const char * | GetStartConfigurationHelp ()=0 |
|
virtual llvm::Error | Start (StructuredData::ObjectSP configuration=StructuredData::ObjectSP())=0 |
| Start tracing a live process. More...
|
|
virtual llvm::Error | Start (llvm::ArrayRef< lldb::tid_t > tids, StructuredData::ObjectSP configuration=StructuredData::ObjectSP())=0 |
| Start tracing live threads. More...
|
|
llvm::Error | Stop (llvm::ArrayRef< lldb::tid_t > tids) |
| Stop tracing live threads. More...
|
|
llvm::Error | Stop () |
| Stop tracing all current and future threads of a live process. More...
|
|
uint32_t | GetStopID () |
|
llvm::Error | OnThreadBinaryDataRead (lldb::tid_t tid, llvm::StringRef kind, OnBinaryDataReadCallback callback) |
| Fetch binary data associated with a thread, either live or postmortem, and pass it to the given callback. More...
|
|
llvm::Error | OnCpuBinaryDataRead (lldb::cpu_id_t cpu_id, llvm::StringRef kind, OnBinaryDataReadCallback callback) |
| Fetch binary data associated with a cpu, either live or postmortem, and pass it to the given callback. More...
|
|
llvm::Error | OnAllCpusBinaryDataRead (llvm::StringRef kind, OnCpusBinaryDataReadCallback callback) |
| Similar to OnCpuBinaryDataRead but this is able to fetch the same data from all cpus at once. More...
|
|
std::vector< Process * > | GetAllProcesses () |
|
llvm::ArrayRef< lldb::cpu_id_t > | GetTracedCpus () |
|
| PluginInterface ()=default |
|
virtual | ~PluginInterface ()=default |
|
virtual llvm::StringRef | GetPluginName ()=0 |
|
| PluginInterface (const PluginInterface &)=delete |
|
PluginInterface & | operator= (const PluginInterface &)=delete |
|
|
Process * | GetLiveProcess () |
| Get the currently traced live process. More...
|
|
llvm::ArrayRef< Process * > | GetPostMortemProcesses () |
| Get the currently traced postmortem processes. More...
|
|
llvm::Expected< std::vector< uint8_t > > | GetLiveTraceBinaryData (const TraceGetBinaryDataRequest &request, uint64_t expected_size) |
| Dispatcher for live trace data requests with some additional error checking. More...
|
|
llvm::Error | OnLiveThreadBinaryDataRead (lldb::tid_t tid, llvm::StringRef kind, OnBinaryDataReadCallback callback) |
| Implementation of OnThreadBinaryDataRead() for live threads. More...
|
|
llvm::Error | OnLiveCpuBinaryDataRead (lldb::cpu_id_t cpu, llvm::StringRef kind, OnBinaryDataReadCallback callback) |
| Implementation of OnLiveBinaryDataRead() for live cpus. More...
|
|
llvm::Error | OnPostMortemThreadBinaryDataRead (lldb::tid_t tid, llvm::StringRef kind, OnBinaryDataReadCallback callback) |
| Implementation of OnThreadBinaryDataRead() for post mortem threads. More...
|
|
llvm::Error | OnPostMortemCpuBinaryDataRead (lldb::cpu_id_t cpu_id, llvm::StringRef kind, OnBinaryDataReadCallback callback) |
| Implementation of OnCpuBinaryDataRead() for post mortem cpus. More...
|
|
llvm::Expected< FileSpec > | GetPostMortemThreadDataFile (lldb::tid_t tid, llvm::StringRef kind) |
| Get the file path containing data of a postmortem thread given a data identifier. More...
|
|
llvm::Expected< FileSpec > | GetPostMortemCpuDataFile (lldb::cpu_id_t cpu_id, llvm::StringRef kind) |
| Get the file path containing data of a postmortem cpu given a data identifier. More...
|
|
void | SetPostMortemThreadDataFile (lldb::tid_t tid, llvm::StringRef kind, FileSpec file_spec) |
| Associate a given thread with a data file using a data identifier. More...
|
|
void | SetPostMortemCpuDataFile (lldb::cpu_id_t cpu_id, llvm::StringRef kind, FileSpec file_spec) |
| Associate a given cpu with a data file using a data identifier. More...
|
|
llvm::Expected< std::vector< uint8_t > > | GetLiveThreadBinaryData (lldb::tid_t tid, llvm::StringRef kind) |
| Get binary data of a live thread given a data identifier. More...
|
|
llvm::Expected< std::vector< uint8_t > > | GetLiveCpuBinaryData (lldb::cpu_id_t cpu_id, llvm::StringRef kind) |
| Get binary data of a live cpu given a data identifier. More...
|
|
llvm::Expected< std::vector< uint8_t > > | GetLiveProcessBinaryData (llvm::StringRef kind) |
| Get binary data of the current process given a data identifier. More...
|
|
llvm::Optional< uint64_t > | GetLiveThreadBinaryDataSize (lldb::tid_t tid, llvm::StringRef kind) |
| Get the size of the data returned by GetLiveThreadBinaryData. More...
|
|
llvm::Optional< uint64_t > | GetLiveCpuBinaryDataSize (lldb::cpu_id_t cpu_id, llvm::StringRef kind) |
| Get the size of the data returned by GetLiveCpuBinaryData. More...
|
|
llvm::Optional< uint64_t > | GetLiveProcessBinaryDataSize (llvm::StringRef kind) |
| Get the size of the data returned by GetLiveProcessBinaryData. More...
|
|
| Trace (llvm::ArrayRef< lldb::ProcessSP > postmortem_processes, llvm::Optional< std::vector< lldb::cpu_id_t >> postmortem_cpus) |
| Constructor for post mortem processes. More...
|
|
| Trace (Process &live_process) |
| Constructor for a live process. More...
|
|
llvm::Error | Start (const llvm::json::Value &request) |
| Start tracing a live process or its threads. More...
|
|
llvm::Expected< std::string > | GetLiveProcessState () |
| Get the current tracing state of a live process and its threads. More...
|
|
virtual llvm::Error | DoRefreshLiveProcessState (TraceGetStateResponse state, llvm::StringRef json_response)=0 |
| Method to be overriden by the plug-in to refresh its own state. More...
|
|
std::vector< Process * > | GetTracedProcesses () |
| Return the list of processes traced by this instance. More...
|
|
const char * | RefreshLiveProcessState () |
| Method to be invoked by the plug-in to refresh the live process state. More...
|
|
A plug-in interface definition class for trace information.
Trace plug-ins allow processor trace information to be loaded into LLDB so that the data can be dumped, used for reverse and forward stepping to allow introspection into the reason your process crashed or found its way to its current state.
Trace information can be loaded into a target without a process to allow introspection of the trace information during post mortem analysis, such as when loading core files.
Processor trace information can also be fetched through the process interfaces during a live debug session if your process supports gathering this information.
In order to support live tracing, the name of the plug-in should match the name of the tracing type returned by the gdb-remote packet jLLDBTraceSupported.
Definition at line 46 of file Trace.h.
Expected< lldb::TraceSP > Trace::FindPluginForPostMortemProcess |
( |
Debugger & |
debugger, |
|
|
const llvm::json::Value & |
bundle_description, |
|
|
llvm::StringRef |
session_file_dir |
|
) |
| |
|
static |
Find a trace plug-in using JSON data.
When loading trace data from disk, the information for the trace data can be contained in multiple files and require plug-in specific information about the CPU. Using data like JSON provides an easy way to specify all of the settings and information that we will need to load trace data into LLDB. This structured data can include:
- The plug-in name (this allows a specific plug-in to be selected)
- Architecture or target triple
- one or more paths to the trace data file on disk
- cpu trace data
- thread events or related information
- shared library load information to use for this trace data that allows a target to be created so the trace information can be symbolicated so that the trace information can be displayed to the user
- shared library path
- load address
- information on how to fetch the shared library
- path to locally cached file on disk
- URL to download the file
- Any information needed to load the trace file
- CPU information
- Custom plug-in information needed to decode the trace information correctly.
- Parameters
-
[in] | debugger | The debugger instance where new Targets will be created as part of the JSON data parsing. |
[in] | bundle_description | The trace bundle description object describing the trace session. |
[in] | bundle_dir | The path to the directory that contains the trace bundle. |
Definition at line 117 of file Trace.cpp.
References createInvalidPlugInError(), llvm::json::fromJSON(), and JSONSimpleTraceBundleDescription::type.
Fetch binary data associated with a cpu, either live or postmortem, and pass it to the given callback.
The reason of having a callback is to free the caller from having to manage the life cycle of the data and to hide the different data fetching procedures that exist for live and post mortem cpus.
The fetched data is not persisted after the callback is invoked.
- Parameters
-
[in] | cpu_id | The cpu who owns the data. |
[in] | kind | The kind of data to read. |
[in] | callback | The callback to be invoked once the data was successfully read. Its return value, which is an llvm::Error, is returned by this function. |
- Returns
- An llvm::Error if the data couldn't be fetched, or the return value of the callback, otherwise.
Definition at line 500 of file Trace.cpp.
Referenced by BuildCpusSection(), and GetIntelPTSubtracesForCpu().
Fetch binary data associated with a thread, either live or postmortem, and pass it to the given callback.
The reason of having a callback is to free the caller from having to manage the life cycle of the data and to hide the different data fetching procedures that exist for live and post mortem threads.
The fetched data is not persisted after the callback is invoked.
- Parameters
-
[in] | tid | The tid who owns the data. |
[in] | kind | The kind of data to read. |
[in] | callback | The callback to be invoked once the data was successfully read. Its return value, which is an llvm::Error, is returned by this function. |
- Returns
- An llvm::Error if the data couldn't be fetched, or the return value of the callback, otherwise.
Definition at line 468 of file Trace.cpp.
Referenced by lldb_private::trace_intel_pt::TraceIntelPT::OnThreadBufferRead().
const char * Trace::RefreshLiveProcessState |
( |
| ) |
|
|
protected |
Method to be invoked by the plug-in to refresh the live process state.
It will invoked DoRefreshLiveProcessState at some point, which should be implemented by the plug-in for custom state handling.
The result is cached through the same process stop. Even in the case of errors, it caches the error.
- Returns
- An error message if this operation failed, or nullptr otherwise.
Definition at line 279 of file Trace.cpp.
References lldb_private::TraceThreadState::binary_data, lldb_private::TraceCpuState::binary_data, lldb_private::GetLog(), lldb_private::TraceCpuState::id, lldb_private::TraceBinaryData::kind, LLDB_LOG, lldb_private::TraceBinaryData::size, string(), lldb_private::TraceThreadState::tid, lldb_private::toString(), and warning().
Referenced by lldb_private::trace_intel_pt::TraceIntelPT::Decode(), and lldb_private::trace_intel_pt::TraceIntelPT::GetUpdatedStorage().