LLDB mainline
Namespaces | Classes | Typedefs | Functions | Variables
lldb_private::trace_intel_pt Namespace Reference

Namespaces

namespace  ParsingUtils
 

Classes

class  CommandObjectProcessTraceStartIntelPT
 
class  CommandObjectThreadTraceStartIntelPT
 
class  DecodedThread
 Class holding the instructions and function call hierarchy obtained from decoding a trace, as well as a position cursor used when reverse debugging the trace. More...
 
class  IntelPTError
 Class for representing a libipt decoding error. More...
 
struct  IntelPTThreadContinousExecution
 This struct represents a continuous execution of a thread in a cpu, delimited by a context switch in and out, and a list of Intel PT subtraces that belong to this execution. More...
 
struct  JSONCpu
 
struct  JSONKernel
 
struct  JSONModule
 
struct  JSONProcess
 
struct  JSONThread
 
struct  JSONTraceBundleDescription
 
struct  PSBBlock
 This struct represents a contiguous section of a trace that starts at a PSB and ends right before the next PSB or the end of the trace. More...
 
class  ScopedTaskTimer
 Class used to track the duration of long running tasks related to a single scope for reporting. More...
 
class  TaskTimer
 Class used to track the duration of long running tasks for reporting. More...
 
struct  ThreadContinuousExecution
 This class indicates the time interval in which a thread was running continuously on a cpu core. More...
 
class  ThreadDecoder
 Class that handles the decoding of a thread and caches the result. More...
 
class  TraceCursorIntelPT
 
class  TraceIntelPT
 
class  TraceIntelPTBundleLoader
 
class  TraceIntelPTBundleSaver
 
class  TraceIntelPTMultiCpuDecoder
 Class used to decode a multi-cpu Intel PT trace. More...
 

Typedefs

using DecodedThreadSP = std::shared_ptr< DecodedThread >
 
using TraceIntelPTSP = std::shared_ptr< TraceIntelPT >
 

Functions

llvm::Error DecodeSingleTraceForThread (DecodedThread &decoded_thread, TraceIntelPT &trace_intel_pt, llvm::ArrayRef< uint8_t > buffer)
 Decode a raw Intel PT trace for a single thread given in buffer and append the decoded instructions and errors in decoded_thread.
 
llvm::Error DecodeSystemWideTraceForThread (DecodedThread &decoded_thread, TraceIntelPT &trace_intel_pt, const llvm::DenseMap< lldb::cpu_id_t, llvm::ArrayRef< uint8_t > > &buffers, const std::vector< IntelPTThreadContinousExecution > &executions)
 Decode a raw Intel PT trace for a single thread that was collected in a per cpu core basis.
 
llvm::Expected< std::vector< PSBBlock > > SplitTraceIntoPSBBlock (TraceIntelPT &trace_intel_pt, llvm::ArrayRef< uint8_t > buffer, bool expect_tscs)
 Given an intel pt trace, split it in chunks delimited by PSB packets.
 
llvm::Expected< std::optional< uint64_t > > FindLowestTSCInTrace (TraceIntelPT &trace_intel_pt, llvm::ArrayRef< uint8_t > buffer)
 Find the lowest TSC in the given trace.
 
llvm::Expected< std::vector< ThreadContinuousExecution > > DecodePerfContextSwitchTrace (llvm::ArrayRef< uint8_t > data, lldb::cpu_id_t cpu_id, const LinuxPerfZeroTscConversion &tsc_conversion)
 Decodes a context switch trace collected with perf_event_open.
 
llvm::Expected< std::vector< uint8_t > > FilterProcessesFromContextSwitchTrace (llvm::ArrayRef< uint8_t > data, const std::set< lldb::pid_t > &pids)
 
json::Value toJSON (const JSONModule &module)
 
bool fromJSON (const json::Value &value, JSONModule &module, Path path)
 
json::Value toJSON (const JSONThread &thread)
 
bool fromJSON (const json::Value &value, JSONThread &thread, Path path)
 
json::Value toJSON (const JSONProcess &process)
 
bool fromJSON (const json::Value &value, JSONProcess &process, Path path)
 
json::Value toJSON (const JSONCpu &cpu)
 
bool fromJSON (const json::Value &value, JSONCpu &cpu, Path path)
 
json::Value toJSON (const pt_cpu &cpu_info)
 
bool fromJSON (const json::Value &value, pt_cpu &cpu_info, Path path)
 
json::Value toJSON (const JSONKernel &kernel)
 
bool fromJSON (const json::Value &value, JSONKernel &kernel, Path path)
 
json::Value toJSON (const JSONTraceBundleDescription &bundle_description)
 
bool fromJSON (const json::Value &value, JSONTraceBundleDescription &bundle_description, Path path)
 
bool fromJSON (const llvm::json::Value &value, JSONModule &module, llvm::json::Path path)
 
bool fromJSON (const llvm::json::Value &value, JSONThread &thread, llvm::json::Path path)
 
bool fromJSON (const llvm::json::Value &value, JSONProcess &process, llvm::json::Path path)
 
