Fixed an issue where SBFrame::GetDisassembly() was returning disassembly that

contained the current line marker. This is now an option which is not enabled
for the API disassembly call.

llvm-svn: 133597
This commit is contained in:
Greg Clayton 2011-06-22 01:39:49 +00:00
parent fe268d1045
commit 1da6f9d7f1
4 changed files with 41 additions and 43 deletions

View File

@ -184,6 +184,13 @@ class Disassembler :
{ {
public: public:
enum
{
eOptionNone = 0u,
eOptionShowBytes = (1u << 0),
eOptionRawOuput = (1u << 1),
eOptionShowCurrentLine = (1u << 2)
};
static Disassembler* static Disassembler*
FindPlugin (const ArchSpec &arch, const char *plugin_name); FindPlugin (const ArchSpec &arch, const char *plugin_name);
@ -202,8 +209,7 @@ public:
const AddressRange &range, const AddressRange &range,
uint32_t num_instructions, uint32_t num_instructions,
uint32_t num_mixed_context_lines, uint32_t num_mixed_context_lines,
bool show_bytes, uint32_t options,
bool raw,
Stream &strm); Stream &strm);
static bool static bool
@ -214,8 +220,7 @@ public:
const Address &start, const Address &start,
uint32_t num_instructions, uint32_t num_instructions,
uint32_t num_mixed_context_lines, uint32_t num_mixed_context_lines,
bool show_bytes, uint32_t options,
bool raw,
Stream &strm); Stream &strm);
static size_t static size_t
@ -226,8 +231,7 @@ public:
SymbolContextList &sc_list, SymbolContextList &sc_list,
uint32_t num_instructions, uint32_t num_instructions,
uint32_t num_mixed_context_lines, uint32_t num_mixed_context_lines,
bool show_bytes, uint32_t options,
bool raw,
Stream &strm); Stream &strm);
static bool static bool
@ -239,8 +243,7 @@ public:
Module *module, Module *module,
uint32_t num_instructions, uint32_t num_instructions,
uint32_t num_mixed_context_lines, uint32_t num_mixed_context_lines,
bool show_bytes, uint32_t options,
bool raw,
Stream &strm); Stream &strm);
static bool static bool
@ -250,8 +253,7 @@ public:
const ExecutionContext &exe_ctx, const ExecutionContext &exe_ctx,
uint32_t num_instructions, uint32_t num_instructions,
uint32_t num_mixed_context_lines, uint32_t num_mixed_context_lines,
bool show_bytes, uint32_t options,
bool raw,
Stream &strm); Stream &strm);
//------------------------------------------------------------------ //------------------------------------------------------------------
@ -269,8 +271,7 @@ public:
const ExecutionContext &exe_ctx, const ExecutionContext &exe_ctx,
uint32_t num_instructions, uint32_t num_instructions,
uint32_t num_mixed_context_lines, uint32_t num_mixed_context_lines,
bool show_bytes, uint32_t options,
bool raw,
Stream &strm); Stream &strm);
size_t size_t

View File

