LLDB  mainline
Classes | Functions
TraceInstructionDumper.cpp File Reference
#include "lldb/Target/TraceInstructionDumper.h"
#include "lldb/Core/Module.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 TraceInstructionDumper.cpp:

Go to the source code of this file.

Classes

struct  InstructionSymbolInfo
 Helper struct that holds symbol, disassembly and address information of an instruction. More...
 

Functions

static int GetNumberOfChars (int num)
 
static bool IsLineEntryValid (const LineEntry &line_entry)
 
static bool FileLineAndColumnMatches (const LineEntry &a, const LineEntry &b)
 
static bool IsSameInstructionSymbolContext (const InstructionSymbolInfo &prev_insn, const InstructionSymbolInfo &insn)
 Compare the symbol contexts of the provided InstructionSymbolInfo objects. More...
 
static void DumpInstructionSymbolContext (Stream &s, Optional< InstructionSymbolInfo > prev_insn, InstructionSymbolInfo &insn)
 Dump the symbol context of the given instruction address if it's different from the symbol context of the previous instruction in the trace. More...
 
static void DumpInstructionDisassembly (Stream &s, InstructionSymbolInfo &insn)
 

Function Documentation

◆ DumpInstructionDisassembly()

static void DumpInstructionDisassembly ( Stream s,
InstructionSymbolInfo insn 
)
static

◆ DumpInstructionSymbolContext()

static void DumpInstructionSymbolContext ( Stream s,
Optional< InstructionSymbolInfo prev_insn,
InstructionSymbolInfo insn 
)
static

Dump the symbol context of the given instruction address if it's different from the symbol context of the previous instruction in the trace.

Parameters
[in]prev_scThe symbol context of the previous instruction in the trace.
[in]addressThe address whose symbol information will be dumped.
Returns
The symbol context of the current address, which might differ from the previous one.

Definition at line 125 of file TraceInstructionDumper.cpp.

References InstructionSymbolInfo::address, lldb_private::SymbolContext::DumpStopContext(), InstructionSymbolInfo::exe_ctx, lldb_private::SymbolContext::function, lldb_private::ExecutionContext::GetTargetPtr(), IsSameInstructionSymbolContext(), lldb_private::SymbolContext::module_sp, lldb_private::Stream::Printf(), InstructionSymbolInfo::sc, and lldb_private::SymbolContext::symbol.

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

◆ 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 68 of file TraceInstructionDumper.cpp.

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

Referenced by IsSameInstructionSymbolContext().

◆ GetNumberOfChars()

static int GetNumberOfChars ( int  num)
static
Returns
The number of characters that would be needed to print the given integer.

Definition at line 41 of file TraceInstructionDumper.cpp.

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

◆ IsLineEntryValid()

static bool IsLineEntryValid ( const LineEntry line_entry)
static

◆ IsSameInstructionSymbolContext()

static bool IsSameInstructionSymbolContext ( const InstructionSymbolInfo prev_insn,
const InstructionSymbolInfo insn 
)
static

Compare the symbol contexts of the provided InstructionSymbolInfo objects.

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

Definition at line 87 of file TraceInstructionDumper.cpp.

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

Referenced by DumpInstructionSymbolContext().