aboutsummaryrefslogtreecommitdiff
path: root/source/Core/Disassembler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Core/Disassembler.cpp')
-rw-r--r--source/Core/Disassembler.cpp55
1 files changed, 21 insertions, 34 deletions
diff --git a/source/Core/Disassembler.cpp b/source/Core/Disassembler.cpp
index 1d2b8cf04c32..649f0c5bcb26 100644
--- a/source/Core/Disassembler.cpp
+++ b/source/Core/Disassembler.cpp
@@ -410,17 +410,18 @@ Disassembler::PrintInstructions
SymbolContext prev_sc;
AddressRange sc_range;
const Address *pc_addr_ptr = NULL;
- ExecutionContextScope *exe_scope = exe_ctx.GetBestExecutionContextScope();
StackFrame *frame = exe_ctx.GetFramePtr();
TargetSP target_sp (exe_ctx.GetTargetSP());
SourceManager &source_manager = target_sp ? target_sp->GetSourceManager() : debugger.GetSourceManager();
if (frame)
+ {
pc_addr_ptr = &frame->GetFrameCodeAddress();
+ }
const uint32_t scope = eSymbolContextLineEntry | eSymbolContextFunction | eSymbolContextSymbol;
const bool use_inline_block_range = false;
- for (size_t i=0; i<num_instructions_found; ++i)
+ for (size_t i = 0; i < num_instructions_found; ++i)
{
Instruction *inst = disasm_ptr->GetInstructionList().GetInstructionAtIndex (i).get();
if (inst)
@@ -447,7 +448,7 @@ Disassembler::PrintInstructions
if (offset != 0)
strm.EOL();
- sc.DumpStopContext(&strm, exe_ctx.GetProcessPtr(), addr, false, true, false);
+ sc.DumpStopContext(&strm, exe_ctx.GetProcessPtr(), addr, false, true, false, false);
strm.EOL();
if (sc.comp_unit && sc.line_entry.IsValid())
@@ -462,23 +463,6 @@ Disassembler::PrintInstructions
}
}
}
- else if ((sc.function || sc.symbol) && (sc.function != prev_sc.function || sc.symbol != prev_sc.symbol))
- {
- if (prev_sc.function || prev_sc.symbol)
- strm.EOL();
-
- bool show_fullpaths = false;
- bool show_module = true;
- bool show_inlined_frames = true;
- sc.DumpStopContext (&strm,
- exe_scope,
- addr,
- show_fullpaths,
- show_module,
- show_inlined_frames);
-
- strm << ":\n";
- }
}
else
{
@@ -486,12 +470,13 @@ Disassembler::PrintInstructions
}
}
- if ((options & eOptionMarkPCAddress) && pc_addr_ptr)
+ const bool show_bytes = (options & eOptionShowBytes) != 0;
+ const char *disassembly_format = "${addr-file-or-load}: ";
+ if (exe_ctx.HasTargetScope())
{
- strm.PutCString(inst_is_at_pc ? "-> " : " ");
+ disassembly_format = exe_ctx.GetTargetRef().GetDebugger().GetDisassemblyFormat ();
}
- const bool show_bytes = (options & eOptionShowBytes) != 0;
- inst->Dump(&strm, max_opcode_byte_size, true, show_bytes, &exe_ctx);
+ inst->Dump (&strm, max_opcode_byte_size, true, show_bytes, &exe_ctx, &sc, &prev_sc, disassembly_format);
strm.EOL();
}
else
@@ -578,7 +563,10 @@ Instruction::Dump (lldb_private::Stream *s,
uint32_t max_opcode_byte_size,
bool show_address,
bool show_bytes,
- const ExecutionContext* exe_ctx)
+ const ExecutionContext* exe_ctx,
+ const SymbolContext *sym_ctx,
+ const SymbolContext *prev_sym_ctx,
+ const char *disassembly_addr_format_spec)
{
size_t opcode_column_width = 7;
const size_t operand_column_width = 25;
@@ -589,13 +577,7 @@ Instruction::Dump (lldb_private::Stream *s,
if (show_address)
{
- m_address.Dump(&ss,
- exe_ctx ? exe_ctx->GetBestExecutionContextScope() : NULL,
- Address::DumpStyleLoadAddress,
- Address::DumpStyleModuleWithFileAddress,
- 0);
-
- ss.PutCString(": ");
+ Debugger::FormatDisassemblerAddress (disassembly_addr_format_spec, sym_ctx, prev_sym_ctx, exe_ctx, &m_address, ss);
}
if (show_bytes)
@@ -621,7 +603,7 @@ Instruction::Dump (lldb_private::Stream *s,
}
}
- const size_t opcode_pos = ss.GetSize();
+ const size_t opcode_pos = ss.GetSizeOfLastLine();
// The default opcode size of 7 characters is plenty for most architectures
// but some like arm can pull out the occasional vqrshrun.s16. We won't get
@@ -1003,13 +985,18 @@ InstructionList::Dump (Stream *s,
{
const uint32_t max_opcode_byte_size = GetMaxOpcocdeByteSize();
collection::const_iterator pos, begin, end;
+ const char *disassemble_format = "${addr-file-or-load}: ";
+ if (exe_ctx)
+ {
+ disassemble_format = exe_ctx->GetTargetRef().GetDebugger().GetDisassemblyFormat ();
+ }
for (begin = m_instructions.begin(), end = m_instructions.end(), pos = begin;
pos != end;
++pos)
{
if (pos != begin)
s->EOL();
- (*pos)->Dump(s, max_opcode_byte_size, show_address, show_bytes, exe_ctx);
+ (*pos)->Dump(s, max_opcode_byte_size, show_address, show_bytes, exe_ctx, NULL, NULL, disassemble_format);
}
}