mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-13 22:00:14 +00:00
Change the default disassembly format again. First attempt at
changing it was in r219544 - after living on that for a few months, I wanted to take another crack at this. The disassembly-format setting still exists and the old format can be user specified with a setting like ${current-pc-arrow}${addr-file-or-load}{ <${function.name-without-args}${function.concrete-only-addr-offset-no-padding}>}: This patch was discussed in http://reviews.llvm.org/D7578 <rdar://problem/19726421> llvm-svn: 229186
This commit is contained in:
parent
eff99e8ac5
commit
c980fa92eb
@ -88,6 +88,8 @@ public:
|
||||
///< if the address is in a section (section of pointers, c strings, etc).
|
||||
DumpStyleResolvedDescriptionNoModule,
|
||||
DumpStyleResolvedDescriptionNoFunctionArguments,
|
||||
DumpStyleNoFunctionName, ///< Elide the function name; display an offset into the current function.
|
||||
///< Used primarily in disassembly symbolication
|
||||
DumpStyleDetailedSymbolContext, ///< Detailed symbol context information for an address for all symbol
|
||||
///< context members.
|
||||
DumpStyleResolvedPointerDescription ///< Dereference a pointer at the current address and then lookup the
|
||||
|
@ -120,6 +120,12 @@ public:
|
||||
/// @param[in] disassembly_addr_format
|
||||
/// The format specification for how addresses are printed.
|
||||
/// Only needed if show_address is true.
|
||||
///
|
||||
/// @param[in] max_address_text_size
|
||||
/// The length of the longest address string at the start of the
|
||||
/// disassembly line that will be printed (the Debugger::FormatDisassemblerAddress() string)
|
||||
/// so this method can properly align the instruction opcodes.
|
||||
/// May be 0 to indicate no indentation/alignment of the opcodes.
|
||||
//------------------------------------------------------------------
|
||||
|
||||
virtual void
|
||||
@ -130,7 +136,8 @@ public:
|
||||
const ExecutionContext* exe_ctx,
|
||||
const SymbolContext *sym_ctx,
|
||||
const SymbolContext *prev_sym_ctx,
|
||||
const FormatEntity::Entry *disassembly_addr_format);
|
||||
const FormatEntity::Entry *disassembly_addr_format,
|
||||
size_t max_address_text_size);
|
||||
|
||||
virtual bool
|
||||
DoesBranch () = 0;
|
||||
|
@ -78,6 +78,8 @@ namespace lldb_private
|
||||
FunctionAddrOffsetConcrete,
|
||||
FunctionLineOffset,
|
||||
FunctionPCOffset,
|
||||
FunctionInitial,
|
||||
FunctionChanged,
|
||||
LineEntryFile,
|
||||
LineEntryLineNumber,
|
||||
LineEntryStartAddress,
|
||||
|
@ -161,6 +161,32 @@ public:
|
||||
///
|
||||
/// @param[in] so_addr
|
||||
/// The resolved section offset address.
|
||||
///
|
||||
/// @param[in] show_fullpaths
|
||||
/// When printing file paths (with the Module), whether the
|
||||
/// base name of the Module should be printed or the full path.
|
||||
///
|
||||
/// @param[in] show_module
|
||||
/// Whether the module name should be printed followed by a
|
||||
/// grave accent "`" character.
|
||||
///
|
||||
/// @param[in] show_inlined_frames
|
||||
/// If a given pc is in inlined function(s), whether the inlined
|
||||
/// functions should be printed on separate lines in addition to
|
||||
/// the concrete function containing the pc.
|
||||
///
|
||||
/// @param[in] show_function_arguments
|
||||
/// If false, this method will try to elide the function argument
|
||||
/// types when printing the function name. This may be ambiguous
|
||||
/// for languages that have function overloading - but it may
|
||||
/// make the "function name" too long to include all the argument
|
||||
/// types.
|
||||
///
|
||||
/// @param[in] show_function_name
|
||||
/// Normally this should be true - the function/symbol name should
|
||||
/// be printed. In disassembly formatting, where we want a format
|
||||
/// like "<*+36>", this should be false and "*" will be printed
|
||||
/// instead.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
DumpStopContext (Stream *s,
|
||||
@ -169,7 +195,8 @@ public:
|
||||
bool show_fullpaths,
|
||||
bool show_module,
|
||||
bool show_inlined_frames,
|
||||
bool show_function_arguments) const;
|
||||
bool show_function_arguments,
|
||||
bool show_function_name) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the address range contained within a symbol context.
|
||||
|
@ -180,7 +180,7 @@ SBInstruction::GetDescription (lldb::SBStream &s)
|
||||
// didn't have a stream already created, one will get created...
|
||||
FormatEntity::Entry format;
|
||||
FormatEntity::Parse("${addr}: ", format);
|
||||
m_opaque_sp->Dump (&s.ref(), 0, true, false, NULL, &sc, NULL, &format);
|
||||
m_opaque_sp->Dump (&s.ref(), 0, true, false, NULL, &sc, NULL, &format, 0);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -202,7 +202,7 @@ SBInstruction::Print (FILE *out)
|
||||
StreamFile out_stream (out, false);
|
||||
FormatEntity::Entry format;
|
||||
FormatEntity::Parse("${addr}: ", format);
|
||||
m_opaque_sp->Dump (&out_stream, 0, true, false, NULL, &sc, NULL, &format);
|
||||
m_opaque_sp->Dump (&out_stream, 0, true, false, NULL, &sc, NULL, &format, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ SBInstructionList::GetDescription (lldb::SBStream &description)
|
||||
module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
|
||||
}
|
||||
|
||||
inst->Dump (&sref, max_opcode_byte_size, true, false, NULL, &sc, &prev_sc, &format);
|
||||
inst->Dump (&sref, max_opcode_byte_size, true, false, NULL, &sc, &prev_sc, &format, 0);
|
||||
sref.EOL();
|
||||
}
|
||||
return true;
|
||||
|
@ -590,7 +590,7 @@ BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
|
||||
s->PutCString ("re-exported target = ");
|
||||
else
|
||||
s->PutCString("where = ");
|
||||
sc.DumpStopContext (s, m_owner.GetTarget().GetProcessSP().get(), m_address, false, true, false, true);
|
||||
sc.DumpStopContext (s, m_owner.GetTarget().GetProcessSP().get(), m_address, false, true, false, true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -690,13 +690,15 @@ protected:
|
||||
bool show_module = true;
|
||||
bool show_inlined_frames = true;
|
||||
const bool show_function_arguments = true;
|
||||
const bool show_function_name = true;
|
||||
sc.DumpStopContext(&result.GetOutputStream(),
|
||||
m_exe_ctx.GetBestExecutionContextScope(),
|
||||
sc.line_entry.range.GetBaseAddress(),
|
||||
show_fullpaths,
|
||||
show_module,
|
||||
show_inlined_frames,
|
||||
show_function_arguments);
|
||||
show_function_arguments,
|
||||
show_function_name);
|
||||
result.GetOutputStream().EOL();
|
||||
|
||||
if (m_options.num_lines == 0)
|
||||
|
@ -468,6 +468,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
|
||||
case DumpStyleResolvedDescription:
|
||||
case DumpStyleResolvedDescriptionNoModule:
|
||||
case DumpStyleResolvedDescriptionNoFunctionArguments:
|
||||
case DumpStyleNoFunctionName:
|
||||
if (IsSectionOffset())
|
||||
{
|
||||
uint32_t pointer_size = 4;
|
||||
@ -553,7 +554,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
|
||||
#endif
|
||||
Address cstr_addr(*this);
|
||||
cstr_addr.SetOffset(cstr_addr.GetOffset() + pointer_size);
|
||||
func_sc.DumpStopContext(s, exe_scope, so_addr, true, true, false, true);
|
||||
func_sc.DumpStopContext(s, exe_scope, so_addr, true, true, false, true, true);
|
||||
if (ReadAddress (exe_scope, cstr_addr, pointer_size, so_addr))
|
||||
{
|
||||
#if VERBOSE_OUTPUT
|
||||
@ -636,7 +637,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
|
||||
if (pointer_sc.function || pointer_sc.symbol)
|
||||
{
|
||||
s->PutCString(": ");
|
||||
pointer_sc.DumpStopContext(s, exe_scope, so_addr, true, false, false, true);
|
||||
pointer_sc.DumpStopContext(s, exe_scope, so_addr, true, false, false, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -662,6 +663,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
|
||||
const bool show_fullpaths = false;
|
||||
const bool show_inlined_frames = true;
|
||||
const bool show_function_arguments = (style != DumpStyleResolvedDescriptionNoFunctionArguments);
|
||||
const bool show_function_name = (style != DumpStyleNoFunctionName);
|
||||
if (sc.function == NULL && sc.symbol != NULL)
|
||||
{
|
||||
// If we have just a symbol make sure it is in the right section
|
||||
@ -684,7 +686,8 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
|
||||
show_fullpaths,
|
||||
show_module,
|
||||
show_inlined_frames,
|
||||
show_function_arguments);
|
||||
show_function_arguments,
|
||||
show_function_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -126,7 +126,21 @@ g_language_enumerators[] =
|
||||
FILE_AND_LINE\
|
||||
"\\n"
|
||||
|
||||
#define DEFAULT_DISASSEMBLY_FORMAT "${current-pc-arrow}${addr-file-or-load}{ <${function.name-without-args}${function.concrete-only-addr-offset-no-padding}>}: "
|
||||
// Three parts to this disassembly format specification:
|
||||
// 1. If this is a new function/symbol (no previous symbol/function), print
|
||||
// dylib`funcname:\n
|
||||
// 2. If this is a symbol context change (different from previous symbol/function), print
|
||||
// dylib`funcname:\n
|
||||
// 3. print
|
||||
// address <+offset>:
|
||||
#define DEFAULT_DISASSEMBLY_FORMAT "{${function.initial-function}{${module.file.basename}`}{${function.name-without-args}}:\n}{${function.changed}\n{${module.file.basename}`}{${function.name-without-args}}:\n}{${current-pc-arrow} }${addr-file-or-load}{ <${function.concrete-only-addr-offset-no-padding}>}: "
|
||||
|
||||
// gdb's disassembly format can be emulated with
|
||||
// ${current-pc-arrow}${addr-file-or-load}{ <${function.name-without-args}${function.concrete-only-addr-offset-no-padding}>}:
|
||||
|
||||
// lldb's original format for disassembly would look like this format string -
|
||||
// {${function.initial-function}{${module.file.basename}`}{${function.name-without-args}}:\n}{${function.changed}\n{${module.file.basename}`}{${function.name-without-args}}:\n}{${current-pc-arrow} }{${addr-file-or-load}}:
|
||||
|
||||
|
||||
static PropertyDefinition
|
||||
g_properties[] =
|
||||
|
@ -421,6 +421,47 @@ Disassembler::PrintInstructions
|
||||
}
|
||||
const uint32_t scope = eSymbolContextLineEntry | eSymbolContextFunction | eSymbolContextSymbol;
|
||||
const bool use_inline_block_range = false;
|
||||
|
||||
const FormatEntity::Entry *disassembly_format = NULL;
|
||||
FormatEntity::Entry format;
|
||||
if (exe_ctx.HasTargetScope())
|
||||
{
|
||||
disassembly_format = exe_ctx.GetTargetRef().GetDebugger().GetDisassemblyFormat ();
|
||||
}
|
||||
else
|
||||
{
|
||||
FormatEntity::Parse("${addr}: ", format);
|
||||
disassembly_format = &format;
|
||||
}
|
||||
|
||||
// First pass: step through the list of instructions,
|
||||
// find how long the initial addresses strings are, insert padding
|
||||
// in the second pass so the opcodes all line up nicely.
|
||||
size_t address_text_size = 0;
|
||||
for (size_t i = 0; i < num_instructions_found; ++i)
|
||||
{
|
||||
Instruction *inst = disasm_ptr->GetInstructionList().GetInstructionAtIndex (i).get();
|
||||
if (inst)
|
||||
{
|
||||
const Address &addr = inst->GetAddress();
|
||||
ModuleSP module_sp (addr.GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
const uint32_t resolve_mask = eSymbolContextFunction | eSymbolContextSymbol;
|
||||
uint32_t resolved_mask = module_sp->ResolveSymbolContextForAddress(addr, resolve_mask, sc);
|
||||
if (resolved_mask)
|
||||
{
|
||||
StreamString strmstr;
|
||||
Debugger::FormatDisassemblerAddress (disassembly_format, &sc, NULL, &exe_ctx, &addr, strmstr);
|
||||
size_t cur_line = strmstr.GetSizeOfLastLine();
|
||||
if (cur_line > address_text_size)
|
||||
address_text_size = cur_line;
|
||||
}
|
||||
sc.Clear(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < num_instructions_found; ++i)
|
||||
{
|
||||
Instruction *inst = disasm_ptr->GetInstructionList().GetInstructionAtIndex (i).get();
|
||||
@ -448,7 +489,7 @@ Disassembler::PrintInstructions
|
||||
if (offset != 0)
|
||||
strm.EOL();
|
||||
|
||||
sc.DumpStopContext(&strm, exe_ctx.GetProcessPtr(), addr, false, true, false, false);
|
||||
sc.DumpStopContext(&strm, exe_ctx.GetProcessPtr(), addr, false, true, false, false, true);
|
||||
strm.EOL();
|
||||
|
||||
if (sc.comp_unit && sc.line_entry.IsValid())
|
||||
@ -471,7 +512,7 @@ Disassembler::PrintInstructions
|
||||
}
|
||||
|
||||
const bool show_bytes = (options & eOptionShowBytes) != 0;
|
||||
inst->Dump (&strm, max_opcode_byte_size, true, show_bytes, &exe_ctx, &sc, &prev_sc, NULL);
|
||||
inst->Dump (&strm, max_opcode_byte_size, true, show_bytes, &exe_ctx, &sc, &prev_sc, NULL, address_text_size);
|
||||
strm.EOL();
|
||||
}
|
||||
else
|
||||
@ -561,7 +602,8 @@ Instruction::Dump (lldb_private::Stream *s,
|
||||
const ExecutionContext* exe_ctx,
|
||||
const SymbolContext *sym_ctx,
|
||||
const SymbolContext *prev_sym_ctx,
|
||||
const FormatEntity::Entry *disassembly_addr_format)
|
||||
const FormatEntity::Entry *disassembly_addr_format,
|
||||
size_t max_address_text_size)
|
||||
{
|
||||
size_t opcode_column_width = 7;
|
||||
const size_t operand_column_width = 25;
|
||||
@ -573,6 +615,7 @@ Instruction::Dump (lldb_private::Stream *s,
|
||||
if (show_address)
|
||||
{
|
||||
Debugger::FormatDisassemblerAddress (disassembly_addr_format, sym_ctx, prev_sym_ctx, exe_ctx, &m_address, ss);
|
||||
ss.FillLastLineToColumn (max_address_text_size, ' ');
|
||||
}
|
||||
|
||||
if (show_bytes)
|
||||
@ -999,7 +1042,7 @@ InstructionList::Dump (Stream *s,
|
||||
{
|
||||
if (pos != begin)
|
||||
s->EOL();
|
||||
(*pos)->Dump(s, max_opcode_byte_size, show_address, show_bytes, exe_ctx, NULL, NULL, disassembly_format);
|
||||
(*pos)->Dump(s, max_opcode_byte_size, show_address, show_bytes, exe_ctx, NULL, NULL, disassembly_format, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,9 @@ static FormatEntity::Entry::Definition g_function_child_entries[] =
|
||||
ENTRY ("addr-offset" , FunctionAddrOffset , UInt64),
|
||||
ENTRY ("concrete-only-addr-offset-no-padding", FunctionAddrOffsetConcrete, UInt64),
|
||||
ENTRY ("line-offset" , FunctionLineOffset , UInt64),
|
||||
ENTRY ("pc-offset" , FunctionPCOffset , UInt64)
|
||||
ENTRY ("pc-offset" , FunctionPCOffset , UInt64),
|
||||
ENTRY ("initial-function" , FunctionInitial , None),
|
||||
ENTRY ("changed" , FunctionChanged , None)
|
||||
};
|
||||
|
||||
static FormatEntity::Entry::Definition g_line_child_entries[] =
|
||||
@ -335,6 +337,8 @@ FormatEntity::Entry::TypeToCString (Type t)
|
||||
ENUM_TO_CSTR(FunctionAddrOffsetConcrete);
|
||||
ENUM_TO_CSTR(FunctionLineOffset);
|
||||
ENUM_TO_CSTR(FunctionPCOffset);
|
||||
ENUM_TO_CSTR(FunctionInitial);
|
||||
ENUM_TO_CSTR(FunctionChanged);
|
||||
ENUM_TO_CSTR(LineEntryFile);
|
||||
ENUM_TO_CSTR(LineEntryLineNumber);
|
||||
ENUM_TO_CSTR(LineEntryStartAddress);
|
||||
@ -444,7 +448,8 @@ DumpAddressOffsetFromFunction (Stream &s,
|
||||
const ExecutionContext *exe_ctx,
|
||||
const Address &format_addr,
|
||||
bool concrete_only,
|
||||
bool no_padding)
|
||||
bool no_padding,
|
||||
bool print_zero_offsets)
|
||||
{
|
||||
if (format_addr.IsValid())
|
||||
{
|
||||
@ -479,10 +484,15 @@ DumpAddressOffsetFromFunction (Stream &s,
|
||||
{
|
||||
addr_t func_file_addr = func_addr.GetFileAddress();
|
||||
addr_t addr_file_addr = format_addr.GetFileAddress();
|
||||
if (addr_file_addr > func_file_addr)
|
||||
if (addr_file_addr > func_file_addr
|
||||
|| (addr_file_addr == func_file_addr && print_zero_offsets))
|
||||
{
|
||||
s.Printf("%s+%s%" PRIu64, addr_offset_padding, addr_offset_padding, addr_file_addr - func_file_addr);
|
||||
}
|
||||
else if (addr_file_addr < func_file_addr)
|
||||
{
|
||||
s.Printf("%s-%s%" PRIu64, addr_offset_padding, addr_offset_padding, func_file_addr - addr_file_addr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -492,10 +502,15 @@ DumpAddressOffsetFromFunction (Stream &s,
|
||||
{
|
||||
addr_t func_load_addr = func_addr.GetLoadAddress (target);
|
||||
addr_t addr_load_addr = format_addr.GetLoadAddress (target);
|
||||
if (addr_load_addr > func_load_addr)
|
||||
if (addr_load_addr > func_load_addr
|
||||
|| (addr_load_addr == func_load_addr && print_zero_offsets))
|
||||
{
|
||||
s.Printf("%s+%s%" PRIu64, addr_offset_padding, addr_offset_padding, addr_load_addr - func_load_addr);
|
||||
}
|
||||
else if (addr_load_addr < func_load_addr)
|
||||
{
|
||||
s.Printf("%s-%s%" PRIu64, addr_offset_padding, addr_offset_padding, func_load_addr - addr_load_addr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -1803,7 +1818,7 @@ FormatEntity::Format (const Entry &entry,
|
||||
case Entry::Type::FunctionAddrOffset:
|
||||
if (addr)
|
||||
{
|
||||
if (DumpAddressOffsetFromFunction (s, sc, exe_ctx, *addr, false, false))
|
||||
if (DumpAddressOffsetFromFunction (s, sc, exe_ctx, *addr, false, false, false))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1811,13 +1826,13 @@ FormatEntity::Format (const Entry &entry,
|
||||
case Entry::Type::FunctionAddrOffsetConcrete:
|
||||
if (addr)
|
||||
{
|
||||
if (DumpAddressOffsetFromFunction (s, sc, exe_ctx, *addr, true, true))
|
||||
if (DumpAddressOffsetFromFunction (s, sc, exe_ctx, *addr, true, true, true))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case Entry::Type::FunctionLineOffset:
|
||||
if (DumpAddressOffsetFromFunction (s, sc, exe_ctx, sc->line_entry.range.GetBaseAddress(), false, false))
|
||||
if (DumpAddressOffsetFromFunction (s, sc, exe_ctx, sc->line_entry.range.GetBaseAddress(), false, false, false))
|
||||
return true;
|
||||
return false;
|
||||
|
||||
@ -1827,12 +1842,18 @@ FormatEntity::Format (const Entry &entry,
|
||||
StackFrame *frame = exe_ctx->GetFramePtr();
|
||||
if (frame)
|
||||
{
|
||||
if (DumpAddressOffsetFromFunction (s, sc, exe_ctx, frame->GetFrameCodeAddress(), false, false))
|
||||
if (DumpAddressOffsetFromFunction (s, sc, exe_ctx, frame->GetFrameCodeAddress(), false, false, false))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
case Entry::Type::FunctionChanged:
|
||||
return function_changed == true;
|
||||
|
||||
case Entry::Type::FunctionInitial:
|
||||
return initial_function == true;
|
||||
|
||||
case Entry::Type::LineEntryFile:
|
||||
if (sc && sc->line_entry.IsValid())
|
||||
{
|
||||
|
@ -792,25 +792,63 @@ const char *DisassemblerLLVMC::SymbolLookup (uint64_t value,
|
||||
//std::string remove_this_prior_to_checkin;
|
||||
Target *target = m_exe_ctx ? m_exe_ctx->GetTargetPtr() : NULL;
|
||||
Address value_so_addr;
|
||||
Address pc_so_addr;
|
||||
if (m_inst->UsingFileAddress())
|
||||
{
|
||||
ModuleSP module_sp(m_inst->GetAddress().GetModule());
|
||||
if (module_sp)
|
||||
{
|
||||
module_sp->ResolveFileAddress(value, value_so_addr);
|
||||
module_sp->ResolveFileAddress(pc, pc_so_addr);
|
||||
}
|
||||
}
|
||||
else if (target && !target->GetSectionLoadList().IsEmpty())
|
||||
{
|
||||
target->GetSectionLoadList().ResolveLoadAddress(value, value_so_addr);
|
||||
target->GetSectionLoadList().ResolveLoadAddress(pc, pc_so_addr);
|
||||
}
|
||||
|
||||
SymbolContext sym_ctx;
|
||||
const uint32_t resolve_scope = eSymbolContextFunction | eSymbolContextSymbol;
|
||||
if (pc_so_addr.IsValid() && pc_so_addr.GetModule())
|
||||
{
|
||||
pc_so_addr.GetModule()->ResolveSymbolContextForAddress (pc_so_addr, resolve_scope, sym_ctx);
|
||||
}
|
||||
|
||||
if (value_so_addr.IsValid() && value_so_addr.GetSection())
|
||||
{
|
||||
StreamString ss;
|
||||
|
||||
value_so_addr.Dump (&ss,
|
||||
target,
|
||||
Address::DumpStyleResolvedDescriptionNoFunctionArguments,
|
||||
Address::DumpStyleSectionNameOffset);
|
||||
bool format_omitting_current_func_name = false;
|
||||
if (sym_ctx.symbol || sym_ctx.function)
|
||||
{
|
||||
AddressRange range;
|
||||
if (sym_ctx.GetAddressRange (resolve_scope, 0, false, range)
|
||||
&& range.GetBaseAddress().IsValid()
|
||||
&& range.ContainsLoadAddress (value_so_addr, target))
|
||||
{
|
||||
format_omitting_current_func_name = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If the "value" address (the target address we're symbolicating)
|
||||
// is inside the same SymbolContext as the current instruction pc
|
||||
// (pc_so_addr), don't print the full function name - just print it
|
||||
// with DumpStyleNoFunctionName style, e.g. "<+36>".
|
||||
if (format_omitting_current_func_name)
|
||||
{
|
||||
value_so_addr.Dump (&ss,
|
||||
target,
|
||||
Address::DumpStyleNoFunctionName,
|
||||
Address::DumpStyleSectionNameOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
value_so_addr.Dump (&ss,
|
||||
target,
|
||||
Address::DumpStyleResolvedDescriptionNoFunctionArguments,
|
||||
Address::DumpStyleSectionNameOffset);
|
||||
}
|
||||
|
||||
if (!ss.GetString().empty())
|
||||
{
|
||||
|
@ -149,7 +149,7 @@ UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly (AddressRange&
|
||||
StreamString strm;
|
||||
lldb_private::FormatEntity::Entry format;
|
||||
FormatEntity::Parse("${frame.pc}: ", format);
|
||||
inst->Dump(&strm, inst_list.GetMaxOpcocdeByteSize (), show_address, show_bytes, NULL, NULL, NULL, &format);
|
||||
inst->Dump(&strm, inst_list.GetMaxOpcocdeByteSize (), show_address, show_bytes, NULL, NULL, NULL, &format, 0);
|
||||
log->PutCString (strm.GetData());
|
||||
}
|
||||
|
||||
|
@ -129,15 +129,15 @@ SymbolContext::Clear(bool clear_target)
|
||||
}
|
||||
|
||||
bool
|
||||
SymbolContext::DumpStopContext
|
||||
(
|
||||
SymbolContext::DumpStopContext (
|
||||
Stream *s,
|
||||
ExecutionContextScope *exe_scope,
|
||||
const Address &addr,
|
||||
bool show_fullpaths,
|
||||
bool show_module,
|
||||
bool show_inlined_frames,
|
||||
bool show_function_arguments
|
||||
bool show_function_arguments,
|
||||
bool show_function_name
|
||||
) const
|
||||
{
|
||||
bool dumped_something = false;
|
||||
@ -155,7 +155,12 @@ SymbolContext::DumpStopContext
|
||||
{
|
||||
SymbolContext inline_parent_sc;
|
||||
Address inline_parent_addr;
|
||||
if (show_function_arguments == false && function->GetMangled().GetName(Mangled::ePreferDemangledWithoutArguments))
|
||||
if (show_function_name == false)
|
||||
{
|
||||
s->Printf("<");
|
||||
dumped_something = true;
|
||||
}
|
||||
else if (show_function_arguments == false && function->GetMangled().GetName(Mangled::ePreferDemangledWithoutArguments))
|
||||
{
|
||||
dumped_something = true;
|
||||
function->GetMangled().GetName(Mangled::ePreferDemangledWithoutArguments).Dump(s);
|
||||
@ -169,7 +174,13 @@ SymbolContext::DumpStopContext
|
||||
if (addr.IsValid())
|
||||
{
|
||||
const addr_t function_offset = addr.GetOffset() - function->GetAddressRange().GetBaseAddress().GetOffset();
|
||||
if (function_offset)
|
||||
if (show_function_name == false)
|
||||
{
|
||||
// Print +offset even if offset is 0
|
||||
dumped_something = true;
|
||||
s->Printf("+%" PRIu64 ">", function_offset);
|
||||
}
|
||||
else if (function_offset)
|
||||
{
|
||||
dumped_something = true;
|
||||
s->Printf(" + %" PRIu64, function_offset);
|
||||
@ -202,7 +213,8 @@ SymbolContext::DumpStopContext
|
||||
{
|
||||
s->EOL();
|
||||
s->Indent();
|
||||
return inline_parent_sc.DumpStopContext (s, exe_scope, inline_parent_addr, show_fullpaths, show_module, show_inlined_frames, show_function_arguments);
|
||||
const bool show_function_name = true;
|
||||
return inline_parent_sc.DumpStopContext (s, exe_scope, inline_parent_addr, show_fullpaths, show_module, show_inlined_frames, show_function_arguments, show_function_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -218,7 +230,12 @@ SymbolContext::DumpStopContext
|
||||
}
|
||||
else if (symbol != nullptr)
|
||||
{
|
||||
if (symbol->GetMangled().GetName())
|
||||
if (show_function_name == false)
|
||||
{
|
||||
s->Printf("<");
|
||||
dumped_something = true;
|
||||
}
|
||||
else if (symbol->GetMangled().GetName())
|
||||
{
|
||||
dumped_something = true;
|
||||
if (symbol->GetType() == eSymbolTypeTrampoline)
|
||||
@ -229,7 +246,13 @@ SymbolContext::DumpStopContext
|
||||
if (addr.IsValid() && symbol->ValueIsAddress())
|
||||
{
|
||||
const addr_t symbol_offset = addr.GetOffset() - symbol->GetAddress().GetOffset();
|
||||
if (symbol_offset)
|
||||
if (show_function_name == false)
|
||||
{
|
||||
// Print +offset even if offset is 0
|
||||
dumped_something = true;
|
||||
s->Printf("+%" PRIu64 ">", symbol_offset);
|
||||
}
|
||||
else if (symbol_offset)
|
||||
{
|
||||
dumped_something = true;
|
||||
s->Printf(" + %" PRIu64, symbol_offset);
|
||||
|
@ -175,6 +175,7 @@ Variable::DumpDeclaration (Stream *s, bool show_fullpaths, bool show_module)
|
||||
sc.line_entry.Clear();
|
||||
bool show_inlined_frames = false;
|
||||
const bool show_function_arguments = true;
|
||||
const bool show_function_name = true;
|
||||
|
||||
dumped_declaration_info = sc.DumpStopContext (s,
|
||||
nullptr,
|
||||
@ -182,7 +183,8 @@ Variable::DumpDeclaration (Stream *s, bool show_fullpaths, bool show_module)
|
||||
show_fullpaths,
|
||||
show_module,
|
||||
show_inlined_frames,
|
||||
show_function_arguments);
|
||||
show_function_arguments,
|
||||
show_function_name);
|
||||
|
||||
if (sc.function)
|
||||
s->PutChar(':');
|
||||
|
@ -1406,13 +1406,15 @@ StackFrame::Dump (Stream *strm, bool show_frame_index, bool show_fullpaths)
|
||||
const bool show_module = true;
|
||||
const bool show_inline = true;
|
||||
const bool show_function_arguments = true;
|
||||
const bool show_function_name = true;
|
||||
m_sc.DumpStopContext (strm,
|
||||
exe_ctx.GetBestExecutionContextScope(),
|
||||
GetFrameCodeAddress(),
|
||||
show_fullpaths,
|
||||
show_module,
|
||||
show_inline,
|
||||
show_function_arguments);
|
||||
show_function_arguments,
|
||||
show_function_name);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -220,7 +220,8 @@ ThreadPlanAssemblyTracer::Log ()
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
disassemble_format);
|
||||
disassemble_format,
|
||||
0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,8 +150,8 @@ class AbbreviationsTestCase(TestBase):
|
||||
# ARCH, if not specified, defaults to x86_64.
|
||||
if self.getArchitecture() in ["", 'x86_64', 'i386']:
|
||||
self.expect("dis -f",
|
||||
substrs = ['<sum(int, int)>:',
|
||||
' mov',
|
||||
startstr = "a.out`sum(int, int)",
|
||||
substrs = [' mov',
|
||||
' addl ',
|
||||
'ret'])
|
||||
|
||||
|
@ -186,7 +186,7 @@ class AssertingInferiorTestCase(TestBase):
|
||||
if frame.GetFrameID() == 0:
|
||||
pc_backup_offset = 0
|
||||
self.expect("disassemble -a %s" % (frame.GetPC() - pc_backup_offset),
|
||||
substrs = ['<%s>:' % frame.GetFunctionName()])
|
||||
substrs = ['<+0>: '])
|
||||
|
||||
def check_expr_in_main(self, thread):
|
||||
depth = thread.GetNumFrames()
|
||||
|
Loading…
x
Reference in New Issue
Block a user