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