LLDB  mainline
Classes | Functions
TraceDumper.cpp File Reference
#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 dependency graph for TraceDumper.cpp:

Go to the source code of this file.

Classes

class  OutputWriterCLI
 
class  OutputWriterJSON
 

Functions

static Optional< const char * > ToOptionalString (const char *s)
 
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)
 Compare the symbol contexts of the provided SymbolInfo objects. More...
 
static std::unique_ptr< TraceDumper::OutputWriterCreateWriter (Stream &s, const TraceDumperOptions &options, Thread &thread)
 
static SymbolContext CalculateSymbolContext (const Address &address, const TraceDumper::SymbolInfo &prev_symbol_info)
 Find the symbol context for the given address reusing the previous instruction's symbol context when possible. More...
 
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. More...
 

Function Documentation

◆ CalculateDisass()

static std::tuple<DisassemblerSP, InstructionSP> CalculateDisass ( const TraceDumper::SymbolInfo symbol_info,
const TraceDumper::SymbolInfo prev_symbol_info,
const ExecutionContext exe_ctx 
)
static

◆ CalculateSymbolContext()

static SymbolContext CalculateSymbolContext ( const Address address,
const TraceDumper::SymbolInfo prev_symbol_info 
)
static

Find the symbol context for the given address reusing the previous instruction's symbol context when possible.

Definition at line 300 of file TraceDumper.cpp.

References lldb_private::Address::CalculateSymbolContext(), lldb_private::AddressRange::Contains(), lldb_private::SymbolContext::GetAddressRange(), and lldb_private::TraceDumper::SymbolInfo::sc.

Referenced by lldb_private::TraceDumper::DumpInstructions().

◆ CreateWriter()

static std::unique_ptr<TraceDumper::OutputWriter> CreateWriter ( Stream s,
const TraceDumperOptions options,
Thread thread 
)
static

Definition at line 259 of file TraceDumper.cpp.

References lldb_private::TraceDumperOptions::json.

◆ FileLineAndColumnMatches()

static bool FileLineAndColumnMatches ( const LineEntry a,
const LineEntry b 
)
static
Returns
true if the provided line entries match line, column and source file. This function assumes that the line entries are valid.

Definition at line 50 of file TraceDumper.cpp.

References lldb_private::LineEntry::column, lldb_private::LineEntry::file, and lldb_private::LineEntry::line.

Referenced by IsSameInstructionSymbolContext().

◆ GetModuleName()

static const char* GetModuleName ( const TraceDumper::TraceItem item)
static
Returns
The module name (basename if the module is a file, or the actual name if it's a virtual module), or nullptr if no name nor module was found.

Definition at line 32 of file TraceDumper.cpp.

References lldb_private::TraceDumper::TraceItem::symbol_info.

Referenced by OutputWriterJSON::DumpInstruction(), and OutputWriterCLI::TraceItem().

◆ IsLineEntryValid()

static bool IsLineEntryValid ( const LineEntry line_entry)
static

◆ IsSameInstructionSymbolContext()

static bool IsSameInstructionSymbolContext ( const TraceDumper::SymbolInfo prev_insn,
const TraceDumper::SymbolInfo insn 
)
static

Compare the symbol contexts of the provided SymbolInfo objects.

Returns
true if both instructions belong to the same scope level analized in the following order:
  • module
  • symbol
  • function
  • line

Definition at line 69 of file TraceDumper.cpp.

References FileLineAndColumnMatches(), lldb_private::SymbolContext::function, IsLineEntryValid(), lldb_private::SymbolContext::line_entry, lldb_private::SymbolContext::module_sp, lldb_private::TraceDumper::SymbolInfo::sc, and lldb_private::SymbolContext::symbol.

Referenced by OutputWriterCLI::TraceItem().

◆ ToOptionalString()

static Optional<const char *> ToOptionalString ( const char *  s)
static
Returns
The given string or None if it's empty.

Definition at line 24 of file TraceDumper.cpp.

Referenced by OutputWriterJSON::DumpInstruction().