LLDB  mainline
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
PSBBlockDecoder Class Reference

Class that decodes a raw buffer for a single PSB block using the low level libipt library. More...

Collaboration diagram for PSBBlockDecoder:
Collaboration graph
[legend]

Public Member Functions

 PSBBlockDecoder (PtInsnDecoderUP &&decoder_up, const PSBBlock &psb_block, Optional< lldb::addr_t > next_block_ip, DecodedThread &decoded_thread)
 
void DecodePSBBlock ()
 

Static Public Member Functions

static Expected< PSBBlockDecoderCreate (TraceIntelPT &trace_intel_pt, const PSBBlock &psb_block, ArrayRef< uint8_t > buffer, Process &process, Optional< lldb::addr_t > next_block_ip, DecodedThread &decoded_thread)
 

Private Member Functions

void DecodeInstructionsAndEvents (int status)
 Decode all the instructions and events of the given PSB block. More...
 
int ProcessPTEvents (int status)
 Before querying instructions, we need to query the events associated with that instruction, e.g. More...
 

Private Attributes

PtInsnDecoderUP m_decoder_up
 
PSBBlock m_psb_block
 
Optional< lldb::addr_tm_next_block_ip
 
DecodedThreadm_decoded_thread
 

Detailed Description

Class that decodes a raw buffer for a single PSB block using the low level libipt library.

It assumes that kernel and user mode instructions are not mixed in the same PSB block.

Throughout this code, the status of the decoder will be used to identify events needed to be processed or errors in the decoder. The values can be

Definition at line 141 of file LibiptDecoder.cpp.

Constructor & Destructor Documentation

◆ PSBBlockDecoder()

PSBBlockDecoder::PSBBlockDecoder ( PtInsnDecoderUP &&  decoder_up,
const PSBBlock psb_block,
Optional< lldb::addr_t next_block_ip,
DecodedThread decoded_thread 
)
inline
Parameters
[in]decoderA decoder configured to start and end within the boundaries of the given psb_block.
[in]psb_blockThe PSB block to decode.
[in]next_block_ipThe starting ip at the next PSB block of the same thread if available.
[in]decoded_threadA DecodedThread object where the decoded instructions will be appended to. It might have already some instructions.

Definition at line 156 of file LibiptDecoder.cpp.

Member Function Documentation

◆ Create()

static Expected<PSBBlockDecoder> PSBBlockDecoder::Create ( TraceIntelPT trace_intel_pt,
const PSBBlock psb_block,
ArrayRef< uint8_t >  buffer,
Process process,
Optional< lldb::addr_t next_block_ip,
DecodedThread decoded_thread 
)
inlinestatic
Parameters
[in]trace_intel_ptThe main Trace object that own the PSB block.
[in]decoderA decoder configured to start and end within the boundaries of the given psb_block.
[in]psb_blockThe PSB block to decode.
[in]bufferThe raw intel pt trace for this block.
[in]processThe process to decode. It provides the memory image to use for decoding.
[in]next_block_ipThe starting ip at the next PSB block of the same thread if available.
[in]decoded_threadA DecodedThread object where the decoded instructions will be appended to. It might have already some instructions.

Definition at line 186 of file LibiptDecoder.cpp.

References CreateInstructionDecoder().

◆ DecodeInstructionsAndEvents()

void PSBBlockDecoder::DecodeInstructionsAndEvents ( int  status)
inlineprivate

Decode all the instructions and events of the given PSB block.

Parameters
[in]statusThe status that was result of synchronizing to the most recent PSB.

Definition at line 220 of file LibiptDecoder.cpp.

References IsEndOfStream(), and IsLibiptError().

◆ DecodePSBBlock()

void PSBBlockDecoder::DecodePSBBlock ( )
inline

Definition at line 198 of file LibiptDecoder.cpp.

◆ ProcessPTEvents()

int PSBBlockDecoder::ProcessPTEvents ( int  status)
inlineprivate

Before querying instructions, we need to query the events associated with that instruction, e.g.

timing and trace disablement events.

Parameters
[in]statusThe status gotten from the previous instruction decoding or PSB synchronization.
Returns
The pte_status after decoding events.

Definition at line 271 of file LibiptDecoder.cpp.

References lldb::eTraceEventDisabledHW, lldb::eTraceEventDisabledSW, HasEvents(), and IsLibiptError().

Member Data Documentation

◆ m_decoded_thread

DecodedThread& PSBBlockDecoder::m_decoded_thread
private

Definition at line 315 of file LibiptDecoder.cpp.

◆ m_decoder_up

PtInsnDecoderUP PSBBlockDecoder::m_decoder_up
private

Definition at line 312 of file LibiptDecoder.cpp.

◆ m_next_block_ip

Optional<lldb::addr_t> PSBBlockDecoder::m_next_block_ip
private

Definition at line 314 of file LibiptDecoder.cpp.

◆ m_psb_block

PSBBlock PSBBlockDecoder::m_psb_block
private

Definition at line 313 of file LibiptDecoder.cpp.


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