LLDB mainline
Public Member Functions | Private Attributes | List of all members
lldb_private::HTRInstructionLayer Class Reference

"Base" layer of HTR representing the dynamic instructions of the trace. More...

#include <TraceHTR.h>

Inheritance diagram for lldb_private::HTRInstructionLayer:
Inheritance graph
[legend]

Public Member Functions

 HTRInstructionLayer (size_t id)
 Construct new instruction layer.
 
size_t GetNumUnits () const override
 Get the total number of units (instruction or block) in this layer.
 
HTRBlockMetadata GetMetadataByIndex (size_t index) const override
 Get the metadata of a unit (instruction or block) in the layer.
 
llvm::ArrayRef< lldb::addr_tGetInstructionTrace () const
 Get the dynamic instruction trace.
 
void AddCallInstructionMetadata (lldb::addr_t load_addr, std::optional< ConstString > func_name)
 Add metadata for a 'call' instruction of the trace.
 
void AppendInstruction (lldb::addr_t load_addr)
 Append the load address of an instruction to the dynamic instruction trace.
 
- Public Member Functions inherited from lldb_private::IHTRLayer
 IHTRLayer (size_t id)
 Construct new HTR layer.
 
size_t GetLayerId () const
 Get the ID of the layer.
 
virtual HTRBlockMetadata GetMetadataByIndex (size_t index) const =0
 Get the metadata of a unit (instruction or block) in the layer.
 
virtual size_t GetNumUnits () const =0
 Get the total number of units (instruction or block) in this layer.
 
HTRBlock MergeUnits (size_t start_unit_index, size_t num_units)
 Creates a new block from the result of merging a contiguous sequence of "units" (instructions or blocks depending on layer type) in this layer This allows the implementation class to decide how to store/generate this metadata.
 
virtual ~IHTRLayer ()=default
 

Private Attributes

std::vector< lldb::addr_tm_instruction_trace
 
std::unordered_map< lldb::addr_t, std::optional< ConstString > > m_call_isns
 

Additional Inherited Members

- Protected Attributes inherited from lldb_private::IHTRLayer
size_t m_layer_id
 ID of the layer.
 

Detailed Description

"Base" layer of HTR representing the dynamic instructions of the trace.

See lldb/docs/htr.rst for comprehensive HTR documentation

Definition at line 193 of file TraceHTR.h.

Constructor & Destructor Documentation

◆ HTRInstructionLayer()

lldb_private::HTRInstructionLayer::HTRInstructionLayer ( size_t  id)
inline

Construct new instruction layer.

Parameters
[in]idThe layer's id.

Definition at line 199 of file TraceHTR.h.

Member Function Documentation

◆ AddCallInstructionMetadata()

void HTRInstructionLayer::AddCallInstructionMetadata ( lldb::addr_t  load_addr,
std::optional< ConstString func_name 
)

Add metadata for a 'call' instruction of the trace.

Parameters
[in]load_addrThe load address of the 'call' instruction.
[in]func_nameThe name of the function the 'call' instruction is calling if it can be determined, std::nullopt otherwise.

Definition at line 83 of file TraceHTR.cpp.

References m_call_isns.

◆ AppendInstruction()

void HTRInstructionLayer::AppendInstruction ( lldb::addr_t  load_addr)

Append the load address of an instruction to the dynamic instruction trace.

Parameters
[in]load_addrThe load address of the instruction.

Definition at line 88 of file TraceHTR.cpp.

References m_instruction_trace.

◆ GetInstructionTrace()

llvm::ArrayRef< lldb::addr_t > HTRInstructionLayer::GetInstructionTrace ( ) const

Get the dynamic instruction trace.

Returns
The dynamic instruction trace.

Definition at line 79 of file TraceHTR.cpp.

References m_instruction_trace.

◆ GetMetadataByIndex()

HTRBlockMetadata HTRInstructionLayer::GetMetadataByIndex ( size_t  index) const
overridevirtual

Get the metadata of a unit (instruction or block) in the layer.

Parameters
[in]indexThe position of the unit in the layer.
Returns
The metadata of the unit in the layer.

Implements lldb_private::IHTRLayer.

Definition at line 106 of file TraceHTR.cpp.

References m_call_isns, and m_instruction_trace.

Referenced by lldb_private::toJSON().

◆ GetNumUnits()

size_t HTRInstructionLayer::GetNumUnits ( ) const
overridevirtual

Get the total number of units (instruction or block) in this layer.

Returns
The total number of units in the layer.

Implements lldb_private::IHTRLayer.

Definition at line 119 of file TraceHTR.cpp.

References m_instruction_trace.

Member Data Documentation

◆ m_call_isns

std::unordered_map<lldb::addr_t, std::optional<ConstString> > lldb_private::HTRInstructionLayer::m_call_isns
private

Definition at line 239 of file TraceHTR.h.

Referenced by AddCallInstructionMetadata(), and GetMetadataByIndex().

◆ m_instruction_trace

std::vector<lldb::addr_t> lldb_private::HTRInstructionLayer::m_instruction_trace
private

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