bool fromJSON (const llvm::json::Value &value, JSONCpu &cpu, llvm::json::Path path)
 
bool fromJSON (const llvm::json::Value &value, pt_cpu &cpu_info, llvm::json::Path path)
 
bool fromJSON (const llvm::json::Value &value, JSONTraceBundleDescription &bundle_description, llvm::json::Path path)
 

Variables

const size_t kDefaultIptTraceSize = 4 * 1024
 
const size_t kDefaultProcessBufferSizeLimit = 5 * 1024 * 1024
 
const bool kDefaultEnableTscValue = false
 
const std::optional< size_t > kDefaultPsbPeriod
 
const bool kDefaultPerCpuTracing = false
 
const bool kDefaultDisableCgroupFiltering = false
 
const lldb::addr_t kDefaultKernelLoadAddress = 0xffffffff81000000
 
const lldb::pid_t kDefaultKernelProcessID = 1
 

Typedef Documentation

◆ DecodedThreadSP

Definition at line 325 of file DecodedThread.h.

◆ TraceIntelPTSP

Definition at line 20 of file forward-declarations.h.

Function Documentation

◆ DecodePerfContextSwitchTrace()

llvm::Expected< std::vector< ThreadContinuousExecution > > lldb_private::trace_intel_pt::DecodePerfContextSwitchTrace ( llvm::ArrayRef< uint8_t >  data,
lldb::cpu_id_t  cpu_id,
const LinuxPerfZeroTscConversion tsc_conversion 
)

Decodes a context switch trace collected with perf_event_open.

Parameters
[in]dataThe context switch trace in binary format.
[i]cpu_id The cpu_id where the trace were gotten from.
[in]tsc_conversionThe conversion values used to confert nanoseconds to TSC.
Returns
A list of continuous executions recovered from the raw trace sorted by time, or an llvm::Error if the data is malformed.

Referenced by lldb_private::trace_intel_pt::TraceIntelPTMultiCpuDecoder::DoCorrelateContextSwitchesAndIntelPtTraces().

◆ DecodeSingleTraceForThread()

llvm::Error lldb_private::trace_intel_pt::DecodeSingleTraceForThread ( DecodedThread decoded_thread,
TraceIntelPT trace_intel_pt,
llvm::ArrayRef< uint8_t >  buffer 
)

Decode a raw Intel PT trace for a single thread given in buffer and append the decoded instructions and errors in decoded_thread.

It uses the low level libipt library underneath.

Returns
An llvm::Error if the decoder couldn't be properly set up.

◆ DecodeSystemWideTraceForThread()

llvm::Error lldb_private::trace_intel_pt::DecodeSystemWideTraceForThread ( DecodedThread decoded_thread,
TraceIntelPT trace_intel_pt,
const llvm::DenseMap< lldb::cpu_id_t, llvm::ArrayRef< uint8_t > > &  buffers,
const std::vector< IntelPTThreadContinousExecution > &  executions 
)

Decode a raw Intel PT trace for a single thread that was collected in a per cpu core basis.

Parameters
[out]decoded_threadAll decoded instructions, errors and events will be appended to this object.
[in]trace_intel_ptThe main Trace object that contains all the information related to the trace session.
[in]buffersA map from cpu core id to raw intel pt buffers.
[in]executionsA list of chunks of timed executions of the same given thread. It is used to identify if some executions have missing intel pt data and also to determine in which core a certain part of the execution ocurred.
Returns
An llvm::Error if the decoder couldn't be properly set up, i.e. no instructions were attempted to be decoded.

◆ FilterProcessesFromContextSwitchTrace()

llvm::Expected< std::vector< uint8_t > > lldb_private::trace_intel_pt::FilterProcessesFromContextSwitchTrace ( llvm::ArrayRef< uint8_t >  data,
const std::set< lldb::pid_t > &  pids 
)

Referenced by WriteContextSwitchTrace().

◆ FindLowestTSCInTrace()

llvm::Expected< std::optional< uint64_t > > lldb_private::trace_intel_pt::FindLowestTSCInTrace ( TraceIntelPT trace_intel_pt,
llvm::ArrayRef< uint8_t >  buffer 
)

Find the lowest TSC in the given trace.

Returns
The lowest TSC value in this trace if available, std::nullopt if the trace is empty or the trace contains no timing information, or an llvm::Error if it was not possible to set up the decoder.

Referenced by lldb_private::trace_intel_pt::TraceIntelPTMultiCpuDecoder::FindLowestTSC().

◆ fromJSON() [1/13]

bool lldb_private::trace_intel_pt::fromJSON ( const json::Value &  value,
JSONCpu cpu,
Path  path 
)

◆ fromJSON() [2/13]

bool lldb_private::trace_intel_pt::fromJSON ( const json::Value &  value,
JSONKernel kernel,
Path  path 
)

◆ fromJSON() [3/13]

bool lldb_private::trace_intel_pt::fromJSON ( const json::Value &  value,
JSONModule module,
Path  path 
)

◆ fromJSON() [4/13]

bool lldb_private::trace_intel_pt::fromJSON ( const json::Value &  value,
JSONProcess process,
Path  path 
)

