LLDB mainline
|
#include "lldb/Target/TraceDumper.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
#include <optional>
Go to the source code of this file.
Classes | |
class | OutputWriterCLI |
class | OutputWriterJSON |
Functions | |
static std::optional< const char * > | ToOptionalString (const char *s) |
static const char * | GetModuleName (const SymbolContext &sc) |
static const char * | GetModuleName (const TraceDumper::TraceItem &item) |
static bool | IsLineEntryValid (const LineEntry &line_entry) |
static bool | FileLineAndColumnMatches (const LineEntry &a, const LineEntry &b) |
static bool | IsSameInstructionSymbolContext (const TraceDumper::SymbolInfo &prev_insn, const TraceDumper::SymbolInfo &insn, bool check_source_line_info=true) |
Compare the symbol contexts of the provided SymbolInfo objects. | |
static std::unique_ptr< TraceDumper::OutputWriter > | CreateWriter (Stream &s, const TraceDumperOptions &options, Thread &thread) |
static SymbolContext | CalculateSymbolContext (const Address &address, const SymbolContext &prev_symbol_context) |
Find the symbol context for the given address reusing the previous instruction's symbol context when possible. | |
static std::tuple< DisassemblerSP, InstructionSP > | CalculateDisass (const TraceDumper::SymbolInfo &symbol_info, const TraceDumper::SymbolInfo &prev_symbol_info, const ExecutionContext &exe_ctx) |
Find the disassembler for the given address reusing the previous instruction's disassembler when possible. | |
static TraceDumper::SymbolInfo | CalculateSymbolInfo (const ExecutionContext &exe_ctx, lldb::addr_t load_address, const TraceDumper::SymbolInfo &prev_symbol_info) |
static TraceDumper::FunctionCall & | AppendReturnedInstructionToFunctionCallForest (TraceDumper::FunctionCall &last_function_call, const TraceDumper::SymbolInfo &symbol_info, const TraceCursorSP &cursor_sp, std::vector< TraceDumper::FunctionCallUP > &roots) |
Given an instruction that happens after a return, find the ancestor function call that owns it. | |
static TraceDumper::FunctionCall & | AppendInstructionToFunctionCallForest (const ExecutionContext &exe_ctx, TraceDumper::FunctionCall *last_function_call, const TraceDumper::SymbolInfo &prev_symbol_info, const TraceDumper::SymbolInfo &symbol_info, const TraceCursorSP &cursor_sp, std::vector< TraceDumper::FunctionCallUP > &roots) |
Append an instruction to a function call forest. | |
TraceDumper::FunctionCall & | AppendErrorToFunctionCallForest (TraceDumper::FunctionCall *last_function_call, TraceCursorSP &cursor_sp, std::vector< TraceDumper::FunctionCallUP > &roots) |
Append an error to a function call forest. | |
static std::vector< TraceDumper::FunctionCallUP > | CreateFunctionCallForest (TraceCursorSP &cursor_sp, const ExecutionContext &exe_ctx) |
TraceDumper::FunctionCall & AppendErrorToFunctionCallForest | ( | TraceDumper::FunctionCall * | last_function_call, |
TraceCursorSP & | cursor_sp, | ||
std::vector< TraceDumper::FunctionCallUP > & | roots | ||
) |
Append an error to a function call forest.
The new error might be appended to the current segment if it contains errors or will create a new root.
[in] | last_function_call | The chronologically most recent function call before the new error. |
[in] | cursor_sp | The cursor pointing to the new error. |
[in,out] | roots | The object owning the roots. It might be modified if a new root needs to be created. |
Definition at line 859 of file TraceDumper.cpp.
References lldb_private::TraceDumper::FunctionCall::TracedSegment::AppendInsn(), lldb_private::TraceDumper::FunctionCall::GetLastTracedSegment(), and lldb_private::TraceDumper::FunctionCall::IsError().
Referenced by CreateFunctionCallForest().
|
static |
Append an instruction to a function call forest.
The new instruction might be appended to the current segment, to a new nest call, or return to an ancestor call.
[in] | exe_ctx | The exeuction context of the traced thread. |
[in] | last_function_call | The chronologically most recent function call before the new instruction. |
[in] | prev_symbol_info | The symbol information of the previous instruction in the trace. |
[in] | symbol_info | The symbol information of the new instruction. |
[in] | cursor_sp | The cursor pointing to the new instruction. |
[in,out] | roots | The object owning the roots. It might be modified if a new root needs to be created. |
Definition at line 769 of file TraceDumper.cpp.
References lldb_private::TraceDumper::SymbolInfo::address, lldb_private::TraceDumper::FunctionCall::TracedSegment::AppendInsn(), AppendReturnedInstructionToFunctionCallForest(), lldb_private::SymbolContext::block, lldb_private::TraceDumper::FunctionCall::TracedSegment::CreateNestedCall(), lldb::eInstructionControlFlowKindCall, lldb::eInstructionControlFlowKindFarCall, lldb::eInstructionControlFlowKindFarReturn, lldb::eInstructionControlFlowKindOther, lldb::eInstructionControlFlowKindReturn, lldb_private::SymbolContext::GetAddressRange(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::Block::GetContainingInlinedBlock(), lldb_private::TraceDumper::FunctionCall::TracedSegment::GetLastInstructionSymbolInfo(), lldb_private::TraceDumper::FunctionCall::GetLastTracedSegment(), lldb_private::TraceDumper::SymbolInfo::instruction, lldb_private::TraceDumper::FunctionCall::IsError(), IsSameInstructionSymbolContext(), and lldb_private::TraceDumper::SymbolInfo::sc.
Referenced by CreateFunctionCallForest().
|
static |
Given an instruction that happens after a return, find the ancestor function call that owns it.
If this ancestor doesn't exist, create a new ancestor and make it the root of the tree.
[in] | last_function_call | The function call that performs the return. |
[in] | symbol_info | The symbol information of the instruction after the return. |
[in] | cursor_sp | The cursor pointing to the instruction after the return. |
[in,out] | roots | The object owning the roots. It might be modified if a new root needs to be created. |
Definition at line 711 of file TraceDumper.cpp.
References lldb_private::TraceDumper::FunctionCall::AppendSegment(), lldb_private::TraceDumper::FunctionCall::GetParentCall(), lldb_private::TraceDumper::FunctionCall::GetSymbolInfo(), and IsSameInstructionSymbolContext().
Referenced by AppendInstructionToFunctionCallForest().
|
static |
Find the disassembler for the given address reusing the previous instruction's disassembler when possible.
Definition at line 489 of file TraceDumper.cpp.
References lldb_private::TraceDumper::SymbolInfo::address, lldb_private::TraceDumper::SymbolInfo::disassembler, lldb_private::Disassembler::DisassembleRange(), lldb_private::SymbolContext::function, lldb_private::Target::GetArchitecture(), lldb_private::Function::GetInstructions(), lldb_private::ArchSpec::GetMaximumOpcodeByteSize(), lldb_private::ExecutionContext::GetTargetRef(), and lldb_private::TraceDumper::SymbolInfo::sc.
Referenced by CalculateSymbolInfo().
|
static |
Find the symbol context for the given address reusing the previous instruction's symbol context when possible.
Definition at line 473 of file TraceDumper.cpp.
References lldb_private::Address::CalculateSymbolContext(), lldb_private::AddressRange::Contains(), and lldb_private::SymbolContext::GetAddressRange().
Referenced by CalculateSymbolInfo().
|
static |
Definition at line 524 of file TraceDumper.cpp.
References lldb_private::TraceDumper::SymbolInfo::address, CalculateDisass(), CalculateSymbolContext(), lldb_private::TraceDumper::SymbolInfo::disassembler, lldb_private::TraceDumper::SymbolInfo::exe_ctx, lldb_private::ExecutionContext::GetTargetPtr(), lldb_private::TraceDumper::SymbolInfo::instruction, lldb_private::TraceDumper::SymbolInfo::sc, and lldb_private::Address::SetLoadAddress().
Referenced by CreateFunctionCallForest(), and lldb_private::TraceDumper::DumpInstructions().
|
static |
Definition at line 874 of file TraceDumper.cpp.
References AppendErrorToFunctionCallForest(), AppendInstructionToFunctionCallForest(), CalculateSymbolInfo(), and lldb::eTraceEventCPUChanged.
Referenced by lldb_private::TraceDumper::DumpFunctionCalls().
|
static |
Definition at line 432 of file TraceDumper.cpp.
References lldb_private::TraceDumperOptions::json.
Definition at line 55 of file TraceDumper.cpp.
References lldb_private::LineEntry::column, lldb_private::LineEntry::GetFile(), and lldb_private::LineEntry::line.
Referenced by IsSameInstructionSymbolContext().
|
static |
Definition at line 30 of file TraceDumper.cpp.
References lldb_private::SymbolContext::module_sp.
Referenced by OutputWriterJSON::DumpInstruction(), OutputWriterCLI::DumpUntracedContext(), GetModuleName(), and OutputWriterCLI::TraceItem().
|
static |
Definition at line 39 of file TraceDumper.cpp.
References GetModuleName(), and lldb_private::TraceDumper::TraceItem::symbol_info.
|
static |
Definition at line 48 of file TraceDumper.cpp.
References lldb_private::LineEntry::IsValid(), and lldb_private::LineEntry::line.
Referenced by OutputWriterJSON::DumpInstruction(), OutputWriterCLI::DumpSegmentContext(), and IsSameInstructionSymbolContext().
|
static |
Compare the symbol contexts of the provided SymbolInfo objects.
Definition at line 75 of file TraceDumper.cpp.
References lldb_private::SymbolContext::block, FileLineAndColumnMatches(), lldb_private::SymbolContext::function, lldb_private::Block::GetContainingInlinedBlock(), IsLineEntryValid(), lldb_private::SymbolContext::line_entry, lldb_private::SymbolContext::module_sp, lldb_private::TraceDumper::SymbolInfo::sc, and lldb_private::SymbolContext::symbol.
Referenced by AppendInstructionToFunctionCallForest(), AppendReturnedInstructionToFunctionCallForest(), and OutputWriterCLI::TraceItem().
|
static |
Definition at line 24 of file TraceDumper.cpp.
Referenced by OutputWriterJSON::DumpInstruction().