LLDB mainline
|
#include <SBTraceCursor.h>
Public Member Functions | |
SBTraceCursor () | |
Default constructor for an invalid SBTraceCursor object. | |
void | SetForwards (bool forwards) |
Set the direction to use in the SBTraceCursor::Next() method. | |
bool | IsForwards () const |
Check if the direction to use in the SBTraceCursor::Next() method is forwards. | |
void | Next () |
Move the cursor to the next item (instruction or error). | |
bool | HasValue () const |
bool | GoToId (lldb::user_id_t id) |
Instruction identifiers: | |
bool | HasId (lldb::user_id_t id) const |
lldb::user_id_t | GetId () const |
bool | Seek (int64_t offset, lldb::TraceCursorSeekType origin) |
Make the cursor point to an item in the trace based on an origin point and an offset. | |
class | SBTrace |
lldb::TraceCursorSP | m_opaque_sp |
lldb::TraceItemKind | GetItemKind () const |
Trace item information (instructions, errors and events) | |
bool | IsError () const |
const char * | GetError () const |
bool | IsEvent () const |
lldb::TraceEvent | GetEventType () const |
const char * | GetEventTypeAsString () const |
bool | IsInstruction () const |
lldb::addr_t | GetLoadAddress () const |
lldb::cpu_id_t | GetCPU () const |
bool | IsValid () const |
operator bool () const | |
SBTraceCursor (lldb::TraceCursorSP trace_cursor_sp) | |
Create a cursor that initially points to the end of the trace, i.e. | |
Definition at line 18 of file SBTraceCursor.h.
SBTraceCursor::SBTraceCursor | ( | ) |
Default constructor for an invalid SBTraceCursor object.
Definition at line 18 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA.
|
protected |
Create a cursor that initially points to the end of the trace, i.e.
the most recent item.
Definition at line 20 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA.
lldb::cpu_id_t SBTraceCursor::GetCPU | ( | ) | const |
Definition at line 121 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
const char * SBTraceCursor::GetError | ( | ) | const |
Definition at line 85 of file SBTraceCursor.cpp.
References lldb_private::ConstString::GetCString(), LLDB_INSTRUMENT_VA, and m_opaque_sp.
lldb::TraceEvent SBTraceCursor::GetEventType | ( | ) | const |
Definition at line 97 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
const char * SBTraceCursor::GetEventTypeAsString | ( | ) | const |
Definition at line 103 of file SBTraceCursor.cpp.
References lldb_private::ConstString::GetCString(), LLDB_INSTRUMENT_VA, and m_opaque_sp.
lldb::user_id_t SBTraceCursor::GetId | ( | ) | const |
Definition at line 61 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
lldb::TraceItemKind SBTraceCursor::GetItemKind | ( | ) | const |
Trace item information (instructions, errors and events)
Definition at line 73 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
lldb::addr_t SBTraceCursor::GetLoadAddress | ( | ) | const |
Definition at line 115 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
bool SBTraceCursor::GoToId | ( | lldb::user_id_t | id | ) |
Instruction identifiers:
When building complex higher level tools, fast random accesses in the trace might be needed, for which each instruction requires a unique identifier within its thread trace. For example, a tool might want to repeatedly inspect random consecutive portions of a trace. This means that it will need to first move quickly to the beginning of each section and then start its iteration. Given that the number of instructions can be in the order of hundreds of millions, fast random access is necessary.
An example of such a tool could be an inspector of the call graph of a trace, where each call is represented with its start and end instructions. Inspecting all the instructions of a call requires moving to its first instruction and then iterating until the last instruction, which following the pattern explained above.
Instead of using 0-based indices as identifiers, each Trace plug-in can decide the nature of these identifiers and thus no assumptions can be made regarding their ordering and sequentiality. The reason is that an instruction might be encoded by the plug-in in a way that hides its actual 0-based index in the trace, but it's still possible to efficiently find it.
Requirements:
id
.Definition at line 49 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
bool SBTraceCursor::HasId | ( | lldb::user_id_t | id | ) | const |
id
. Definition at line 55 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
bool SBTraceCursor::HasValue | ( | ) | const |
Definition at line 43 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
bool SBTraceCursor::IsError | ( | ) | const |
Definition at line 79 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
bool SBTraceCursor::IsEvent | ( | ) | const |
Definition at line 91 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
bool SBTraceCursor::IsForwards | ( | ) | const |
Check if the direction to use in the SBTraceCursor::Next() method is forwards.
Definition at line 31 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
bool SBTraceCursor::IsInstruction | ( | ) | const |
Definition at line 109 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
bool SBTraceCursor::IsValid | ( | ) | const |
Definition at line 127 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA.
void SBTraceCursor::Next | ( | ) |
Move the cursor to the next item (instruction or error).
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 SBTraceCursor::SetForwards().
Definition at line 37 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
|
explicit |
Definition at line 133 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA.
bool SBTraceCursor::Seek | ( | int64_t | offset, |
lldb::TraceCursorSeekType | origin | ||
) |
Make the cursor point to an item in the trace based on an origin point and an offset.
The resulting position of the trace is origin + offset
If this resulting position would be out of bounds, the trace then points to an invalid item, i.e. calling HasValue() returns false.
[in] | offset | How many items to move forwards (if positive) or backwards (if negative) from the given origin point. For example, if origin is End, then a negative offset would move backward in the trace, but a positive offset would move past the trace to an invalid item. |
[in] | origin | The reference point to use when moving the cursor. |
Definition at line 67 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
void SBTraceCursor::SetForwards | ( | bool | forwards | ) |
Set the direction to use in the SBTraceCursor::Next() method.
[in] | forwards | If true, then the traversal will be forwards, otherwise backwards. |
Definition at line 25 of file SBTraceCursor.cpp.
References LLDB_INSTRUMENT_VA, and m_opaque_sp.
|
friend |
Definition at line 168 of file SBTraceCursor.h.
|
protected |
Definition at line 174 of file SBTraceCursor.h.
Referenced by GetCPU(), GetError(), GetEventType(), GetEventTypeAsString(), GetId(), GetItemKind(), GetLoadAddress(), GoToId(), HasId(), HasValue(), IsError(), IsEvent(), IsForwards(), IsInstruction(), Next(), Seek(), and SetForwards().