Make raw & parsed commands subclasses of CommandObject rather than having the raw version implement an
Execute which was never going to get run and another ExecuteRawCommandString. Took the knowledge of how
to prepare raw & parsed commands out of CommandInterpreter and put it in CommandObject where it belongs.
Also took all the cases where there were the subcommands of Multiword commands declared in the .h file for
the overall command and moved them into the .cpp file.
Made the CommandObject flags work for raw as well as parsed commands.
Made "expr" use the flags so that it requires you to be paused to run "expr".
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@158235 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectMemory.cpp b/source/Commands/CommandObjectMemory.cpp
index 6b495ac..61bf149 100644
--- a/source/Commands/CommandObjectMemory.cpp
+++ b/source/Commands/CommandObjectMemory.cpp
@@ -283,16 +283,16 @@
//----------------------------------------------------------------------
// Read memory from the inferior process
//----------------------------------------------------------------------
-class CommandObjectMemoryRead : public CommandObject
+class CommandObjectMemoryRead : public CommandObjectParsed
{
public:
CommandObjectMemoryRead (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "memory read",
- "Read from the memory of the process being debugged.",
- NULL,
- eFlagProcessMustBePaused),
+ CommandObjectParsed (interpreter,
+ "memory read",
+ "Read from the memory of the process being debugged.",
+ NULL,
+ eFlagProcessMustBePaused),
m_option_group (interpreter),
m_format_options (eFormatBytesWithASCII, 1, 8),
m_memory_options (),
@@ -361,8 +361,9 @@
return m_cmd_name.c_str();
}
+protected:
virtual bool
- Execute (Args& command,
+ DoExecute (Args& command,
CommandReturnObject &result)
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
@@ -763,7 +764,6 @@
return true;
}
-protected:
OptionGroupOptions m_option_group;
OptionGroupFormat m_format_options;
OptionGroupReadMemory m_memory_options;
@@ -789,7 +789,7 @@
//----------------------------------------------------------------------
// Write memory to the inferior process
//----------------------------------------------------------------------
-class CommandObjectMemoryWrite : public CommandObject
+class CommandObjectMemoryWrite : public CommandObjectParsed
{
public:
@@ -867,12 +867,11 @@
};
CommandObjectMemoryWrite (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "memory write",
- "Write to the memory of the process being debugged.",
- //"memory write [<cmd-options>] <addr> [value1 value2 ...]",
- NULL,
- eFlagProcessMustBeLaunched),
+ CommandObjectParsed (interpreter,
+ "memory write",
+ "Write to the memory of the process being debugged.",
+ NULL,
+ eFlagProcessMustBeLaunched),
m_option_group (interpreter),
m_format_options (eFormatBytes, 1, UINT64_MAX),
m_memory_options ()
@@ -945,9 +944,9 @@
return min <= sval64 && sval64 <= max;
}
+protected:
virtual bool
- Execute (Args& command,
- CommandReturnObject &result)
+ DoExecute (Args& command, CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process == NULL)
@@ -1221,8 +1220,6 @@
return true;
}
-protected:
-
OptionGroupOptions m_option_group;
OptionGroupFormat m_format_options;
OptionGroupWriteMemory m_memory_options;