LLDB mainline
|
Main class that manages intel-pt process and thread tracing. More...
#include <IntelPTCollector.h>
Public Member Functions | |
IntelPTCollector (NativeProcessProtocol &process) | |
void | ProcessDidStop () |
To be invoked as soon as we know the process stopped. | |
void | ProcessWillResume () |
To be invoked before the process will resume, so that we can capture the first instructions after the resume. | |
llvm::Error | OnThreadCreated (lldb::tid_t tid) |
If "process tracing" is enabled, then trace the given thread. | |
llvm::Error | OnThreadDestroyed (lldb::tid_t tid) |
Stops tracing a tracing upon a destroy event. | |
llvm::Error | TraceStop (const TraceStopRequest &request) |
Implementation of the jLLDBTraceStop packet. | |
llvm::Error | TraceStart (const TraceIntelPTStartRequest &request) |
Implementation of the jLLDBTraceStart packet. | |
llvm::Expected< llvm::json::Value > | GetState () |
Implementation of the jLLDBTraceGetState packet. | |
llvm::Expected< std::vector< uint8_t > > | GetBinaryData (const TraceGetBinaryDataRequest &request) |
Implementation of the jLLDBTraceGetBinaryData packet. | |
void | Clear () |
Dispose of all traces. | |
Static Public Member Functions | |
static bool | IsSupported () |
Private Member Functions | |
llvm::Error | TraceStop (lldb::tid_t tid) |
llvm::Error | TraceStart (lldb::tid_t tid, const TraceIntelPTStartRequest &request) |
Start tracing a specific thread. | |
llvm::Expected< LinuxPerfZeroTscConversion & > | FetchPerfTscConversionParameters () |
Private Attributes | |
NativeProcessProtocol & | m_process |
The target process. | |
IntelPTThreadTraceCollection | m_thread_traces |
Threads traced due to "thread tracing". | |
IntelPTProcessTraceUP | m_process_trace_up |
Only one instance of "process trace" can be active at a given time. | |
Main class that manages intel-pt process and thread tracing.
Definition at line 29 of file IntelPTCollector.h.
IntelPTCollector::IntelPTCollector | ( | NativeProcessProtocol & | process | ) |
[in] | process | Process to be traced. |
Definition at line 33 of file IntelPTCollector.cpp.
void IntelPTCollector::Clear | ( | ) |
Dispose of all traces.
Definition at line 262 of file IntelPTCollector.cpp.
References lldb_private::process_linux::IntelPTThreadTraceCollection::Clear(), m_process_trace_up, and m_thread_traces.
Referenced by lldb_private::process_linux::NativeProcessLinux::Detach(), and TraceStop().
|
private |
Definition at line 37 of file IntelPTCollector.cpp.
References lldb_private::process_linux::LoadPerfTscConversionParameters(), and lldb_private::toString().
Referenced by GetState(), and TraceStart().
Expected< std::vector< uint8_t > > IntelPTCollector::GetBinaryData | ( | const TraceGetBinaryDataRequest & | request | ) |
Implementation of the jLLDBTraceGetBinaryData packet.
Definition at line 223 of file IntelPTCollector.cpp.
References lldb_private::TraceGetBinaryDataRequest::cpu_id, lldb_private::process_linux::GetProcfsCpuInfo(), lldb_private::TraceGetBinaryDataRequest::kind, lldb_private::IntelPTDataKinds::kProcFsCpuInfo, m_process_trace_up, m_thread_traces, lldb_private::TraceGetBinaryDataRequest::tid, and lldb_private::process_linux::IntelPTThreadTraceCollection::TryGetBinaryData().
Referenced by lldb_private::process_linux::NativeProcessLinux::TraceGetBinaryData().
Expected< json::Value > IntelPTCollector::GetState | ( | ) |
Implementation of the jLLDBTraceGetState packet.
Definition at line 195 of file IntelPTCollector.cpp.
References lldb_private::TraceGetStateResponse::AddWarning(), FetchPerfTscConversionParameters(), lldb_private::process_linux::IntelPTThreadTraceCollection::ForEachThread(), lldb_private::process_linux::IntelPTSingleBufferTrace::GetIptTraceSize(), lldb_private::process_linux::GetProcfsCpuInfo(), lldb_private::IntelPTDataKinds::kIptTrace, lldb_private::IntelPTDataKinds::kProcFsCpuInfo, m_process_trace_up, m_thread_traces, lldb_private::TraceGetStateResponse::process_binary_data, lldb_private::toJSON(), lldb_private::toString(), lldb_private::TraceGetStateResponse::traced_threads, and lldb_private::TraceIntelPTGetStateResponse::tsc_perf_zero_conversion.
Referenced by lldb_private::process_linux::NativeProcessLinux::TraceGetState().
|
static |
Definition at line 253 of file IntelPTCollector.cpp.
References lldb_private::process_linux::GetIntelPTOSEventType().
Referenced by lldb_private::process_linux::NativeProcessLinux::TraceSupported().
Error IntelPTCollector::OnThreadCreated | ( | lldb::tid_t | tid | ) |
If "process tracing" is enabled, then trace the given thread.
Definition at line 180 of file IntelPTCollector.cpp.
References m_process_trace_up.
Referenced by lldb_private::process_linux::NativeProcessLinux::NotifyTracersOfNewThread().
Error IntelPTCollector::OnThreadDestroyed | ( | lldb::tid_t | tid | ) |
Stops tracing a tracing upon a destroy event.
Definition at line 187 of file IntelPTCollector.cpp.
References m_process_trace_up, m_thread_traces, lldb_private::process_linux::IntelPTThreadTraceCollection::TracesThread(), and lldb_private::process_linux::IntelPTThreadTraceCollection::TraceStop().
Referenced by lldb_private::process_linux::NativeProcessLinux::NotifyTracersOfThreadDestroyed().
void IntelPTCollector::ProcessDidStop | ( | ) |
To be invoked as soon as we know the process stopped.
Definition at line 175 of file IntelPTCollector.cpp.
References m_process_trace_up.
Referenced by lldb_private::process_linux::NativeProcessLinux::NotifyTracersProcessDidStop().
void IntelPTCollector::ProcessWillResume | ( | ) |
To be invoked before the process will resume, so that we can capture the first instructions after the resume.
Definition at line 170 of file IntelPTCollector.cpp.
References m_process_trace_up.
Referenced by lldb_private::process_linux::NativeProcessLinux::NotifyTracersProcessWillResume().
Error IntelPTCollector::TraceStart | ( | const TraceIntelPTStartRequest & | request | ) |
Implementation of the jLLDBTraceStart packet.
Definition at line 99 of file IntelPTCollector.cpp.
References lldb_private::TraceIntelPTStartRequest::disable_cgroup_filtering, lldb_private::TraceIntelPTStartRequest::enable_tsc, error(), FetchPerfTscConversionParameters(), GetCGroupFileDescriptor(), lldb_private::NativeProcessProtocol::GetID(), lldb_private::process_linux::IntelPTThreadTraceCollection::GetTracedThreadsCount(), lldb_private::TraceIntelPTStartRequest::IsPerCpuTracing(), lldb_private::TraceStartRequest::IsProcessTracing(), m_process, m_process_trace_up, m_thread_traces, lldb_private::process_linux::IntelPTPerThreadProcessTrace::Start(), lldb_private::process_linux::IntelPTMultiCoreTrace::StartOnAllCores(), lldb_private::NativeProcessProtocol::Threads(), lldb_private::TraceStartRequest::tids, and lldb_private::process_linux::IntelPTThreadTraceCollection::TraceStart().
Referenced by lldb_private::process_linux::NativeProcessLinux::TraceStart().
|
private |
Start tracing a specific thread.
Error IntelPTCollector::TraceStop | ( | const TraceStopRequest & | request | ) |
Implementation of the jLLDBTraceStop packet.
Definition at line 53 of file IntelPTCollector.cpp.
References Clear(), error(), lldb_private::TraceStopRequest::IsProcessTracing(), lldb_private::TraceStopRequest::tids, and TraceStop().
Referenced by TraceStop(), and lldb_private::process_linux::NativeProcessLinux::TraceStop().
|
private |
Definition at line 47 of file IntelPTCollector.cpp.
References m_process_trace_up, m_thread_traces, and lldb_private::process_linux::IntelPTThreadTraceCollection::TraceStop().
|
private |
|
private |
Only one instance of "process trace" can be active at a given time.
It might be nullptr.
Definition at line 85 of file IntelPTCollector.h.
Referenced by Clear(), GetBinaryData(), GetState(), OnThreadCreated(), OnThreadDestroyed(), ProcessDidStop(), ProcessWillResume(), TraceStart(), and TraceStop().
|
private |
Threads traced due to "thread tracing".
Definition at line 81 of file IntelPTCollector.h.
Referenced by Clear(), GetBinaryData(), GetState(), OnThreadDestroyed(), TraceStart(), and TraceStop().