◆ fromJSON() [5/13]

bool lldb_private::trace_intel_pt::fromJSON ( const json::Value &  value,
JSONThread thread,
Path  path 
)

◆ fromJSON() [6/13]

bool lldb_private::trace_intel_pt::fromJSON ( const json::Value &  value,
JSONTraceBundleDescription bundle_description,
Path  path 
)

◆ fromJSON() [7/13]

bool lldb_private::trace_intel_pt::fromJSON ( const json::Value &  value,
pt_cpu &  cpu_info,
Path  path 
)

Definition at line 106 of file TraceIntelPTJSONStructs.cpp.

◆ fromJSON() [8/13]

bool lldb_private::trace_intel_pt::fromJSON ( const llvm::json::Value &  value,
JSONCpu cpu,
llvm::json::Path  path 
)

◆ fromJSON() [9/13]

bool lldb_private::trace_intel_pt::fromJSON ( const llvm::json::Value &  value,
JSONModule module,
llvm::json::Path  path 
)

◆ fromJSON() [10/13]

bool lldb_private::trace_intel_pt::fromJSON ( const llvm::json::Value &  value,
JSONProcess process,
llvm::json::Path  path 
)

◆ fromJSON() [11/13]

bool lldb_private::trace_intel_pt::fromJSON ( const llvm::json::Value &  value,
JSONThread thread,
llvm::json::Path  path 
)

◆ fromJSON() [12/13]

bool lldb_private::trace_intel_pt::fromJSON ( const llvm::json::Value &  value,
JSONTraceBundleDescription bundle_description,
llvm::json::Path  path 
)

◆ fromJSON() [13/13]

bool lldb_private::trace_intel_pt::fromJSON ( const llvm::json::Value &  value,
pt_cpu &  cpu_info,
llvm::json::Path  path 
)

◆ SplitTraceIntoPSBBlock()

Expected< std::vector< PSBBlock > > lldb_private::trace_intel_pt::SplitTraceIntoPSBBlock ( TraceIntelPT trace_intel_pt,
llvm::ArrayRef< uint8_t >  buffer,
bool  expect_tscs 
)

Given an intel pt trace, split it in chunks delimited by PSB packets.

Each of these chunks is guaranteed to have been executed continuously.

Parameters
[in]trace_intel_ptThe main Trace object that contains all the information related to the trace session.
[in]bufferThe intel pt buffer that belongs to a single thread or to a single cpu core.
[in]expect_tscsIf true, an error is return if a packet without TSC is found.
Returns
A list of continuous executions sorted by time, or an llvm::Error in case of failures.

Definition at line 686 of file LibiptDecoder.cpp.

References CreateQueryDecoder(), HasEvents(), IsLibiptError(), and LLDB_INVALID_ADDRESS.

Referenced by GetPSBBlocksForCPU().

◆ toJSON() [1/7]

llvm::json::Value lldb_private::trace_intel_pt::toJSON ( const JSONCpu cpu)

◆ toJSON() [2/7]

llvm::json::Value lldb_private::trace_intel_pt::toJSON ( const JSONKernel kernel)

◆ toJSON() [3/7]

llvm::json::Value lldb_private::trace_intel_pt::toJSON ( const JSONModule module)

◆ toJSON() [4/7]

llvm::json::Value lldb_private::trace_intel_pt::toJSON ( const JSONProcess process)

◆ toJSON() [5/7]

llvm::json::Value lldb_private::trace_intel_pt::toJSON ( const JSONThread thread)

◆ toJSON() [6/7]

llvm::json::Value lldb_private::trace_intel_pt::toJSON ( const JSONTraceBundleDescription bundle_description)

◆ toJSON() [7/7]

llvm::json::Value lldb_private::trace_intel_pt::toJSON ( const pt_cpu &  cpu_info)

Definition at line 97 of file TraceIntelPTJSONStructs.cpp.

References lldb_private::Object.

Variable Documentation

◆ kDefaultDisableCgroupFiltering

const bool lldb_private::trace_intel_pt::kDefaultDisableCgroupFiltering = false

◆ kDefaultEnableTscValue

const bool lldb_private::trace_intel_pt::kDefaultEnableTscValue = false

◆ kDefaultIptTraceSize

const size_t lldb_private::trace_intel_pt::kDefaultIptTraceSize = 4 * 1024

◆ kDefaultKernelLoadAddress

const lldb::addr_t lldb_private::trace_intel_pt::kDefaultKernelLoadAddress = 0xffffffff81000000

◆ kDefaultKernelProcessID

const lldb::pid_t lldb_private::trace_intel_pt::kDefaultKernelProcessID = 1

◆ kDefaultPerCpuTracing

const bool lldb_private::trace_intel_pt::kDefaultPerCpuTracing = false

◆ kDefaultProcessBufferSizeLimit

const size_t lldb_private::trace_intel_pt::kDefaultProcessBufferSizeLimit = 5 * 1024 * 1024

◆ kDefaultPsbPeriod

const std::optional<size_t> lldb_private::trace_intel_pt::kDefaultPsbPeriod