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/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index a792405..1978606 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -138,14 +138,14 @@
// "target create"
//-------------------------------------------------------------------------
-class CommandObjectTargetCreate : public CommandObject
+class CommandObjectTargetCreate : public CommandObjectParsed
{
public:
CommandObjectTargetCreate(CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target create",
- "Create a target using the argument as the main executable.",
- NULL),
+ CommandObjectParsed (interpreter,
+ "target create",
+ "Create a target using the argument as the main executable.",
+ NULL),
m_option_group (interpreter),
m_arch_option (),
m_platform_options(true), // Do include the "--platform" option in the platform settings by passing true
@@ -180,8 +180,33 @@
return &m_option_group;
}
+ int
+ HandleArgumentCompletion (Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ OptionElementVector &opt_element_vector,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches)
+ {
+ std::string completion_str (input.GetArgumentAtIndex(cursor_index));
+ completion_str.erase (cursor_char_position);
+
+ CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
+ CommandCompletions::eDiskFileCompletion,
+ completion_str.c_str(),
+ match_start_point,
+ max_return_elements,
+ NULL,
+ word_complete,
+ matches);
+ return matches.GetSize();
+ }
+
+protected:
bool
- Execute (Args& command, CommandReturnObject &result)
+ DoExecute (Args& command, CommandReturnObject &result)
{
const int argc = command.GetArgumentCount();
FileSpec core_file (m_core_file.GetOptionValue().GetCurrentValue());
@@ -272,29 +297,6 @@
}
- int
- HandleArgumentCompletion (Args &input,
- int &cursor_index,
- int &cursor_char_position,
- OptionElementVector &opt_element_vector,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches)
- {
- std::string completion_str (input.GetArgumentAtIndex(cursor_index));
- completion_str.erase (cursor_char_position);
-
- CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
- CommandCompletions::eDiskFileCompletion,
- completion_str.c_str(),
- match_start_point,
- max_return_elements,
- NULL,
- word_complete,
- matches);
- return matches.GetSize();
- }
private:
OptionGroupOptions m_option_group;
OptionGroupArchitecture m_arch_option;
@@ -309,15 +311,15 @@
// "target list"
//----------------------------------------------------------------------
-class CommandObjectTargetList : public CommandObject
+class CommandObjectTargetList : public CommandObjectParsed
{
public:
CommandObjectTargetList (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target list",
- "List all current targets in the current debug session.",
- NULL,
- 0)
+ CommandObjectParsed (interpreter,
+ "target list",
+ "List all current targets in the current debug session.",
+ NULL,
+ 0)
{
}
@@ -326,8 +328,9 @@
{
}
+protected:
virtual bool
- Execute (Args& args, CommandReturnObject &result)
+ DoExecute (Args& args, CommandReturnObject &result)
{
if (args.GetArgumentCount() == 0)
{
@@ -356,15 +359,15 @@
// "target select"
//----------------------------------------------------------------------
-class CommandObjectTargetSelect : public CommandObject
+class CommandObjectTargetSelect : public CommandObjectParsed
{
public:
CommandObjectTargetSelect (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target select",
- "Select a target as the current target by target index.",
- NULL,
- 0)
+ CommandObjectParsed (interpreter,
+ "target select",
+ "Select a target as the current target by target index.",
+ NULL,
+ 0)
{
}
@@ -373,8 +376,9 @@
{
}
+protected:
virtual bool
- Execute (Args& args, CommandReturnObject &result)
+ DoExecute (Args& args, CommandReturnObject &result)
{
if (args.GetArgumentCount() == 1)
{
@@ -431,15 +435,15 @@
// "target delete"
//----------------------------------------------------------------------
-class CommandObjectTargetDelete : public CommandObject
+class CommandObjectTargetDelete : public CommandObjectParsed
{
public:
CommandObjectTargetDelete (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target delete",
- "Delete one or more targets by target index.",
- NULL,
- 0),
+ CommandObjectParsed (interpreter,
+ "target delete",
+ "Delete one or more targets by target index.",
+ NULL,
+ 0),
m_option_group (interpreter),
m_cleanup_option (LLDB_OPT_SET_1, false, "clean", 'c', 0, eArgTypeNone, "Perform extra cleanup to minimize memory consumption after deleting the target.", false)
{
@@ -452,8 +456,15 @@
{
}
+ Options *
+ GetOptions ()
+ {
+ return &m_option_group;
+ }
+
+protected:
virtual bool
- Execute (Args& args, CommandReturnObject &result)
+ DoExecute (Args& args, CommandReturnObject &result)
{
const size_t argc = args.GetArgumentCount();
std::vector<TargetSP> delete_target_list;
@@ -530,13 +541,6 @@
return result.Succeeded();
}
- Options *
- GetOptions ()
- {
- return &m_option_group;
- }
-
-protected:
OptionGroupOptions m_option_group;
OptionGroupBoolean m_cleanup_option;
};
@@ -548,15 +552,15 @@
// "target variable"
//----------------------------------------------------------------------
-class CommandObjectTargetVariable : public CommandObject
+class CommandObjectTargetVariable : public CommandObjectParsed
{
public:
CommandObjectTargetVariable (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target variable",
- "Read global variable(s) prior to running your binary.",
- NULL,
- 0),
+ CommandObjectParsed (interpreter,
+ "target variable",
+ "Read global variable(s) prior to running your binary.",
+ NULL,
+ 0),
m_option_group (interpreter),
m_option_variable (false), // Don't include frame options
m_option_format (eFormatDefault),
@@ -670,8 +674,15 @@
+ Options *
+ GetOptions ()
+ {
+ return &m_option_group;
+ }
+
+protected:
virtual bool
- Execute (Args& args, CommandReturnObject &result)
+ DoExecute (Args& args, CommandReturnObject &result)
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
Target *target = exe_ctx.GetTargetPtr();
@@ -811,13 +822,6 @@
return result.Succeeded();
}
- Options *
- GetOptions ()
- {
- return &m_option_group;
- }
-
-protected:
OptionGroupOptions m_option_group;
OptionGroupVariable m_option_variable;
OptionGroupFormat m_option_format;
@@ -830,15 +834,15 @@
#pragma mark CommandObjectTargetModulesSearchPathsAdd
-class CommandObjectTargetModulesSearchPathsAdd : public CommandObject
+class CommandObjectTargetModulesSearchPathsAdd : public CommandObjectParsed
{
public:
CommandObjectTargetModulesSearchPathsAdd (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target modules search-paths add",
- "Add new image search paths substitution pairs to the current target.",
- NULL)
+ CommandObjectParsed (interpreter,
+ "target modules search-paths add",
+ "Add new image search paths substitution pairs to the current target.",
+ NULL)
{
CommandArgumentEntry arg;
CommandArgumentData old_prefix_arg;
@@ -866,8 +870,9 @@
{
}
+protected:
bool
- Execute (Args& command,
+ DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@@ -916,15 +921,15 @@
#pragma mark CommandObjectTargetModulesSearchPathsClear
-class CommandObjectTargetModulesSearchPathsClear : public CommandObject
+class CommandObjectTargetModulesSearchPathsClear : public CommandObjectParsed
{
public:
CommandObjectTargetModulesSearchPathsClear (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target modules search-paths clear",
- "Clear all current image search path substitution pairs from the current target.",
- "target modules search-paths clear")
+ CommandObjectParsed (interpreter,
+ "target modules search-paths clear",
+ "Clear all current image search path substitution pairs from the current target.",
+ "target modules search-paths clear")
{
}
@@ -932,8 +937,9 @@
{
}
+protected:
bool
- Execute (Args& command,
+ DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@@ -954,15 +960,15 @@
#pragma mark CommandObjectTargetModulesSearchPathsInsert
-class CommandObjectTargetModulesSearchPathsInsert : public CommandObject
+class CommandObjectTargetModulesSearchPathsInsert : public CommandObjectParsed
{
public:
CommandObjectTargetModulesSearchPathsInsert (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target modules search-paths insert",
- "Insert a new image search path substitution pair into the current target at the specified index.",
- NULL)
+ CommandObjectParsed (interpreter,
+ "target modules search-paths insert",
+ "Insert a new image search path substitution pair into the current target at the specified index.",
+ NULL)
{
CommandArgumentEntry arg1;
CommandArgumentEntry arg2;
@@ -1001,8 +1007,9 @@
{
}
+protected:
bool
- Execute (Args& command,
+ DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@@ -1073,15 +1080,15 @@
#pragma mark CommandObjectTargetModulesSearchPathsList
-class CommandObjectTargetModulesSearchPathsList : public CommandObject
+class CommandObjectTargetModulesSearchPathsList : public CommandObjectParsed
{
public:
CommandObjectTargetModulesSearchPathsList (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target modules search-paths list",
- "List all current image search path substitution pairs in the current target.",
- "target modules search-paths list")
+ CommandObjectParsed (interpreter,
+ "target modules search-paths list",
+ "List all current image search path substitution pairs in the current target.",
+ "target modules search-paths list")
{
}
@@ -1089,8 +1096,9 @@
{
}
+protected:
bool
- Execute (Args& command,
+ DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@@ -1117,15 +1125,15 @@
#pragma mark CommandObjectTargetModulesSearchPathsQuery
-class CommandObjectTargetModulesSearchPathsQuery : public CommandObject
+class CommandObjectTargetModulesSearchPathsQuery : public CommandObjectParsed
{
public:
CommandObjectTargetModulesSearchPathsQuery (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target modules search-paths query",
- "Transform a path using the first applicable image search path.",
- NULL)
+ CommandObjectParsed (interpreter,
+ "target modules search-paths query",
+ "Transform a path using the first applicable image search path.",
+ NULL)
{
CommandArgumentEntry arg;
CommandArgumentData path_arg;
@@ -1145,8 +1153,9 @@
{
}
+protected:
bool
- Execute (Args& command,
+ DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@@ -1772,7 +1781,7 @@
// paths
//----------------------------------------------------------------------
-class CommandObjectTargetModulesModuleAutoComplete : public CommandObject
+class CommandObjectTargetModulesModuleAutoComplete : public CommandObjectParsed
{
public:
@@ -1780,7 +1789,7 @@
const char *name,
const char *help,
const char *syntax) :
- CommandObject (interpreter, name, help, syntax)
+ CommandObjectParsed (interpreter, name, help, syntax)
{
CommandArgumentEntry arg;
CommandArgumentData file_arg;
@@ -1834,7 +1843,7 @@
// file paths
//----------------------------------------------------------------------
-class CommandObjectTargetModulesSourceFileAutoComplete : public CommandObject
+class CommandObjectTargetModulesSourceFileAutoComplete : public CommandObjectParsed
{
public:
@@ -1842,7 +1851,7 @@
const char *name,
const char *help,
const char *syntax) :
- CommandObject (interpreter, name, help, syntax)
+ CommandObjectParsed (interpreter, name, help, syntax)
{
CommandArgumentEntry arg;
CommandArgumentData source_file_arg;
@@ -1910,8 +1919,71 @@
{
}
+ virtual Options *
+ GetOptions ()
+ {
+ return &m_options;
+ }
+
+ class CommandOptions : public Options
+ {
+ public:
+
+ CommandOptions (CommandInterpreter &interpreter) :
+ Options(interpreter),
+ m_sort_order (eSortOrderNone)
+ {
+ }
+
+ virtual
+ ~CommandOptions ()
+ {
+ }
+
+ virtual Error
+ SetOptionValue (uint32_t option_idx, const char *option_arg)
+ {
+ Error error;
+ char short_option = (char) m_getopt_table[option_idx].val;
+
+ switch (short_option)
+ {
+ case 's':
+ m_sort_order = (SortOrder) Args::StringToOptionEnum (option_arg,
+ g_option_table[option_idx].enum_values,
+ eSortOrderNone,
+ error);
+ break;
+
+ default:
+ error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
+ break;
+
+ }
+ return error;
+ }
+
+ void
+ OptionParsingStarting ()
+ {
+ m_sort_order = eSortOrderNone;
+ }
+
+ const OptionDefinition*
+ GetDefinitions ()
+ {
+ return g_option_table;
+ }
+
+ // Options table: Required for subclasses of Options.
+ static OptionDefinition g_option_table[];
+
+ SortOrder m_sort_order;
+ };
+
+protected:
virtual bool
- Execute (Args& command,
+ DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@@ -1999,69 +2071,6 @@
return result.Succeeded();
}
- virtual Options *
- GetOptions ()
- {
- return &m_options;
- }
-
- class CommandOptions : public Options
- {
- public:
-
- CommandOptions (CommandInterpreter &interpreter) :
- Options(interpreter),
- m_sort_order (eSortOrderNone)
- {
- }
-
- virtual
- ~CommandOptions ()
- {
- }
-
- virtual Error
- SetOptionValue (uint32_t option_idx, const char *option_arg)
- {
- Error error;
- char short_option = (char) m_getopt_table[option_idx].val;
-
- switch (short_option)
- {
- case 's':
- m_sort_order = (SortOrder) Args::StringToOptionEnum (option_arg,
- g_option_table[option_idx].enum_values,
- eSortOrderNone,
- error);
- break;
-
- default:
- error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
- break;
-
- }
- return error;
- }
-
- void
- OptionParsingStarting ()
- {
- m_sort_order = eSortOrderNone;
- }
-
- const OptionDefinition*
- GetDefinitions ()
- {
- return g_option_table;
- }
-
- // Options table: Required for subclasses of Options.
- static OptionDefinition g_option_table[];
-
- SortOrder m_sort_order;
- };
-
-protected:
CommandOptions m_options;
};
@@ -2106,8 +2115,9 @@
{
}
+protected:
virtual bool
- Execute (Args& command,
+ DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@@ -2211,8 +2221,9 @@
{
}
+protected:
virtual bool
- Execute (Args& command,
+ DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@@ -2312,8 +2323,9 @@
{
}
+protected:
virtual bool
- Execute (Args& command,
+ DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@@ -2412,14 +2424,14 @@
}
};
-class CommandObjectTargetModulesAdd : public CommandObject
+class CommandObjectTargetModulesAdd : public CommandObjectParsed
{
public:
CommandObjectTargetModulesAdd (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target modules add",
- "Add a new module to the current target's modules.",
- "target modules add [<module>]")
+ CommandObjectParsed (interpreter,
+ "target modules add",
+ "Add a new module to the current target's modules.",
+ "target modules add [<module>]")
{
}
@@ -2428,8 +2440,33 @@
{
}
+ int
+ HandleArgumentCompletion (Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ OptionElementVector &opt_element_vector,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches)
+ {
+ std::string completion_str (input.GetArgumentAtIndex(cursor_index));
+ completion_str.erase (cursor_char_position);
+
+ CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
+ CommandCompletions::eDiskFileCompletion,
+ completion_str.c_str(),
+ match_start_point,
+ max_return_elements,
+ NULL,
+ word_complete,
+ matches);
+ return matches.GetSize();
+ }
+
+protected:
virtual bool
- Execute (Args& args,
+ DoExecute (Args& args,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@@ -2490,30 +2527,6 @@
return result.Succeeded();
}
- int
- HandleArgumentCompletion (Args &input,
- int &cursor_index,
- int &cursor_char_position,
- OptionElementVector &opt_element_vector,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches)
- {
- std::string completion_str (input.GetArgumentAtIndex(cursor_index));
- completion_str.erase (cursor_char_position);
-
- CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
- CommandCompletions::eDiskFileCompletion,
- completion_str.c_str(),
- match_start_point,
- max_return_elements,
- NULL,
- word_complete,
- matches);
- return matches.GetSize();
- }
-
};
class CommandObjectTargetModulesLoad : public CommandObjectTargetModulesModuleAutoComplete
@@ -2539,8 +2552,15 @@
{
}
+ virtual Options *
+ GetOptions ()
+ {
+ return &m_option_group;
+ }
+
+protected:
virtual bool
- Execute (Args& args,
+ DoExecute (Args& args,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@@ -2733,13 +2753,6 @@
return result.Succeeded();
}
- virtual Options *
- GetOptions ()
- {
- return &m_option_group;
- }
-
-protected:
OptionGroupOptions m_option_group;
OptionGroupUUID m_uuid_option_group;
OptionGroupFile m_file_option;
@@ -2749,7 +2762,7 @@
//----------------------------------------------------------------------
// List images with associated information
//----------------------------------------------------------------------
-class CommandObjectTargetModulesList : public CommandObject
+class CommandObjectTargetModulesList : public CommandObjectParsed
{
public:
@@ -2825,10 +2838,10 @@
};
CommandObjectTargetModulesList (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target modules list",
- "List current executable and dependent shared library images.",
- "target modules list [<cmd-options>]"),
+ CommandObjectParsed (interpreter,
+ "target modules list",
+ "List current executable and dependent shared library images.",
+ "target modules list [<cmd-options>]"),
m_options (interpreter)
{
}
@@ -2845,8 +2858,9 @@
return &m_options;
}
+protected:
virtual bool
- Execute (Args& command,
+ DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@@ -2993,7 +3007,6 @@
}
return result.Succeeded();
}
-protected:
void
PrintModule (Target *target, Module *module, uint32_t idx, int indent, Stream &strm)
@@ -3183,7 +3196,7 @@
//----------------------------------------------------------------------
// Lookup information in images
//----------------------------------------------------------------------
-class CommandObjectTargetModulesLookup : public CommandObject
+class CommandObjectTargetModulesLookup : public CommandObjectParsed
{
public:
@@ -3328,11 +3341,11 @@
};
CommandObjectTargetModulesLookup (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target modules lookup",
- "Look up information within executable and dependent shared library images.",
- NULL),
- m_options (interpreter)
+ CommandObjectParsed (interpreter,
+ "target modules lookup",
+ "Look up information within executable and dependent shared library images.",
+ NULL),
+ m_options (interpreter)
{
CommandArgumentEntry arg;
CommandArgumentData file_arg;
@@ -3511,8 +3524,9 @@
return false;
}
+protected:
virtual bool
- Execute (Args& command,
+ DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@@ -3611,7 +3625,6 @@
}
return result.Succeeded();
}
-protected:
CommandOptions m_options;
};
@@ -3709,14 +3722,14 @@
-class CommandObjectTargetSymbolsAdd : public CommandObject
+class CommandObjectTargetSymbolsAdd : public CommandObjectParsed
{
public:
CommandObjectTargetSymbolsAdd (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target symbols add",
- "Add a debug symbol file to one of the target's current modules.",
- "target symbols add [<symfile>]")
+ CommandObjectParsed (interpreter,
+ "target symbols add",
+ "Add a debug symbol file to one of the target's current modules.",
+ "target symbols add [<symfile>]")
{
}
@@ -3725,8 +3738,33 @@
{
}
+ int
+ HandleArgumentCompletion (Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ OptionElementVector &opt_element_vector,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches)
+ {
+ std::string completion_str (input.GetArgumentAtIndex(cursor_index));
+ completion_str.erase (cursor_char_position);
+
+ CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
+ CommandCompletions::eDiskFileCompletion,
+ completion_str.c_str(),
+ match_start_point,
+ max_return_elements,
+ NULL,
+ word_complete,
+ matches);
+ return matches.GetSize();
+ }
+
+protected:
virtual bool
- Execute (Args& args,
+ DoExecute (Args& args,
CommandReturnObject &result)
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
@@ -3817,30 +3855,6 @@
return result.Succeeded();
}
- int
- HandleArgumentCompletion (Args &input,
- int &cursor_index,
- int &cursor_char_position,
- OptionElementVector &opt_element_vector,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches)
- {
- std::string completion_str (input.GetArgumentAtIndex(cursor_index));
- completion_str.erase (cursor_char_position);
-
- CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
- CommandCompletions::eDiskFileCompletion,
- completion_str.c_str(),
- match_start_point,
- max_return_elements,
- NULL,
- word_complete,
- matches);
- return matches.GetSize();
- }
-
};
@@ -3884,7 +3898,7 @@
// CommandObjectTargetStopHookAdd
//-------------------------------------------------------------------------
-class CommandObjectTargetStopHookAdd : public CommandObject
+class CommandObjectTargetStopHookAdd : public CommandObjectParsed
{
public:
@@ -4050,10 +4064,10 @@
}
CommandObjectTargetStopHookAdd (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target stop-hook add ",
- "Add a hook to be executed when the target stops.",
- "target stop-hook add"),
+ CommandObjectParsed (interpreter,
+ "target stop-hook add ",
+ "Add a hook to be executed when the target stops.",
+ "target stop-hook add"),
m_options (interpreter)
{
}
@@ -4149,9 +4163,9 @@
return bytes_len;
}
+protected:
bool
- Execute (Args& command,
- CommandReturnObject &result)
+ DoExecute (Args& command, CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
if (target)
@@ -4304,15 +4318,15 @@
// CommandObjectTargetStopHookDelete
//-------------------------------------------------------------------------
-class CommandObjectTargetStopHookDelete : public CommandObject
+class CommandObjectTargetStopHookDelete : public CommandObjectParsed
{
public:
CommandObjectTargetStopHookDelete (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target stop-hook delete",
- "Delete a stop-hook.",
- "target stop-hook delete [<idx>]")
+ CommandObjectParsed (interpreter,
+ "target stop-hook delete",
+ "Delete a stop-hook.",
+ "target stop-hook delete [<idx>]")
{
}
@@ -4320,9 +4334,9 @@
{
}
+protected:
bool
- Execute (Args& command,
- CommandReturnObject &result)
+ DoExecute (Args& command, CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
if (target)
@@ -4379,15 +4393,15 @@
// CommandObjectTargetStopHookEnableDisable
//-------------------------------------------------------------------------
-class CommandObjectTargetStopHookEnableDisable : public CommandObject
+class CommandObjectTargetStopHookEnableDisable : public CommandObjectParsed
{
public:
CommandObjectTargetStopHookEnableDisable (CommandInterpreter &interpreter, bool enable, const char *name, const char *help, const char *syntax) :
- CommandObject (interpreter,
- name,
- help,
- syntax),
+ CommandObjectParsed (interpreter,
+ name,
+ help,
+ syntax),
m_enable (enable)
{
}
@@ -4396,9 +4410,9 @@
{
}
+protected:
bool
- Execute (Args& command,
- CommandReturnObject &result)
+ DoExecute (Args& command, CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
if (target)
@@ -4450,15 +4464,15 @@
// CommandObjectTargetStopHookList
//-------------------------------------------------------------------------
-class CommandObjectTargetStopHookList : public CommandObject
+class CommandObjectTargetStopHookList : public CommandObjectParsed
{
public:
CommandObjectTargetStopHookList (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target stop-hook list",
- "List all stop-hooks.",
- "target stop-hook list [<type>]")
+ CommandObjectParsed (interpreter,
+ "target stop-hook list",
+ "List all stop-hooks.",
+ "target stop-hook list [<type>]")
{
}
@@ -4466,9 +4480,9 @@
{
}
+protected:
bool
- Execute (Args& command,
- CommandReturnObject &result)
+ DoExecute (Args& command, CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
if (!target)