Go to the documentation of this file.
13 #ifndef LLDB_TARGET_TRACE_INSTRUCTION_DUMPER_H
14 #define LLDB_TARGET_TRACE_INSTRUCTION_DUMPER_H
42 std::optional<uint64_t>
id;
45 std::optional<size_t>
skip;
69 std::optional<llvm::StringRef>
error;
70 std::optional<lldb::TraceEvent>
event;
73 std::optional<lldb::cpu_id_t>
cpu_id;
255 void AppendInsn(
const lldb::TraceCursorSP &cursor_sp,
353 const std::optional<UntracedPrefixSegment> &
433 #endif // LLDB_TARGET_TRACE_INSTRUCTION_DUMPER_H
const SymbolInfo & GetLastInstructionSymbolInfo() const
std::optional< size_t > skip
Optional number of instructions to skip from the starting position of the cursor.
std::unique_ptr< OutputWriter > m_writer_up
FunctionCall & CreateNestedCall(const lldb::TraceCursorSP &cursor_sp, const SymbolInfo &symbol_info)
Create a nested call at the end of this segment.
virtual void FunctionCallForest(const std::vector< FunctionCallUP > &forest)=0
Dump a function call forest.
void SetUntracedPrefixSegment(FunctionCallUP &&nested_call)
Create an untraced segment for this call that jumps to the provided nested call.
bool raw
Dump only instruction addresses without disassembly nor symbol information.
Helper struct that holds symbol, disassembly and address information of an instruction.
void AppendSegment(const lldb::TraceCursorSP &cursor_sp, const SymbolInfo &symbol_info)
Append a new traced segment to this funciton call.
const SymbolInfo & GetSymbolInfo() const
lldb::user_id_t m_last_insn_id
std::optional< llvm::StringRef > error
lldb_private::ExecutionContext exe_ctx
bool forwards
If true, the cursor will be iterated forwards starting from the oldest instruction.
std::deque< TracedSegment > m_traced_segments
The traced segments in order.
TraceDumperOptions m_options
virtual void TraceItem(const TraceItem &item)=0
Dump a trace item (instruction, error or event).
FunctionCall(const lldb::TraceCursorSP &cursor_sp, const SymbolInfo &symbol_info)
Create a new function call given an instruction.
lldb::user_id_t GetFirstInstructionID() const
bool show_control_flow_kind
For each instruction, print the instruction kind.
const std::deque< TracedSegment > & GetTracedSegments() const
std::optional< lldb::cpu_id_t > cpu_id
std::optional< uint64_t > id
Optional custom id to start traversing from.
const FunctionCall & GetOwningCall() const
const SymbolInfo & GetFirstInstructionSymbolInfo() const
TracedSegment(const lldb::TraceCursorSP &cursor_sp, const SymbolInfo &symbol_info, FunctionCall &owning_call)
Class used to dump the instructions of a TraceCursor using its current state and granularity.
TracedSegment & operator=(TracedSegment const &)
TracedSegment & GetLastTracedSegment()
lldb::TraceCursorSP m_cursor_sp
std::unique_ptr< FunctionCall > FunctionCallUP
SymbolInfo m_last_symbol_info
std::optional< std::string > sync_point_metadata
Interface used to abstract away the format in which the instruction information will be dumped.
FunctionCallUP m_nested_call
void AppendInsn(const lldb::TraceCursorSP &cursor_sp, const SymbolInfo &symbol_info)
Append a new instruction to this segment.
std::optional< uint64_t > hw_clock
FunctionCall * m_parent_call
The parent call, which might be null.
const FunctionCall & GetNestedCall() const
bool only_events
Dump events and none of the instructions.
lldb::user_id_t GetLastInstructionID() const
std::optional< SymbolInfo > symbol_info
bool json
Dump in json format.
const std::optional< UntracedPrefixSegment > & GetUntracedPrefixSegment() const
lldb::DisassemblerSP disassembler
std::optional< SymbolInfo > prev_symbol_info
void IfNestedCall(std::function< void(const FunctionCall &function_call)> callback) const
Executed the given callback if there's a nested call at the end of this segment.
void SetParentCall(FunctionCall &parent_call)
Helper struct that holds all the information we know about a trace item.
bool pretty_print_json
When dumping in JSON format, pretty print the output.
void DumpFunctionCalls()
Dump all function calls forwards chronologically and hierarchically.
lldb::InstructionSP instruction
FunctionCall & m_owning_call
TraceItem CreatRawTraceItem()
Create a trace item for the current position without symbol information.
Class that holds the configuration used by TraceDumper for traversing and dumping instructions.
std::optional< lldb::TraceEvent > event
std::optional< UntracedPrefixSegment > m_untraced_prefix_segment
An optional untraced segment that precedes all the traced segments.
bool show_events
Dump the events that happened between instructions.
FunctionCall * GetParentCall() const
bool show_timestamps
For each trace item, print the corresponding timestamp in nanoseconds if available.
SymbolInfo m_first_symbol_info
The symbol information of the delimiting instructions.
UntracedPrefixSegment(FunctionCallUP &&nested_call)
Note: Untraced segments can only exist if have also seen a traced segment of the same function call.
A class that represents a running process on the host machine.
virtual void NoMoreData()
Notify this writer that the cursor ran out of data.
std::optional< lldb::user_id_t > DumpInstructions(size_t count)
Dump count instructions of the thread trace starting at the current cursor position.
lldb::user_id_t m_first_insn_id
Delimiting instruction IDs taken chronologically.
UntracedPrefixSegment & operator=(UntracedPrefixSegment const &)
virtual ~OutputWriter()=default
lldb::addr_t load_address
std::optional< double > timestamp
TraceDumper(lldb::TraceCursorSP cursor_sp, Stream &s, const TraceDumperOptions &options)
Create a instruction dumper for the cursor.
bool m_is_error
Whether this call represents a list of consecutive errors.
FunctionCallUP m_nested_call
An optional nested call starting at the end of this segment.