#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>
usingnamespacelldb;
usingnamespacelldb_private;
usingnamespacellvm;
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) { … }
class OutputWriterCLI : public TraceDumper::OutputWriter { … };
class OutputWriterJSON : public TraceDumper::OutputWriter { … };
static std::unique_ptr<TraceDumper::OutputWriter>
CreateWriter(Stream &s, const TraceDumperOptions &options, Thread &thread) { … }
TraceDumper::TraceDumper(lldb::TraceCursorSP cursor_sp, Stream &s,
const TraceDumperOptions &options)
: … { … }
TraceDumper::TraceItem TraceDumper::CreatRawTraceItem() { … }
static SymbolContext
CalculateSymbolContext(const Address &address,
const SymbolContext &prev_symbol_context) { … }
static std::tuple<DisassemblerSP, InstructionSP>
CalculateDisass(const TraceDumper::SymbolInfo &symbol_info,
const TraceDumper::SymbolInfo &prev_symbol_info,
const ExecutionContext &exe_ctx) { … }
static TraceDumper::SymbolInfo
CalculateSymbolInfo(const ExecutionContext &exe_ctx, lldb::addr_t load_address,
const TraceDumper::SymbolInfo &prev_symbol_info) { … }
std::optional<lldb::user_id_t> TraceDumper::DumpInstructions(size_t count) { … }
void TraceDumper::FunctionCall::TracedSegment::AppendInsn(
const TraceCursorSP &cursor_sp,
const TraceDumper::SymbolInfo &symbol_info) { … }
lldb::user_id_t
TraceDumper::FunctionCall::TracedSegment::GetFirstInstructionID() const { … }
lldb::user_id_t
TraceDumper::FunctionCall::TracedSegment::GetLastInstructionID() const { … }
void TraceDumper::FunctionCall::TracedSegment::IfNestedCall(
std::function<void(const FunctionCall &function_call)> callback) const { … }
const TraceDumper::FunctionCall &
TraceDumper::FunctionCall::TracedSegment::GetOwningCall() const { … }
TraceDumper::FunctionCall &
TraceDumper::FunctionCall::TracedSegment::CreateNestedCall(
const TraceCursorSP &cursor_sp,
const TraceDumper::SymbolInfo &symbol_info) { … }
const TraceDumper::SymbolInfo &
TraceDumper::FunctionCall::TracedSegment::GetFirstInstructionSymbolInfo()
const { … }
const TraceDumper::SymbolInfo &
TraceDumper::FunctionCall::TracedSegment::GetLastInstructionSymbolInfo() const { … }
const TraceDumper::FunctionCall &
TraceDumper::FunctionCall::UntracedPrefixSegment::GetNestedCall() const { … }
TraceDumper::FunctionCall::FunctionCall(
const TraceCursorSP &cursor_sp,
const TraceDumper::SymbolInfo &symbol_info) { … }
void TraceDumper::FunctionCall::AppendSegment(
const TraceCursorSP &cursor_sp,
const TraceDumper::SymbolInfo &symbol_info) { … }
const TraceDumper::SymbolInfo &
TraceDumper::FunctionCall::GetSymbolInfo() const { … }
bool TraceDumper::FunctionCall::IsError() const { … }
const std::deque<TraceDumper::FunctionCall::TracedSegment> &
TraceDumper::FunctionCall::GetTracedSegments() const { … }
TraceDumper::FunctionCall::TracedSegment &
TraceDumper::FunctionCall::GetLastTracedSegment() { … }
const std::optional<TraceDumper::FunctionCall::UntracedPrefixSegment> &
TraceDumper::FunctionCall::GetUntracedPrefixSegment() const { … }
void TraceDumper::FunctionCall::SetUntracedPrefixSegment(
TraceDumper::FunctionCallUP &&nested_call) { … }
TraceDumper::FunctionCall *TraceDumper::FunctionCall::GetParentCall() const { … }
void TraceDumper::FunctionCall::SetParentCall(
TraceDumper::FunctionCall &parent_call) { … }
static TraceDumper::FunctionCall &AppendReturnedInstructionToFunctionCallForest(
TraceDumper::FunctionCall &last_function_call,
const TraceDumper::SymbolInfo &symbol_info, const TraceCursorSP &cursor_sp,
std::vector<TraceDumper::FunctionCallUP> &roots) { … }
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) { … }
TraceDumper::FunctionCall &AppendErrorToFunctionCallForest(
TraceDumper::FunctionCall *last_function_call, TraceCursorSP &cursor_sp,
std::vector<TraceDumper::FunctionCallUP> &roots) { … }
static std::vector<TraceDumper::FunctionCallUP>
CreateFunctionCallForest(TraceCursorSP &cursor_sp,
const ExecutionContext &exe_ctx) { … }
void TraceDumper::DumpFunctionCalls() { … }