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/CommandObjectSource.cpp b/source/Commands/CommandObjectSource.cpp
index c0c9f94..ec58e94 100644
--- a/source/Commands/CommandObjectSource.cpp
+++ b/source/Commands/CommandObjectSource.cpp
@@ -32,7 +32,7 @@
// CommandObjectSourceInfo
//-------------------------------------------------------------------------
-class CommandObjectSourceInfo : public CommandObject
+class CommandObjectSourceInfo : public CommandObjectParsed
{
class CommandOptions : public Options
@@ -96,10 +96,10 @@
public:
CommandObjectSourceInfo(CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "source info",
- "Display information about the source lines from the current executable's debug info.",
- "source info [<cmd-options>]"),
+ CommandObjectParsed (interpreter,
+ "source info",
+ "Display information about the source lines from the current executable's debug info.",
+ "source info [<cmd-options>]"),
m_options (interpreter)
{
}
@@ -115,19 +115,15 @@
return &m_options;
}
-
+protected:
bool
- Execute
- (
- Args& args,
- CommandReturnObject &result
- )
+ DoExecute (Args& command, CommandReturnObject &result)
{
result.AppendError ("Not yet implemented");
result.SetStatus (eReturnStatusFailed);
return false;
}
-protected:
+
CommandOptions m_options;
};
@@ -144,7 +140,7 @@
// CommandObjectSourceList
//-------------------------------------------------------------------------
-class CommandObjectSourceList : public CommandObject
+class CommandObjectSourceList : public CommandObjectParsed
{
class CommandOptions : public Options
@@ -232,10 +228,10 @@
public:
CommandObjectSourceList(CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "source list",
- "Display source code (as specified) based on the current executable's debug info.",
- NULL),
+ CommandObjectParsed (interpreter,
+ "source list",
+ "Display source code (as specified) based on the current executable's debug info.",
+ NULL),
m_options (interpreter)
{
CommandArgumentEntry arg;
@@ -263,15 +259,17 @@
return &m_options;
}
-
- bool
- Execute
- (
- Args& args,
- CommandReturnObject &result
- )
+ virtual const char *
+ GetRepeatCommand (Args ¤t_command_args, uint32_t index)
{
- const int argc = args.GetArgumentCount();
+ return m_cmd_name.c_str();
+ }
+
+protected:
+ bool
+ DoExecute (Args& command, CommandReturnObject &result)
+ {
+ const int argc = command.GetArgumentCount();
if (argc != 0)
{
@@ -601,12 +599,6 @@
return result.Succeeded();
}
- virtual const char *GetRepeatCommand (Args ¤t_command_args, uint32_t index)
- {
- return m_cmd_name.c_str();
- }
-
-protected:
const SymbolContextList *
GetBreakpointLocations ()
{