summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectDisassemble.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-09-18 01:14:36 +0000
committerGreg Clayton <gclayton@apple.com>2010-09-18 01:14:36 +0000
commita701509229f658eac7c10bd6aa54cf6ed5b5011d (patch)
treeb38ff5cfb3fd466e5c7f89cea9bd9fa7d89eed16 /lldb/source/Commands/CommandObjectDisassemble.cpp
parent9a587aaaa9e7bed09477c3c8d51d8f44dfd99158 (diff)
downloadbcm5719-llvm-a701509229f658eac7c10bd6aa54cf6ed5b5011d.tar.gz
bcm5719-llvm-a701509229f658eac7c10bd6aa54cf6ed5b5011d.zip
Fixed the way set/show variables were being accessed to being natively
accessed by the objects that own the settings. The previous approach wasn't very usable and made for a lot of unnecessary code just to access variables that were already owned by the objects. While I fixed those things, I saw that CommandObject objects should really have a reference to their command interpreter so they can access the terminal with if they want to output usaage. Fixed up all CommandObjects to take an interpreter and cleaned up the API to not need the interpreter to be passed in. Fixed the disassemble command to output the usage if no options are passed down and arguments are passed (all disassebmle variants take options, there are no "args only"). llvm-svn: 114252
Diffstat (limited to 'lldb/source/Commands/CommandObjectDisassemble.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectDisassemble.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp
index a5fc7f6cfab..5e135376813 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -141,10 +141,11 @@ CommandObjectDisassemble::CommandOptions::g_option_table[] =
// CommandObjectDisassemble
//-------------------------------------------------------------------------
-CommandObjectDisassemble::CommandObjectDisassemble () :
- CommandObject ("disassemble",
- "Disassemble bytes in the current function, or elsewhere in the executable program as specified by the user.",
- "disassemble [<cmd-options>]")
+CommandObjectDisassemble::CommandObjectDisassemble (CommandInterpreter &interpreter) :
+ CommandObject (interpreter,
+ "disassemble",
+ "Disassemble bytes in the current function, or elsewhere in the executable program as specified by the user.",
+ "disassemble [<cmd-options>]")
{
}
@@ -155,12 +156,11 @@ CommandObjectDisassemble::~CommandObjectDisassemble()
bool
CommandObjectDisassemble::Execute
(
- CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result
)
{
- Target *target = interpreter.GetDebugger().GetSelectedTarget().get();
+ Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
if (target == NULL)
{
result.AppendError ("invalid target, set executable file using 'file' command");
@@ -189,11 +189,15 @@ CommandObjectDisassemble::Execute
if (command.GetArgumentCount() != 0)
{
- result.AppendErrorWithFormat ("\"disassemble\" doesn't take any arguments.\n");
+ result.AppendErrorWithFormat ("\"disassemble\" arguments are specified as options.\n");
+ GetOptions()->GenerateOptionUsage (m_interpreter,
+ result.GetErrorStream(),
+ this);
+
result.SetStatus (eReturnStatusFailed);
return false;
}
- ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
+ ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
if (m_options.show_mixed && m_options.num_lines_context == 0)
m_options.num_lines_context = 1;
@@ -202,7 +206,7 @@ CommandObjectDisassemble::Execute
{
ConstString name(m_options.m_func_name.c_str());
- if (Disassembler::Disassemble (interpreter.GetDebugger(),
+ if (Disassembler::Disassemble (m_interpreter.GetDebugger(),
arch,
exe_ctx,
name,
@@ -260,7 +264,7 @@ CommandObjectDisassemble::Execute
if (range.GetByteSize() == 0)
range.SetByteSize(DEFAULT_DISASM_BYTE_SIZE);
- if (Disassembler::Disassemble (interpreter.GetDebugger(),
+ if (Disassembler::Disassemble (m_interpreter.GetDebugger(),
arch,
exe_ctx,
range,
OpenPOWER on IntegriCloud