summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectMemory.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/CommandObjectMemory.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/CommandObjectMemory.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index f5fe0ec62c2..22eccca9015 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -176,8 +176,9 @@ public:
uint32_t m_num_per_line;
};
- CommandObjectMemoryRead () :
- CommandObject ("memory read",
+ CommandObjectMemoryRead (CommandInterpreter &interpreter) :
+ CommandObject (interpreter,
+ "memory read",
"Read from the memory of the process being debugged.",
"memory read [<cmd-options>] <start-addr> [<end-addr>]",
eFlagProcessMustBeLaunched)
@@ -196,11 +197,10 @@ public:
}
virtual bool
- Execute (CommandInterpreter &interpreter,
- Args& command,
+ Execute (Args& command,
CommandReturnObject &result)
{
- Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+ Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
if (process == NULL)
{
result.AppendError("need a process to read memory");
@@ -394,8 +394,9 @@ public:
uint32_t m_byte_size;
};
- CommandObjectMemoryWrite () :
- CommandObject ("memory write",
+ CommandObjectMemoryWrite (CommandInterpreter &interpreter) :
+ CommandObject (interpreter,
+ "memory write",
"Write to the memory of the process being debugged.",
"memory write [<cmd-options>] <addr> [value1 value2 ...]",
eFlagProcessMustBeLaunched)
@@ -441,11 +442,10 @@ public:
}
virtual bool
- Execute (CommandInterpreter &interpreter,
- Args& command,
+ Execute (Args& command,
CommandReturnObject &result)
{
- Process *process = interpreter.GetDebugger().GetExecutionContext().process;
+ Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
if (process == NULL)
{
result.AppendError("need a process to read memory");
@@ -677,12 +677,13 @@ CommandObjectMemoryWrite::CommandOptions::g_option_table[] =
//-------------------------------------------------------------------------
CommandObjectMemory::CommandObjectMemory (CommandInterpreter &interpreter) :
- CommandObjectMultiword ("memory",
+ CommandObjectMultiword (interpreter,
+ "memory",
"A set of commands for operating on memory.",
"memory <subcommand> [<subcommand-options>]")
{
- LoadSubCommand (interpreter, "read", CommandObjectSP (new CommandObjectMemoryRead ()));
- LoadSubCommand (interpreter, "write", CommandObjectSP (new CommandObjectMemoryWrite ()));
+ LoadSubCommand ("read", CommandObjectSP (new CommandObjectMemoryRead (interpreter)));
+ LoadSubCommand ("write", CommandObjectSP (new CommandObjectMemoryWrite (interpreter)));
}
CommandObjectMemory::~CommandObjectMemory ()
OpenPOWER on IntegriCloud