LLDB
mainline
|
#include <TraceIntelPTBundleLoader.h>
Classes | |
struct | ParsedProcess |
Helper struct holding the objects created when parsing a process. More... | |
Public Member Functions | |
TraceIntelPTBundleLoader (Debugger &debugger, const llvm::json::Value &bundle_description, llvm::StringRef bundle_dir) | |
llvm::Expected< lldb::TraceSP > | Load () |
Parse the trace bundle description and create the corresponding Target objects. More... | |
Static Public Member Functions | |
static llvm::StringRef | GetSchema () |
Private Member Functions | |
FileSpec | NormalizePath (const std::string &path) |
Resolve non-absolute paths relative to the bundle folder. More... | |
lldb::ThreadPostMortemTraceSP | ParseThread (Process &process, const JSONThread &thread) |
Create a post-mortem thread associated with the given process using the definition from thread . More... | |
llvm::Expected< lldb::TraceSP > | CreateTraceIntelPTInstance (JSONTraceBundleDescription &bundle_description, std::vector< ParsedProcess > &parsed_processes) |
Given a bundle description and a list of fully parsed processes, create an actual Trace instance that "traces" these processes. More... | |
llvm::Expected< ParsedProcess > | ParseProcess (const JSONProcess &process) |
Create the corresponding Threads and Process objects given the JSON process definition. More... | |
llvm::Error | ParseModule (Target &target, const JSONModule &module) |
Create a module associated with the given target using the definition from module . More... | |
llvm::Error | CreateJSONError (llvm::json::Path::Root &root, const llvm::json::Value &value) |
Create a user-friendly error message upon a JSON-parsing failure using the json::ObjectMapper functionality. More... | |
llvm::Expected< std::vector< ParsedProcess > > | LoadBundle (const JSONTraceBundleDescription &bundle_description) |
Create the corresponding Process, Thread and Module objects given this bundle description. More... | |
llvm::Error | AugmentThreadsFromContextSwitches (JSONTraceBundleDescription &bundle_description) |
When applicable, augment the list of threads in the trace bundle by inspecting the context switch trace. More... | |
void | NormalizeAllPaths (JSONTraceBundleDescription &bundle_description) |
Modifiy the bundle description by normalizing all the paths relative to the session file directory. More... | |
Private Attributes | |
Debugger & | m_debugger |
const llvm::json::Value & | m_bundle_description |
const std::string | m_bundle_dir |
Definition at line 20 of file TraceIntelPTBundleLoader.h.
|
inline |
[in] | debugger | The debugger that will own the targets to create. |
[in] | bundle_description | The JSON description of a trace bundle that follows the schema of the intel pt trace plug-in. |
[in] | bundle_dir | The folder where the trace bundle is located. |
Definition at line 36 of file TraceIntelPTBundleLoader.h.
|
private |
When applicable, augment the list of threads in the trace bundle by inspecting the context switch trace.
This only applies for threads of processes already specified in this bundle description.
Definition at line 229 of file TraceIntelPTBundleLoader.cpp.
References lldb_private::trace_intel_pt::JSONCpu::context_switch_trace, lldb_private::trace_intel_pt::JSONTraceBundleDescription::cpus, lldb_private::trace_intel_pt::JSONProcess::pid, lldb_private::trace_intel_pt::JSONTraceBundleDescription::processes, lldb_private::trace_intel_pt::JSONProcess::threads, lldb_private::trace_intel_pt::JSONThread::tid, and lldb_private::trace_intel_pt::JSONTraceBundleDescription::tsc_perf_zero_conversion.
|
private |
Create a user-friendly error message upon a JSON-parsing failure using the json::ObjectMapper functionality.
[in] | root | The llvm::json::Path::Root used to parse the JSON value. |
[in] | value | The json value that failed to parse. |
Definition at line 66 of file TraceIntelPTBundleLoader.cpp.
References string(), and lldb_private::toString().
|
private |
Given a bundle description and a list of fully parsed processes, create an actual Trace instance that "traces" these processes.
Definition at line 277 of file TraceIntelPTBundleLoader.cpp.
|
static |
Definition at line 152 of file TraceIntelPTBundleLoader.cpp.
References string().
Expected< TraceSP > TraceIntelPTBundleLoader::Load | ( | ) |
Parse the trace bundle description and create the corresponding Target objects.
In case of an error, no targets are created.
Definition at line 317 of file TraceIntelPTBundleLoader.cpp.
References lldb_private::fromJSON().
Referenced by lldb_private::trace_intel_pt::TraceIntelPT::CreateInstanceForTraceBundle().
|
private |
Create the corresponding Process, Thread and Module objects given this bundle description.
Definition at line 131 of file TraceIntelPTBundleLoader.cpp.
References lldb_private::trace_intel_pt::JSONTraceBundleDescription::processes.
|
private |
Modifiy the bundle description by normalizing all the paths relative to the session file directory.
Definition at line 295 of file TraceIntelPTBundleLoader.cpp.
References lldb_private::trace_intel_pt::JSONCpu::context_switch_trace, lldb_private::trace_intel_pt::JSONTraceBundleDescription::cpus, lldb_private::trace_intel_pt::JSONModule::file, lldb_private::trace_intel_pt::JSONThread::ipt_trace, lldb_private::trace_intel_pt::JSONCpu::ipt_trace, lldb_private::trace_intel_pt::JSONProcess::modules, lldb_private::trace_intel_pt::JSONTraceBundleDescription::processes, lldb_private::trace_intel_pt::JSONModule::system_path, and lldb_private::trace_intel_pt::JSONProcess::threads.
|
private |
Resolve non-absolute paths relative to the bundle folder.
Definition at line 25 of file TraceIntelPTBundleLoader.cpp.
References lldb_private::FileSpec::IsRelative(), and lldb_private::FileSpec::PrependPathComponent().
|
private |
Create a module associated with the given target
using the definition from module
.
Definition at line 32 of file TraceIntelPTBundleLoader.cpp.
References error(), lldb_private::trace_intel_pt::JSONModule::file, lldb_private::ModuleSpec::GetFileSpec(), lldb_private::Target::GetOrCreateModule(), lldb_private::ModuleSpec::GetPlatformFileSpec(), lldb_private::ModuleSpec::GetUUID(), lldb_private::trace_intel_pt::JSONModule::load_address, lldb_private::UUID::SetFromStringRef(), lldb_private::trace_intel_pt::JSONModule::system_path, lldb_private::toString(), lldb_private::trace_intel_pt::JSONModule::uuid, and lldb_private::JSONUINT64::value.
|
private |
Create the corresponding Threads and Process objects given the JSON process definition.
[in] | process | The JSON process definition |
Definition at line 92 of file TraceIntelPTBundleLoader.cpp.
References lldb_private::eLoadDependentsNo, error(), lldb_private::trace_intel_pt::JSONProcess::modules, lldb_private::trace_intel_pt::JSONProcess::pid, lldb_private::trace_intel_pt::TraceIntelPTBundleLoader::ParsedProcess::target_sp, lldb_private::trace_intel_pt::TraceIntelPTBundleLoader::ParsedProcess::threads, lldb_private::trace_intel_pt::JSONProcess::threads, and lldb_private::trace_intel_pt::JSONProcess::triple.
|
private |
Create a post-mortem thread associated with the given process
using the definition from thread
.
Definition at line 77 of file TraceIntelPTBundleLoader.cpp.
References lldb_private::ThreadCollection::AddThread(), lldb_private::Process::GetThreadList(), lldb_private::trace_intel_pt::JSONThread::ipt_trace, and lldb_private::trace_intel_pt::JSONThread::tid.
|
private |
Definition at line 112 of file TraceIntelPTBundleLoader.h.
|
private |
Definition at line 113 of file TraceIntelPTBundleLoader.h.
|
private |
Definition at line 111 of file TraceIntelPTBundleLoader.h.