aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectRegister.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2012-06-08 21:56:10 +0000
committerJim Ingham <jingham@apple.com>2012-06-08 21:56:10 +0000
commit5a988416736b906931cf6076d38f5b960110ed81 (patch)
treebbd923b8bcc49eb2e456290706df5452f4bcd250 /lldb/source/Commands/CommandObjectRegister.cpp
parentc5adccab1ae914f439593f8588a6a95669783bad (diff)
downloadllvm-5a988416736b906931cf6076d38f5b960110ed81.zip
llvm-5a988416736b906931cf6076d38f5b960110ed81.tar.gz
llvm-5a988416736b906931cf6076d38f5b960110ed81.tar.bz2
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". llvm-svn: 158235
Diffstat (limited to 'lldb/source/Commands/CommandObjectRegister.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectRegister.cpp39
1 files changed, 16 insertions, 23 deletions
diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp
index 1dc5691..2b0abe0 100644
--- a/lldb/source/Commands/CommandObjectRegister.cpp
+++ b/lldb/source/Commands/CommandObjectRegister.cpp
@@ -34,16 +34,15 @@ using namespace lldb_private;
//----------------------------------------------------------------------
// "register read"
//----------------------------------------------------------------------
-class CommandObjectRegisterRead : public CommandObject
+class CommandObjectRegisterRead : public CommandObjectParsed
{
public:
CommandObjectRegisterRead (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "register read",
- "Dump the contents of one or more register values from the current frame. If no register is specified, dumps them all.",
- //"register read [<reg-name1> [<reg-name2> [...]]]",
- NULL,
- eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
+ CommandObjectParsed (interpreter,
+ "register read",
+ "Dump the contents of one or more register values from the current frame. If no register is specified, dumps them all.",
+ NULL,
+ eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
m_option_group (interpreter),
m_format_options (eFormatDefault),
m_command_options ()
@@ -158,12 +157,9 @@ public:
return available_count > 0;
}
+protected:
virtual bool
- Execute
- (
- Args& command,
- CommandReturnObject &result
- )
+ DoExecute (Args& command, CommandReturnObject &result)
{
Stream &strm = result.GetOutputStream();
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
@@ -359,15 +355,15 @@ CommandObjectRegisterRead::CommandOptions::GetNumDefinitions ()
//----------------------------------------------------------------------
// "register write"
//----------------------------------------------------------------------
-class CommandObjectRegisterWrite : public CommandObject
+class CommandObjectRegisterWrite : public CommandObjectParsed
{
public:
CommandObjectRegisterWrite (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "register write",
- "Modify a single register value.",
- NULL,
- eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
+ CommandObjectParsed (interpreter,
+ "register write",
+ "Modify a single register value.",
+ NULL,
+ eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
{
CommandArgumentEntry arg1;
CommandArgumentEntry arg2;
@@ -398,12 +394,9 @@ public:
{
}
+protected:
virtual bool
- Execute
- (
- Args& command,
- CommandReturnObject &result
- )
+ DoExecute(Args& command, CommandReturnObject &result)
{
DataExtractor reg_data;
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());