summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Core/Disassembler.h3
-rw-r--r--lldb/source/Commands/CommandObjectDisassemble.cpp8
-rw-r--r--lldb/source/Core/Disassembler.cpp10
3 files changed, 10 insertions, 11 deletions
diff --git a/lldb/include/lldb/Core/Disassembler.h b/lldb/include/lldb/Core/Disassembler.h
index 9a256e79dbd..f77f73f717d 100644
--- a/lldb/include/lldb/Core/Disassembler.h
+++ b/lldb/include/lldb/Core/Disassembler.h
@@ -189,7 +189,8 @@ public:
eOptionNone = 0u,
eOptionShowBytes = (1u << 0),
eOptionRawOuput = (1u << 1),
- eOptionShowCurrentLine = (1u << 2)
+ eOptionMarkPCSourceLine = (1u << 2), // Mark the source line that contains the current PC (mixed mode only)
+ eOptionMarkPCAddress = (1u << 3) // Mark the disassembly line the contains the PC
};
static Disassembler*
diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp
index 980c83c11c4..90554eac66f 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -258,10 +258,12 @@ CommandObjectDisassemble::Execute
m_options.num_lines_context = 1;
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
- uint32_t options = 0;
+ // Always show the PC in the disassembly
+ uint32_t options = Disassembler::eOptionMarkPCAddress;
- if (!m_options.show_mixed)
- options |= Disassembler::eOptionShowCurrentLine;
+ // Mark the source line for the current PC only if we are doing mixed source and assembly
+ if (m_options.show_mixed)
+ options |= Disassembler::eOptionMarkPCSourceLine;
if (m_options.show_bytes)
options |= Disassembler::eOptionShowBytes;
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index a1208e43e04..6d16e35918a 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -337,7 +337,6 @@ Disassembler::PrintInstructions
pc_addr_ptr = &exe_ctx.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)
{
Instruction *inst = disasm_ptr->GetInstructionList().GetInstructionAtIndex (i).get();
@@ -375,7 +374,7 @@ Disassembler::PrintInstructions
sc.line_entry.line,
num_mixed_context_lines,
num_mixed_context_lines,
- ((options & eOptionShowCurrentLine) ? "->" : ""),
+ ((inst_is_at_pc && (options & eOptionMarkPCSourceLine)) ? "->" : ""),
&strm);
}
}
@@ -405,12 +404,9 @@ Disassembler::PrintInstructions
}
}
- if (pc_addr_ptr)
+ if ((options & eOptionMarkPCAddress) && pc_addr_ptr)
{
- if (inst_is_at_pc)
- strm.PutCString("-> ");
- else
- strm.PutCString(" ");
+ strm.PutCString(inst_is_at_pc ? "-> " : " ");
}
const bool show_bytes = (options & eOptionShowBytes) != 0;
const bool raw = (options & eOptionRawOuput) != 0;
OpenPOWER on IntegriCloud