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

#include <TraceCursorIntelPT.h>

Inheritance diagram for lldb_private::trace_intel_pt::TraceCursorIntelPT:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::trace_intel_pt::TraceCursorIntelPT:
Collaboration graph
[legend]

Public Member Functions

 TraceCursorIntelPT (lldb::ThreadSP thread_sp, DecodedThreadSP decoded_thread_sp)
 
size_t Seek (int64_t offset, SeekType origin) override
 
virtual bool Next () override
 Move the cursor to the next instruction that matches the current granularity. More...
 
llvm::Error GetError () override
 Get the corresponding error message if the cursor points to an error in the trace. More...
 
lldb::addr_t GetLoadAddress () override
 
llvm::Optional< uint64_t > GetTimestampCounter () override
 Get the timestamp counter associated with the current instruction. More...
 
lldb::TraceInstructionControlFlowType GetInstructionControlFlowType () override
 
bool IsError () override
 Instruction or error information. More...
 
- Public Member Functions inherited from lldb_private::TraceCursor
 TraceCursor (lldb::ThreadSP thread_sp)
 Create a cursor that initially points to the end of the trace, i.e. More...
 
virtual ~TraceCursor ()=default
 
void SetGranularity (lldb::TraceInstructionControlFlowType granularity)
 Set the granularity to use in the TraceCursor::Next() method. More...
 
void SetIgnoreErrors (bool ignore_errors)
 Set the "ignore errors" flag to use in the TraceCursor::Next() method. More...
 
void SetForwards (bool forwards)
 Set the direction to use in the TraceCursor::Next() method. More...
 
bool IsForwards () const
 Check if the direction to use in the TraceCursor::Next() method is forwards. More...
 
virtual size_t Seek (ssize_t offset, SeekType origin)=0
 Make the cursor point to an item in the trace based on an origin point and an offset. More...
 
ExecutionContextRefGetExecutionContextRef ()
 

Private Member Functions

size_t GetInternalInstructionSize ()
 

Private Attributes

DecodedThreadSP m_decoded_thread_sp
 Storage of the actual instructions. More...
 
size_t m_pos
 Internal instruction index currently pointing at. More...
 

Additional Inherited Members

- Public Types inherited from lldb_private::TraceCursor
enum  SeekType { SeekType::Set = 0, SeekType::Current, SeekType::End }
 Helper enum to indicate the reference point when invoking TraceCursor::Seek(). More...
 
- Protected Attributes inherited from lldb_private::TraceCursor
ExecutionContextRef m_exe_ctx_ref
 
lldb::TraceInstructionControlFlowType m_granularity
 
bool m_ignore_errors = false
 
bool m_forwards = false
 

Detailed Description

Definition at line 18 of file TraceCursorIntelPT.h.

Constructor & Destructor Documentation

◆ TraceCursorIntelPT()

TraceCursorIntelPT::TraceCursorIntelPT ( lldb::ThreadSP  thread_sp,
DecodedThreadSP  decoded_thread_sp 
)

Definition at line 20 of file TraceCursorIntelPT.cpp.

References m_decoded_thread_sp, and m_pos.

Member Function Documentation

◆ GetError()

Error TraceCursorIntelPT::GetError ( )
overridevirtual

Get the corresponding error message if the cursor points to an error in the trace.

Returns
llvm::Error::success if the cursor is not pointing to an error in the trace. Otherwise return an llvm::Error describing the issue.

Implements lldb_private::TraceCursor.

Definition at line 80 of file TraceCursorIntelPT.cpp.

References m_decoded_thread_sp, and m_pos.

◆ GetInstructionControlFlowType()

TraceInstructionControlFlowType TraceCursorIntelPT::GetInstructionControlFlowType ( )
overridevirtual
Returns
The lldb::TraceInstructionControlFlowType categories the instruction the cursor is pointing at falls into. If the cursor points to an error in the trace, return 0.

Implements lldb_private::TraceCursor.

Definition at line 93 of file TraceCursorIntelPT.cpp.

References GetInternalInstructionSize(), LLDB_INVALID_ADDRESS, m_decoded_thread_sp, and m_pos.

Referenced by Next().

◆ GetInternalInstructionSize()

size_t TraceCursorIntelPT::GetInternalInstructionSize ( )
private

Definition at line 28 of file TraceCursorIntelPT.cpp.

References m_decoded_thread_sp.

Referenced by GetInstructionControlFlowType(), Next(), and Seek().

◆ GetLoadAddress()

lldb::addr_t TraceCursorIntelPT::GetLoadAddress ( )
overridevirtual
Returns
The load address of the instruction the cursor is pointing at. If the cursor points to an error in the trace, return LLDB_INVALID_ADDRESS.

Implements lldb_private::TraceCursor.

Definition at line 84 of file TraceCursorIntelPT.cpp.

References m_decoded_thread_sp, and m_pos.

◆ GetTimestampCounter()

Optional< uint64_t > TraceCursorIntelPT::GetTimestampCounter ( )
overridevirtual

Get the timestamp counter associated with the current instruction.

Modern Intel, ARM and AMD processors support this counter. However, a trace plugin might decide to use a different time unit instead of an actual TSC.

Returns
The timestamp or llvm::None if not available.

Implements lldb_private::TraceCursor.

Definition at line 88 of file TraceCursorIntelPT.cpp.

References m_decoded_thread_sp, and m_pos.

◆ IsError()

bool TraceCursorIntelPT::IsError ( )
overridevirtual

Instruction or error information.

Returns
Whether the cursor points to an error or not.

Implements lldb_private::TraceCursor.

Definition at line 76 of file TraceCursorIntelPT.cpp.

References m_decoded_thread_sp, and m_pos.

Referenced by Next().

◆ Next()

bool TraceCursorIntelPT::Next ( )
overridevirtual

Move the cursor to the next instruction that matches the current granularity.

Direction: The traversal is done following the current direction of the trace. If it is forwards, the instructions are visited forwards chronologically. Otherwise, the traversal is done in the opposite direction. By default, a cursor moves backwards unless changed with TraceCursor::SetForwards().

Granularity: The cursor will traverse the trace looking for the first instruction that matches the current granularity. If there aren't any matching instructions, the cursor won't move, to give the opportunity of changing granularities.

Ignore errors: If the "ignore errors" flags is false, the traversal will stop as soon as it finds an error in the trace and the cursor will point at it.

Returns
true if the cursor effectively moved, false otherwise.

Implements lldb_private::TraceCursor.

Definition at line 32 of file TraceCursorIntelPT.cpp.

References GetInstructionControlFlowType(), GetInternalInstructionSize(), IsError(), lldb_private::TraceCursor::IsForwards(), lldb_private::TraceCursor::m_granularity, lldb_private::TraceCursor::m_ignore_errors, and m_pos.

◆ Seek()

size_t TraceCursorIntelPT::Seek ( int64_t  offset,
SeekType  origin 
)
override

Member Data Documentation

◆ m_decoded_thread_sp

DecodedThreadSP lldb_private::trace_intel_pt::TraceCursorIntelPT::m_decoded_thread_sp
private

◆ m_pos

size_t lldb_private::trace_intel_pt::TraceCursorIntelPT::m_pos
private

Internal instruction index currently pointing at.

Definition at line 44 of file TraceCursorIntelPT.h.

Referenced by GetError(), GetInstructionControlFlowType(), GetLoadAddress(), GetTimestampCounter(), IsError(), Next(), Seek(), and TraceCursorIntelPT().


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