@ -258,6 +258,16 @@ CommandObjectDisassemble::Execute
m_options.num_lines_context = 1; m_options.num_lines_context = 1;
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext()); ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
uint32_t options = 0;
if (!m_options.show_mixed)
options |= Disassembler::eOptionShowCurrentLine;
if (m_options.show_bytes)
options |= Disassembler::eOptionShowBytes;
if (m_options.raw)
options |= Disassembler::eOptionRawOuput;
if (!m_options.func_name.empty()) if (!m_options.func_name.empty())
{ {
@ -271,8 +281,7 @@ CommandObjectDisassemble::Execute
NULL, // Module * NULL, // Module *
m_options.num_instructions, m_options.num_instructions,
m_options.show_mixed ? m_options.num_lines_context : 0, m_options.show_mixed ? m_options.num_lines_context : 0,
m_options.show_bytes, options,
m_options.raw,
result.GetOutputStream())) result.GetOutputStream()))
{ {
result.SetStatus (eReturnStatusSuccessFinishResult); result.SetStatus (eReturnStatusSuccessFinishResult);
@ -369,8 +378,7 @@ CommandObjectDisassemble::Execute
range.GetBaseAddress(), range.GetBaseAddress(),
m_options.num_instructions, m_options.num_instructions,
m_options.show_mixed ? m_options.num_lines_context : 0, m_options.show_mixed ? m_options.num_lines_context : 0,
m_options.show_bytes, options,
m_options.raw,
result.GetOutputStream())) result.GetOutputStream()))
{ {
result.SetStatus (eReturnStatusSuccessFinishResult); result.SetStatus (eReturnStatusSuccessFinishResult);
@ -413,8 +421,7 @@ CommandObjectDisassemble::Execute
range, range,
m_options.num_instructions, m_options.num_instructions,
m_options.show_mixed ? m_options.num_lines_context : 0, m_options.show_mixed ? m_options.num_lines_context : 0,
m_options.show_bytes, options,
m_options.raw,
result.GetOutputStream())) result.GetOutputStream()))
{ {
result.SetStatus (eReturnStatusSuccessFinishResult); result.SetStatus (eReturnStatusSuccessFinishResult);

View File

@ -110,8 +110,7 @@ Disassembler::Disassemble
SymbolContextList &sc_list, SymbolContextList &sc_list,
uint32_t num_instructions, uint32_t num_instructions,
uint32_t num_mixed_context_lines, uint32_t num_mixed_context_lines,
bool show_bytes, uint32_t options,
bool raw,
Stream &strm Stream &strm
) )
{ {
@ -134,8 +133,7 @@ Disassembler::Disassemble
range, range,
num_instructions, num_instructions,
num_mixed_context_lines, num_mixed_context_lines,
show_bytes, options,
raw,
strm)) strm))
{ {
++success_count; ++success_count;
@ -157,8 +155,7 @@ Disassembler::Disassemble
Module *module, Module *module,
uint32_t num_instructions, uint32_t num_instructions,
uint32_t num_mixed_context_lines, uint32_t num_mixed_context_lines,
bool show_bytes, uint32_t options,
bool raw,
Stream &strm Stream &strm
) )
{ {
@ -199,8 +196,7 @@ Disassembler::Disassemble
sc_list, sc_list,
num_instructions, num_instructions,
num_mixed_context_lines, num_mixed_context_lines,
show_bytes, options,
raw,
strm); strm);
} }
return false; return false;
@ -242,8 +238,7 @@ Disassembler::Disassemble
const AddressRange &disasm_range, const AddressRange &disasm_range,
uint32_t num_instructions, uint32_t num_instructions,
uint32_t num_mixed_context_lines, uint32_t num_mixed_context_lines,
bool show_bytes, uint32_t options,
bool raw,
Stream &strm Stream &strm
) )
{ {
@ -267,8 +262,7 @@ Disassembler::Disassemble
exe_ctx, exe_ctx,
num_instructions, num_instructions,
num_mixed_context_lines, num_mixed_context_lines,
show_bytes, options,
raw,
strm); strm);
} }
} }
@ -285,8 +279,7 @@ Disassembler::Disassemble
const Address &start_address, const Address &start_address,
uint32_t num_instructions, uint32_t num_instructions,
uint32_t num_mixed_context_lines, uint32_t num_mixed_context_lines,
bool show_bytes, uint32_t options,
bool raw,
Stream &strm Stream &strm
) )
{ {
@ -307,8 +300,7 @@ Disassembler::Disassemble
exe_ctx, exe_ctx,
num_instructions, num_instructions,
num_mixed_context_lines, num_mixed_context_lines,
show_bytes, options,
raw,
strm); strm);
} }
} }
@ -324,8 +316,7 @@ Disassembler::PrintInstructions
const ExecutionContext &exe_ctx, const ExecutionContext &exe_ctx,
uint32_t num_instructions, uint32_t num_instructions,
uint32_t num_mixed_context_lines, uint32_t num_mixed_context_lines,
bool show_bytes, uint32_t options,
bool raw,
Stream &strm Stream &strm
) )
{ {
@ -384,7 +375,7 @@ Disassembler::PrintInstructions
sc.line_entry.line, sc.line_entry.line,
num_mixed_context_lines, num_mixed_context_lines,
num_mixed_context_lines, num_mixed_context_lines,
num_mixed_context_lines ? "->" : "", ((options & eOptionShowCurrentLine) ? "->" : ""),
&strm); &strm);
} }
} }
@ -421,6 +412,8 @@ Disassembler::PrintInstructions
else else
strm.PutCString(" "); strm.PutCString(" ");
} }
const bool show_bytes = (options & eOptionShowBytes) != 0;
const bool raw = (options & eOptionRawOuput) != 0;
inst->Dump(&strm, max_opcode_byte_size, true, show_bytes, &exe_ctx, raw); inst->Dump(&strm, max_opcode_byte_size, true, show_bytes, &exe_ctx, raw);
strm.EOL(); strm.EOL();
} }
@ -443,8 +436,7 @@ Disassembler::Disassemble
const ExecutionContext &exe_ctx, const ExecutionContext &exe_ctx,
uint32_t num_instructions, uint32_t num_instructions,
uint32_t num_mixed_context_lines, uint32_t num_mixed_context_lines,
bool show_bytes, uint32_t options,
bool raw,
Stream &strm Stream &strm
) )
{ {
@ -476,8 +468,7 @@ Disassembler::Disassemble
range, range,
num_instructions, num_instructions,
num_mixed_context_lines, num_mixed_context_lines,
show_bytes, options,
raw,
strm); strm);
} }

View File

@ -262,8 +262,7 @@ StackFrame::Disassemble ()
exe_ctx, exe_ctx,
0, 0,
0, 0,
false, 0,
false,
m_disassembly); m_disassembly);
if (m_disassembly.GetSize() == 0) if (m_disassembly.GetSize() == 0)
return NULL; return NULL;