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
This commit is contained in:
Jim Ingham 2012-06-08 21:56:10 +00:00
parent c5adccab1a
commit 5a98841673
47 changed files with 6026 additions and 6907 deletions

View File

@ -145,7 +145,7 @@ public:
IsMultiwordObject () { return false; }
virtual bool
WantsRawCommandString() { return false; }
WantsRawCommandString() = 0;
// By default, WantsCompletion = !WantsRawCommandString.
// Subclasses who want raw command string but desire, for example,
@ -198,22 +198,6 @@ public:
ParseOptions (Args& args,
CommandReturnObject &result);
bool
ExecuteWithOptions (Args& command,
CommandReturnObject &result);
virtual bool
ExecuteRawCommandString (const char *command,
CommandReturnObject &result)
{
return false;
}
virtual bool
Execute (Args& command,
CommandReturnObject &result) = 0;
void
SetCommandName (const char *name);
@ -337,7 +321,10 @@ public:
/// A reference to the Flags member variable.
//------------------------------------------------------------------
Flags&
GetFlags();
GetFlags()
{
return m_flags;
}
//------------------------------------------------------------------
/// The flags const accessor.
@ -346,7 +333,23 @@ public:
/// A const reference to the Flags member variable.
//------------------------------------------------------------------
const Flags&
GetFlags() const;
GetFlags() const
{
return m_flags;
}
//------------------------------------------------------------------
/// Check the command flags against the interpreter's current execution context.
///
/// @param[out] result
/// A command result object, if it is not okay to run the command this will be
/// filled in with a suitable error.
///
/// @return
/// \b true if it is okay to run this command, \b false otherwise.
//------------------------------------------------------------------
bool
CheckFlags (CommandReturnObject &result);
//------------------------------------------------------------------
/// Get the command that appropriate for a "repeat" of the current command.
@ -382,6 +385,9 @@ public:
m_command_override_callback = callback;
m_command_override_baton = baton;
}
virtual bool
Execute (const char *args_string, CommandReturnObject &result) = 0;
protected:
CommandInterpreter &m_interpreter;
@ -394,13 +400,66 @@ protected:
std::vector<CommandArgumentEntry> m_arguments;
CommandOverrideCallback m_command_override_callback;
void * m_command_override_baton;
// Helper function to populate IDs or ID ranges as the command argument data
// to the specified command argument entry.
static void
AddIDsArgumentData(CommandArgumentEntry &arg, lldb::CommandArgumentType ID, lldb::CommandArgumentType IDRange);
};
class CommandObjectParsed : public CommandObject
{
public:
CommandObjectParsed (CommandInterpreter &interpreter,
const char *name,
const char *help = NULL,
const char *syntax = NULL,
uint32_t flags = 0) :
CommandObject (interpreter, name, help, syntax, flags) {}
virtual
~CommandObjectParsed () {};
virtual bool
Execute (const char *args_string, CommandReturnObject &result);
protected:
virtual bool
DoExecute (Args& command,
CommandReturnObject &result) = 0;
virtual bool
WantsRawCommandString() { return false; };
};
class CommandObjectRaw : public CommandObject
{
public:
CommandObjectRaw (CommandInterpreter &interpreter,
const char *name,
const char *help = NULL,
const char *syntax = NULL,
uint32_t flags = 0) :
CommandObject (interpreter, name, help, syntax, flags) {}
virtual
~CommandObjectRaw () {};
virtual bool
Execute (const char *args_string, CommandReturnObject &result);
protected:
virtual bool
DoExecute (const char *command, CommandReturnObject &result) = 0;
virtual bool
WantsRawCommandString() { return true; };
};
} // namespace lldb_private

View File

@ -23,7 +23,7 @@ namespace lldb_private {
// CommandObjectCrossref
//-------------------------------------------------------------------------
class CommandObjectCrossref : public CommandObject
class CommandObjectCrossref : public CommandObjectParsed
{
public:
CommandObjectCrossref (CommandInterpreter &interpreter,
@ -37,10 +37,6 @@ public:
void
GenerateHelpText (CommandReturnObject &result);
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual bool
IsCrossRefObject ();
@ -50,6 +46,11 @@ public:
const char **
GetObjectTypes () const;
protected:
virtual bool
DoExecute (Args& command,
CommandReturnObject &result);
private:
Args m_crossref_object_types;
};

View File

@ -26,6 +26,9 @@ namespace lldb_private {
class CommandObjectMultiword : public CommandObject
{
// These two want to iterate over the subcommand dictionary.
friend class CommandInterpreter;
friend class CommandObjectSyntax;
public:
CommandObjectMultiword (CommandInterpreter &interpreter,
const char *name,
@ -53,8 +56,7 @@ public:
GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL);
virtual bool
Execute (Args& command,
CommandReturnObject &result);
WantsRawCommandString() { return false; };
virtual int
HandleCompletion (Args &input,
@ -67,6 +69,11 @@ public:
virtual const char *GetRepeatCommand (Args &current_command_args, uint32_t index);
virtual bool
Execute (const char *args_string,
CommandReturnObject &result);
protected:
CommandObject::CommandMap m_subcommand_dict;
};

View File

@ -25,7 +25,7 @@ namespace lldb_private {
// CommandObjectRegexCommand
//-------------------------------------------------------------------------
class CommandObjectRegexCommand : public CommandObject
class CommandObjectRegexCommand : public CommandObjectRaw
{
public:
@ -38,18 +38,6 @@ public:
virtual
~CommandObjectRegexCommand ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual bool
WantsRawCommandString() { return true; }
virtual bool
ExecuteRawCommandString (const char *command,
CommandReturnObject &result);
bool
AddRegexCommand (const char *re_cstr, const char *command_cstr);
@ -60,6 +48,9 @@ public:
}
protected:
virtual bool
DoExecute (const char *command, CommandReturnObject &result);
struct Entry
{
RegularExpression regex;

View File

@ -31,6 +31,9 @@ public:
bool
IsValid();
SBError
GetError();
watch_id_t
GetID ();

View File

@ -27,10 +27,10 @@ using namespace lldb_private;
//-------------------------------------------------------------------------
CommandObjectApropos::CommandObjectApropos (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"apropos",
"Find a list of debugger commands related to a particular word/subject.",
NULL)
CommandObjectParsed (interpreter,
"apropos",
"Find a list of debugger commands related to a particular word/subject.",
NULL)
{
CommandArgumentEntry arg;
CommandArgumentData search_word_arg;
@ -52,11 +52,7 @@ CommandObjectApropos::~CommandObjectApropos()
bool
CommandObjectApropos::Execute
(
Args& args,
CommandReturnObject &result
)
CommandObjectApropos::DoExecute (Args& args, CommandReturnObject &result)
{
const int argc = args.GetArgumentCount ();

View File

@ -22,7 +22,7 @@ namespace lldb_private {
// CommandObjectApropos
//-------------------------------------------------------------------------
class CommandObjectApropos : public CommandObject
class CommandObjectApropos : public CommandObjectParsed
{
public:
@ -31,8 +31,9 @@ public:
virtual
~CommandObjectApropos ();
protected:
virtual bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result);

View File

@ -77,10 +77,10 @@ CommandObjectArgs::CommandOptions::GetDefinitions ()
}
CommandObjectArgs::CommandObjectArgs (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"args",
"When stopped at the start of a function, reads function arguments of type (u?)int(8|16|32|64)_t, (void|char)*",
"args"),
CommandObjectParsed (interpreter,
"args",
"When stopped at the start of a function, reads function arguments of type (u?)int(8|16|32|64)_t, (void|char)*",
"args"),
m_options (interpreter)
{
}
@ -96,11 +96,7 @@ CommandObjectArgs::GetOptions ()
}
bool
CommandObjectArgs::Execute
(
Args& args,
CommandReturnObject &result
)
CommandObjectArgs::DoExecute (Args& args, CommandReturnObject &result)
{
ConstString target_triple;

View File

@ -20,7 +20,7 @@
namespace lldb_private {
class CommandObjectArgs : public CommandObject
class CommandObjectArgs : public CommandObjectParsed
{
public:
@ -57,16 +57,14 @@ namespace lldb_private {
GetOptions ();
virtual bool
Execute ( Args& command,
CommandReturnObject &result);
virtual bool
WantsRawCommandString() { return false; }
protected:
CommandOptions m_options;
virtual bool
DoExecute ( Args& command,
CommandReturnObject &result);
};
} // namespace lldb_private

File diff suppressed because it is too large Load Diff

View File

@ -42,326 +42,6 @@ public:
};
//-------------------------------------------------------------------------
// CommandObjectdBreakpointSet
//-------------------------------------------------------------------------
class CommandObjectBreakpointSet : public CommandObject
{
public:
typedef enum BreakpointSetType
{
eSetTypeInvalid,
eSetTypeFileAndLine,
eSetTypeAddress,
eSetTypeFunctionName,
eSetTypeFunctionRegexp,
eSetTypeSourceRegexp,
eSetTypeException
} BreakpointSetType;
CommandObjectBreakpointSet (CommandInterpreter &interpreter);
virtual
~CommandObjectBreakpointSet ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual Options *
GetOptions ();
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter);
virtual
~CommandOptions ();
virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg);
void
OptionParsingStarting ();
const OptionDefinition*
GetDefinitions ();
// Options table: Required for subclasses of Options.
static OptionDefinition g_option_table[];
// Instance variables to hold the values for command options.
std::string m_condition;
FileSpecList m_filenames;
uint32_t m_line_num;
uint32_t m_column;
bool m_check_inlines;
std::vector<std::string> m_func_names;
uint32_t m_func_name_type_mask;
std::string m_func_regexp;
std::string m_source_text_regexp;
FileSpecList m_modules;
lldb::addr_t m_load_addr;
uint32_t m_ignore_count;
lldb::tid_t m_thread_id;
uint32_t m_thread_index;
std::string m_thread_name;
std::string m_queue_name;
bool m_catch_bp;
bool m_throw_bp;
lldb::LanguageType m_language;
LazyBool m_skip_prologue;
};
private:
bool
GetDefaultFile (Target *target, FileSpec &file, CommandReturnObject &result);
CommandOptions m_options;
};
//-------------------------------------------------------------------------
// CommandObjectMultiwordBreakpointModify
//-------------------------------------------------------------------------
class CommandObjectBreakpointModify : public CommandObject
{
public:
CommandObjectBreakpointModify (CommandInterpreter &interpreter);
virtual
~CommandObjectBreakpointModify ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual Options *
GetOptions ();
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter);
virtual
~CommandOptions ();
virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg);
void
OptionParsingStarting ();
const OptionDefinition*
GetDefinitions ();
// Options table: Required for subclasses of Options.
static OptionDefinition g_option_table[];
// Instance variables to hold the values for command options.
uint32_t m_ignore_count;
lldb::tid_t m_thread_id;
bool m_thread_id_passed;
uint32_t m_thread_index;
bool m_thread_index_passed;
std::string m_thread_name;
std::string m_queue_name;
std::string m_condition;
bool m_enable_passed;
bool m_enable_value;
bool m_name_passed;
bool m_queue_passed;
bool m_condition_passed;
};
private:
CommandOptions m_options;
};
//-------------------------------------------------------------------------
// CommandObjectBreakpointEnable
//-------------------------------------------------------------------------
class CommandObjectBreakpointEnable : public CommandObject
{
public:
CommandObjectBreakpointEnable (CommandInterpreter &interpreter);
virtual
~CommandObjectBreakpointEnable ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
private:
};
//-------------------------------------------------------------------------
// CommandObjectBreakpointDisable
//-------------------------------------------------------------------------
class CommandObjectBreakpointDisable : public CommandObject
{
public:
CommandObjectBreakpointDisable (CommandInterpreter &interpreter);
virtual
~CommandObjectBreakpointDisable ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
private:
};
//-------------------------------------------------------------------------
// CommandObjectBreakpointList
//-------------------------------------------------------------------------
class CommandObjectBreakpointList : public CommandObject
{
public:
CommandObjectBreakpointList (CommandInterpreter &interpreter);
virtual
~CommandObjectBreakpointList ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual Options *
GetOptions ();
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter);
virtual
~CommandOptions ();
virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg);
void
OptionParsingStarting ();
const OptionDefinition *
GetDefinitions ();
// Options table: Required for subclasses of Options.
static OptionDefinition g_option_table[];
// Instance variables to hold the values for command options.
lldb::DescriptionLevel m_level;
bool m_internal;
};
private:
CommandOptions m_options;
};
//-------------------------------------------------------------------------
// CommandObjectBreakpointClear
//-------------------------------------------------------------------------
class CommandObjectBreakpointClear : public CommandObject
{
public:
typedef enum BreakpointClearType
{
eClearTypeInvalid,
eClearTypeFileAndLine
} BreakpointClearType;
CommandObjectBreakpointClear (CommandInterpreter &interpreter);
virtual
~CommandObjectBreakpointClear ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual Options *
GetOptions ();
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter);
virtual
~CommandOptions ();
virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg);
void
OptionParsingStarting ();
const OptionDefinition*
GetDefinitions ();
// Options table: Required for subclasses of Options.
static OptionDefinition g_option_table[];
// Instance variables to hold the values for command options.
std::string m_filename;
uint32_t m_line_num;
};
private:
CommandOptions m_options;
};
//-------------------------------------------------------------------------
// CommandObjectBreakpointDelete
//-------------------------------------------------------------------------
class CommandObjectBreakpointDelete : public CommandObject
{
public:
CommandObjectBreakpointDelete (CommandInterpreter &interpreter);
virtual
~CommandObjectBreakpointDelete ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
private:
};
} // namespace lldb_private
#endif // liblldb_CommandObjectBreakpoint_h_

File diff suppressed because it is too large Load Diff

View File

@ -39,136 +39,8 @@ public:
virtual
~CommandObjectBreakpointCommand ();
static bool
BreakpointOptionsCallbackFunction (void *baton,
StoppointCallbackContext *context,
lldb::user_id_t break_id,
lldb::user_id_t break_loc_id);
};
//-------------------------------------------------------------------------
// CommandObjectBreakpointCommandAdd
//-------------------------------------------------------------------------
class CommandObjectBreakpointCommandAdd : public CommandObject
{
public:
CommandObjectBreakpointCommandAdd (CommandInterpreter &interpreter);
virtual
~CommandObjectBreakpointCommandAdd ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual Options *
GetOptions ();
void
CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
CommandReturnObject &result);
/// Set a one-liner as the callback for the breakpoint.
void
SetBreakpointCommandCallback (BreakpointOptions *bp_options,
const char *oneliner);
static size_t
GenerateBreakpointCommandCallback (void *baton,
InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len);
static bool
BreakpointOptionsCallbackFunction (void *baton,
StoppointCallbackContext *context,
lldb::user_id_t break_id,
lldb::user_id_t break_loc_id);
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter);
virtual
~CommandOptions ();
virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg);
void
OptionParsingStarting ();
const OptionDefinition*
GetDefinitions ();
// Options table: Required for subclasses of Options.
static OptionDefinition g_option_table[];
// Instance variables to hold the values for command options.
bool m_use_commands;
bool m_use_script_language;
lldb::ScriptLanguage m_script_language;
// Instance variables to hold the values for one_liner options.
bool m_use_one_liner;
std::string m_one_liner;
bool m_stop_on_error;
std::string m_function_name;
};
private:
CommandOptions m_options;
};
//-------------------------------------------------------------------------
// CommandObjectBreakpointCommandDelete
//-------------------------------------------------------------------------
class CommandObjectBreakpointCommandDelete : public CommandObject
{
public:
CommandObjectBreakpointCommandDelete (CommandInterpreter &interpreter);
virtual
~CommandObjectBreakpointCommandDelete ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
private:
};
//-------------------------------------------------------------------------
// CommandObjectBreakpointCommandList
//-------------------------------------------------------------------------
class CommandObjectBreakpointCommandList : public CommandObject
{
public:
CommandObjectBreakpointCommandList (CommandInterpreter &interpreter);
virtual
~CommandObjectBreakpointCommandList ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
private:
};
} // namespace lldb_private
#endif // liblldb_CommandObjectBreakpointCommand_h_

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@ CommandObjectCrossref::CommandObjectCrossref
const char *help,
const char *syntax
) :
CommandObject (interpreter, name, help, syntax),
CommandObjectParsed (interpreter, name, help, syntax),
m_crossref_object_types()
{
}
@ -39,11 +39,7 @@ CommandObjectCrossref::~CommandObjectCrossref ()
}
bool
CommandObjectCrossref::Execute
(
Args& command,
CommandReturnObject &result
)
CommandObjectCrossref::DoExecute (Args& command, CommandReturnObject &result)
{
if (m_crossref_object_types.GetArgumentCount() == 0)
{

View File

@ -210,10 +210,10 @@ CommandObjectDisassemble::CommandOptions::g_option_table[] =
//-------------------------------------------------------------------------
CommandObjectDisassemble::CommandObjectDisassemble (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"disassemble",
"Disassemble bytes in the current function, or elsewhere in the executable program as specified by the user.",
"disassemble [<cmd-options>]"),
CommandObjectParsed (interpreter,
"disassemble",
"Disassemble bytes in the current function, or elsewhere in the executable program as specified by the user.",
"disassemble [<cmd-options>]"),
m_options (interpreter)
{
}
@ -223,11 +223,7 @@ CommandObjectDisassemble::~CommandObjectDisassemble()
}
bool
CommandObjectDisassemble::Execute
(
Args& command,
CommandReturnObject &result
)
CommandObjectDisassemble::DoExecute (Args& command, CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
if (target == NULL)

View File

@ -23,7 +23,7 @@ namespace lldb_private {
// CommandObjectDisassemble
//-------------------------------------------------------------------------
class CommandObjectDisassemble : public CommandObject
class CommandObjectDisassemble : public CommandObjectParsed
{
public:
class CommandOptions : public Options
@ -85,11 +85,11 @@ public:
return &m_options;
}
protected:
virtual bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result);
protected:
CommandOptions m_options;
};

View File

@ -134,10 +134,11 @@ CommandObjectExpression::CommandOptions::GetDefinitions ()
}
CommandObjectExpression::CommandObjectExpression (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"expression",
"Evaluate a C/ObjC/C++ expression in the current program context, using variables currently in scope.",
NULL),
CommandObjectRaw (interpreter,
"expression",
"Evaluate a C/ObjC/C++ expression in the current program context, using variables currently in scope.",
NULL,
eFlagProcessMustBePaused),
m_option_group (interpreter),
m_format_options (eFormatDefault),
m_command_options (),
@ -180,18 +181,6 @@ CommandObjectExpression::GetOptions ()
return &m_option_group;
}
bool
CommandObjectExpression::Execute
(
Args& command,
CommandReturnObject &result
)
{
return false;
}
size_t
CommandObjectExpression::MultiLineExpressionCallback
(
@ -418,7 +407,7 @@ CommandObjectExpression::EvaluateExpression
}
bool
CommandObjectExpression::ExecuteRawCommandString
CommandObjectExpression::DoExecute
(
const char *command,
CommandReturnObject &result

View File

@ -20,7 +20,7 @@
namespace lldb_private {
class CommandObjectExpression : public CommandObject
class CommandObjectExpression : public CommandObjectRaw
{
public:
@ -66,19 +66,10 @@ public:
Options *
GetOptions ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual bool
WantsRawCommandString() { return true; }
virtual bool
ExecuteRawCommandString (const char *command,
CommandReturnObject &result);
protected:
virtual bool
DoExecute (const char *command,
CommandReturnObject &result);
static size_t
MultiLineExpressionCallback (void *baton,

View File

@ -52,16 +52,16 @@ using namespace lldb_private;
// CommandObjectFrameInfo
//-------------------------------------------------------------------------
class CommandObjectFrameInfo : public CommandObject
class CommandObjectFrameInfo : public CommandObjectParsed
{
public:
CommandObjectFrameInfo (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"frame info",
"List information about the currently selected frame in the current thread.",
"frame info",
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
CommandObjectParsed (interpreter,
"frame info",
"List information about the currently selected frame in the current thread.",
"frame info",
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
{
}
@ -69,8 +69,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
@ -95,7 +96,7 @@ public:
// CommandObjectFrameSelect
//-------------------------------------------------------------------------
class CommandObjectFrameSelect : public CommandObject
class CommandObjectFrameSelect : public CommandObjectParsed
{
public:
@ -155,11 +156,11 @@ public:
};
CommandObjectFrameSelect (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"frame select",
"Select a frame by index from within the current thread and make it the current frame.",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
CommandObjectParsed (interpreter,
"frame select",
"Select a frame by index from within the current thread and make it the current frame.",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
m_options (interpreter)
{
CommandArgumentEntry arg;
@ -188,8 +189,9 @@ public:
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
@ -319,21 +321,21 @@ CommandObjectFrameSelect::CommandOptions::g_option_table[] =
//----------------------------------------------------------------------
// List images with associated information
//----------------------------------------------------------------------
class CommandObjectFrameVariable : public CommandObject
class CommandObjectFrameVariable : public CommandObjectParsed
{
public:
CommandObjectFrameVariable (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"frame variable",
"Show frame variables. All argument and local variables "
"that are in scope will be shown when no arguments are given. "
"If any arguments are specified, they can be names of "
"argument, local, file static and file global variables. "
"Children of aggregate variables can be specified such as "
"'var->child.x'.",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
CommandObjectParsed (interpreter,
"frame variable",
"Show frame variables. All argument and local variables "
"that are in scope will be shown when no arguments are given. "
"If any arguments are specified, they can be names of "
"argument, local, file static and file global variables. "
"Children of aggregate variables can be specified such as "
"'var->child.x'.",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
m_option_group (interpreter),
m_option_variable(true), // Include the frame specific options by passing "true"
m_option_format (eFormatDefault),
@ -370,13 +372,9 @@ public:
return &m_option_group;
}
protected:
virtual bool
Execute
(
Args& command,
CommandReturnObject &result
)
DoExecute (Args& command, CommandReturnObject &result)
{
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
StackFrame *frame = exe_ctx.GetFramePtr();

View File

@ -26,10 +26,10 @@ using namespace lldb_private;
//-------------------------------------------------------------------------
CommandObjectHelp::CommandObjectHelp (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"help",
"Show a list of all debugger commands, or give details about specific commands.",
"help [<cmd-name>]"), m_options (interpreter)
CommandObjectParsed (interpreter,
"help",
"Show a list of all debugger commands, or give details about specific commands.",
"help [<cmd-name>]"), m_options (interpreter)
{
CommandArgumentEntry arg;
CommandArgumentData command_arg;
@ -58,7 +58,7 @@ CommandObjectHelp::CommandOptions::g_option_table[] =
};
bool
CommandObjectHelp::Execute (Args& command, CommandReturnObject &result)
CommandObjectHelp::DoExecute (Args& command, CommandReturnObject &result)
{
CommandObject::CommandMap::iterator pos;
CommandObject *cmd_obj;

View File

@ -23,7 +23,7 @@ namespace lldb_private {
// CommandObjectHelp
//-------------------------------------------------------------------------
class CommandObjectHelp : public CommandObject
class CommandObjectHelp : public CommandObjectParsed
{
public:
@ -32,10 +32,6 @@ public:
virtual
~CommandObjectHelp ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual int
HandleCompletion (Args &input,
int &cursor_index,
@ -102,14 +98,20 @@ public:
bool m_show_user_defined;
};
CommandOptions m_options;
virtual Options *
GetOptions ()
{
return &m_options;
}
protected:
virtual bool
DoExecute (Args& command,
CommandReturnObject &result);
private:
CommandOptions m_options;
};
} // namespace lldb_private

View File

@ -42,17 +42,17 @@ using namespace lldb;
using namespace lldb_private;
class CommandObjectLogEnable : public CommandObject
class CommandObjectLogEnable : public CommandObjectParsed
{
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
CommandObjectLogEnable(CommandInterpreter &interpreter) :
CommandObject (interpreter,
"log enable",
"Enable logging for a single log channel.",
NULL),
CommandObjectParsed (interpreter,
"log enable",
"Enable logging for a single log channel.",
NULL),
m_options (interpreter)
{
@ -110,31 +110,6 @@ public:
// return matches.GetSize();
// }
//
virtual bool
Execute (Args& args,
CommandReturnObject &result)
{
if (args.GetArgumentCount() < 2)
{
result.AppendErrorWithFormat("%s takes a log channel and one or more log types.\n", m_cmd_name.c_str());
}
else
{
std::string channel(args.GetArgumentAtIndex(0));
args.Shift (); // Shift off the channel
bool success = m_interpreter.GetDebugger().EnableLog (channel.c_str(),
args.GetConstArgumentVector(),
m_options.log_file.c_str(),
m_options.log_options,
result.GetErrorStream());
if (success)
result.SetStatus (eReturnStatusSuccessFinishNoResult);
else
result.SetStatus (eReturnStatusFailed);
}
return result.Succeeded();
}
class CommandOptions : public Options
{
@ -201,6 +176,31 @@ public:
};
protected:
virtual bool
DoExecute (Args& args,
CommandReturnObject &result)
{
if (args.GetArgumentCount() < 2)
{
result.AppendErrorWithFormat("%s takes a log channel and one or more log types.\n", m_cmd_name.c_str());
}
else
{
std::string channel(args.GetArgumentAtIndex(0));
args.Shift (); // Shift off the channel
bool success = m_interpreter.GetDebugger().EnableLog (channel.c_str(),
args.GetConstArgumentVector(),
m_options.log_file.c_str(),
m_options.log_options,
result.GetErrorStream());
if (success)
result.SetStatus (eReturnStatusSuccessFinishNoResult);
else
result.SetStatus (eReturnStatusFailed);
}
return result.Succeeded();
}
CommandOptions m_options;
};
@ -218,17 +218,17 @@ CommandObjectLogEnable::CommandOptions::g_option_table[] =
{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
class CommandObjectLogDisable : public CommandObject
class CommandObjectLogDisable : public CommandObjectParsed
{
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
CommandObjectLogDisable(CommandInterpreter &interpreter) :
CommandObject (interpreter,
"log disable",
"Disable one or more log channel categories.",
NULL)
CommandObjectParsed (interpreter,
"log disable",
"Disable one or more log channel categories.",
NULL)
{
CommandArgumentEntry arg1;
CommandArgumentEntry arg2;
@ -257,8 +257,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& args,
DoExecute (Args& args,
CommandReturnObject &result)
{
const size_t argc = args.GetArgumentCount();
@ -297,17 +298,17 @@ public:
}
};
class CommandObjectLogList : public CommandObject
class CommandObjectLogList : public CommandObjectParsed
{
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
CommandObjectLogList(CommandInterpreter &interpreter) :
CommandObject (interpreter,
"log list",
"List the log categories for one or more log channels. If none specified, lists them all.",
NULL)
CommandObjectParsed (interpreter,
"log list",
"List the log categories for one or more log channels. If none specified, lists them all.",
NULL)
{
CommandArgumentEntry arg;
CommandArgumentData channel_arg;
@ -328,8 +329,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& args,
DoExecute (Args& args,
CommandReturnObject &result)
{
const size_t argc = args.GetArgumentCount();
@ -372,17 +374,17 @@ public:
}
};
class CommandObjectLogTimer : public CommandObject
class CommandObjectLogTimer : public CommandObjectParsed
{
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
CommandObjectLogTimer(CommandInterpreter &interpreter) :
CommandObject (interpreter,
"log timers",
"Enable, disable, dump, and reset LLDB internal performance timers.",
"log timers < enable <depth> | disable | dump | increment <bool> | reset >")
CommandObjectParsed (interpreter,
"log timers",
"Enable, disable, dump, and reset LLDB internal performance timers.",
"log timers < enable <depth> | disable | dump | increment <bool> | reset >")
{
}
@ -391,8 +393,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& args,
DoExecute (Args& args,
CommandReturnObject &result)
{
const size_t argc = args.GetArgumentCount();

View File

@ -283,16 +283,16 @@ public:
//----------------------------------------------------------------------
// 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 @@ public:
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 @@ public:
return true;
}
protected:
OptionGroupOptions m_option_group;
OptionGroupFormat m_format_options;
OptionGroupReadMemory m_memory_options;
@ -789,7 +789,7 @@ g_memory_write_option_table[] =
//----------------------------------------------------------------------
// Write memory to the inferior process
//----------------------------------------------------------------------
class CommandObjectMemoryWrite : public CommandObject
class CommandObjectMemoryWrite : public CommandObjectParsed
{
public:
@ -867,12 +867,11 @@ public:
};
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 @@ public:
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 @@ public:
return true;
}
protected:
OptionGroupOptions m_option_group;
OptionGroupFormat m_format_options;
OptionGroupWriteMemory m_memory_options;

View File

@ -107,12 +107,9 @@ CommandObjectMultiword::LoadSubCommand
}
bool
CommandObjectMultiword::Execute
(
Args& args,
CommandReturnObject &result
)
CommandObjectMultiword::Execute(const char *args_string, CommandReturnObject &result)
{
Args args (args_string);
const size_t argc = args.GetArgumentCount();
if (argc == 0)
{
@ -139,7 +136,7 @@ CommandObjectMultiword::Execute
args.Shift();
sub_cmd_obj->ExecuteWithOptions (args, result);
sub_cmd_obj->Execute (args_string, result);
}
else
{

View File

@ -31,15 +31,15 @@ using namespace lldb_private;
//----------------------------------------------------------------------
// "platform select <platform-name>"
//----------------------------------------------------------------------
class CommandObjectPlatformSelect : public CommandObject
class CommandObjectPlatformSelect : public CommandObjectParsed
{
public:
CommandObjectPlatformSelect (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"platform select",
"Create a platform if needed and select it as the current platform.",
"platform select <platform-name>",
0),
CommandObjectParsed (interpreter,
"platform select",
"Create a platform if needed and select it as the current platform.",
"platform select <platform-name>",
0),
m_option_group (interpreter),
m_platform_options (false) // Don't include the "--platform" option by passing false
{
@ -52,8 +52,37 @@ public:
{
}
virtual int
HandleCompletion (Args &input,
int &cursor_index,
int &cursor_char_position,
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::PlatformPluginNames (m_interpreter,
completion_str.c_str(),
match_start_point,
max_return_elements,
NULL,
word_complete,
matches);
return matches.GetSize();
}
virtual Options *
GetOptions ()
{
return &m_option_group;
}
protected:
virtual bool
Execute (Args& args, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
if (args.GetArgumentCount() == 1)
{
@ -89,37 +118,7 @@ public:
}
return result.Succeeded();
}
virtual int
HandleCompletion (Args &input,
int &cursor_index,
int &cursor_char_position,
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::PlatformPluginNames (m_interpreter,
completion_str.c_str(),
match_start_point,
max_return_elements,
NULL,
word_complete,
matches);
return matches.GetSize();
}
virtual Options *
GetOptions ()
{
return &m_option_group;
}
protected:
OptionGroupOptions m_option_group;
OptionGroupPlatform m_platform_options;
};
@ -127,15 +126,15 @@ protected:
//----------------------------------------------------------------------
// "platform list"
//----------------------------------------------------------------------
class CommandObjectPlatformList : public CommandObject
class CommandObjectPlatformList : public CommandObjectParsed
{
public:
CommandObjectPlatformList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"platform list",
"List all platforms that are available.",
NULL,
0)
CommandObjectParsed (interpreter,
"platform list",
"List all platforms that are available.",
NULL,
0)
{
}
@ -144,8 +143,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& args, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
Stream &ostrm = result.GetOutputStream();
ostrm.Printf("Available platforms:\n");
@ -181,15 +181,15 @@ public:
//----------------------------------------------------------------------
// "platform status"
//----------------------------------------------------------------------
class CommandObjectPlatformStatus : public CommandObject
class CommandObjectPlatformStatus : public CommandObjectParsed
{
public:
CommandObjectPlatformStatus (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"platform status",
"Display status for the currently selected platform.",
NULL,
0)
CommandObjectParsed (interpreter,
"platform status",
"Display status for the currently selected platform.",
NULL,
0)
{
}
@ -198,8 +198,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& args, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
Stream &ostrm = result.GetOutputStream();
@ -221,15 +222,15 @@ public:
//----------------------------------------------------------------------
// "platform connect <connect-url>"
//----------------------------------------------------------------------
class CommandObjectPlatformConnect : public CommandObject
class CommandObjectPlatformConnect : public CommandObjectParsed
{
public:
CommandObjectPlatformConnect (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"platform connect",
"Connect a platform by name to be the currently selected platform.",
"platform connect <connect-url>",
0)
CommandObjectParsed (interpreter,
"platform connect",
"Connect a platform by name to be the currently selected platform.",
"platform connect <connect-url>",
0)
{
}
@ -238,8 +239,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& args, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
Stream &ostrm = result.GetOutputStream();
@ -270,15 +272,15 @@ public:
//----------------------------------------------------------------------
// "platform disconnect"
//----------------------------------------------------------------------
class CommandObjectPlatformDisconnect : public CommandObject
class CommandObjectPlatformDisconnect : public CommandObjectParsed
{
public:
CommandObjectPlatformDisconnect (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"platform disconnect",
"Disconnect a platform by name to be the currently selected platform.",
"platform disconnect",
0)
CommandObjectParsed (interpreter,
"platform disconnect",
"Disconnect a platform by name to be the currently selected platform.",
"platform disconnect",
0)
{
}
@ -287,8 +289,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& args, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
if (platform_sp)
@ -347,15 +350,15 @@ public:
//----------------------------------------------------------------------
// "platform process launch"
//----------------------------------------------------------------------
class CommandObjectPlatformProcessLaunch : public CommandObject
class CommandObjectPlatformProcessLaunch : public CommandObjectParsed
{
public:
CommandObjectPlatformProcessLaunch (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"platform process launch",
"Launch a new process on a remote platform.",
"platform process launch program",
0),
CommandObjectParsed (interpreter,
"platform process launch",
"Launch a new process on a remote platform.",
"platform process launch program",
0),
m_options (interpreter)
{
}
@ -365,8 +368,15 @@ public:
{
}
virtual Options *
GetOptions ()
{
return &m_options;
}
protected:
virtual bool
Execute (Args& args, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
@ -453,12 +463,6 @@ public:
return result.Succeeded();
}
virtual Options *
GetOptions ()
{
return &m_options;
}
protected:
ProcessLaunchCommandOptions m_options;
};
@ -468,15 +472,15 @@ protected:
//----------------------------------------------------------------------
// "platform process list"
//----------------------------------------------------------------------
class CommandObjectPlatformProcessList : public CommandObject
class CommandObjectPlatformProcessList : public CommandObjectParsed
{
public:
CommandObjectPlatformProcessList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"platform process list",
"List processes on a remote platform by name, pid, or many other matching attributes.",
"platform process list",
0),
CommandObjectParsed (interpreter,
"platform process list",
"List processes on a remote platform by name, pid, or many other matching attributes.",
"platform process list",
0),
m_options (interpreter)
{
}
@ -486,8 +490,15 @@ public:
{
}
virtual Options *
GetOptions ()
{
return &m_options;
}
protected:
virtual bool
Execute (Args& args, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
@ -581,14 +592,6 @@ public:
return result.Succeeded();
}
virtual Options *
GetOptions ()
{
return &m_options;
}
protected:
class CommandOptions : public Options
{
public:
@ -744,15 +747,15 @@ CommandObjectPlatformProcessList::CommandOptions::g_option_table[] =
//----------------------------------------------------------------------
// "platform process info"
//----------------------------------------------------------------------
class CommandObjectPlatformProcessInfo : public CommandObject
class CommandObjectPlatformProcessInfo : public CommandObjectParsed
{
public:
CommandObjectPlatformProcessInfo (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"platform process info",
"Get detailed information for one or more process by process ID.",
"platform process info <pid> [<pid> <pid> ...]",
0)
CommandObjectParsed (interpreter,
"platform process info",
"Get detailed information for one or more process by process ID.",
"platform process info <pid> [<pid> <pid> ...]",
0)
{
CommandArgumentEntry arg;
CommandArgumentData pid_args;
@ -773,8 +776,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& args, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
if (platform_sp)
@ -872,15 +876,15 @@ private:
};
class CommandObjectPlatformShell : public CommandObject
class CommandObjectPlatformShell : public CommandObjectRaw
{
public:
CommandObjectPlatformShell (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"platform shell",
"Run a shell command on a the selected platform.",
"platform shell <shell-command>",
0)
CommandObjectRaw (interpreter,
"platform shell",
"Run a shell command on a the selected platform.",
"platform shell <shell-command>",
0)
{
}
@ -889,18 +893,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& command,
CommandReturnObject &result)
{
return false;
}
virtual bool
WantsRawCommandString() { return true; }
bool
ExecuteRawCommandString (const char *raw_command_line, CommandReturnObject &result)
DoExecute (const char *raw_command_line, CommandReturnObject &result)
{
// TODO: Implement "Platform::RunShellCommand()" and switch over to using
// the current platform when it is in the interface.
@ -936,8 +931,6 @@ public:
}
return true;
}
protected:
};
//----------------------------------------------------------------------

View File

@ -31,15 +31,15 @@ using namespace lldb_private;
// CommandObjectProcessLaunch
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessLaunch
class CommandObjectProcessLaunch : public CommandObject
class CommandObjectProcessLaunch : public CommandObjectParsed
{
public:
CommandObjectProcessLaunch (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"process launch",
"Launch the executable in the debugger.",
NULL),
CommandObjectParsed (interpreter,
"process launch",
"Launch the executable in the debugger.",
NULL),
m_options (interpreter)
{
CommandArgumentEntry arg;
@ -67,8 +67,15 @@ public:
return &m_options;
}
virtual const char *GetRepeatCommand (Args &current_command_args, uint32_t index)
{
// No repeat for "process launch"...
return "";
}
protected:
bool
Execute (Args& launch_args, CommandReturnObject &result)
DoExecute (Args& launch_args, CommandReturnObject &result)
{
Debugger &debugger = m_interpreter.GetDebugger();
Target *target = debugger.GetSelectedTarget().get();
@ -256,12 +263,6 @@ public:
return result.Succeeded();
}
virtual const char *GetRepeatCommand (Args &current_command_args, uint32_t index)
{
// No repeat for "process launch"...
return "";
}
protected:
ProcessLaunchCommandOptions m_options;
};
@ -293,7 +294,7 @@ protected:
// CommandObjectProcessAttach
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessAttach
class CommandObjectProcessAttach : public CommandObject
class CommandObjectProcessAttach : public CommandObjectParsed
{
public:
@ -432,10 +433,10 @@ public:
};
CommandObjectProcessAttach (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"process attach",
"Attach to a process.",
"process attach <cmd-options>"),
CommandObjectParsed (interpreter,
"process attach",
"Attach to a process.",
"process attach <cmd-options>"),
m_options (interpreter)
{
}
@ -444,8 +445,15 @@ public:
{
}
Options *
GetOptions ()
{
return &m_options;
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@ -603,14 +611,6 @@ public:
return result.Succeeded();
}
Options *
GetOptions ()
{
return &m_options;
}
protected:
CommandOptions m_options;
};
@ -631,16 +631,16 @@ CommandObjectProcessAttach::CommandOptions::g_option_table[] =
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessContinue
class CommandObjectProcessContinue : public CommandObject
class CommandObjectProcessContinue : public CommandObjectParsed
{
public:
CommandObjectProcessContinue (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"process continue",
"Continue execution of all threads in the current process.",
"process continue",
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
CommandObjectParsed (interpreter,
"process continue",
"Continue execution of all threads in the current process.",
"process continue",
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
{
}
@ -649,8 +649,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
@ -719,16 +720,16 @@ public:
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessDetach
class CommandObjectProcessDetach : public CommandObject
class CommandObjectProcessDetach : public CommandObjectParsed
{
public:
CommandObjectProcessDetach (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"process detach",
"Detach from the current process being debugged.",
"process detach",
eFlagProcessMustBeLaunched)
CommandObjectParsed (interpreter,
"process detach",
"Detach from the current process being debugged.",
"process detach",
eFlagProcessMustBeLaunched)
{
}
@ -736,8 +737,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
@ -769,7 +771,7 @@ public:
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessConnect
class CommandObjectProcessConnect : public CommandObject
class CommandObjectProcessConnect : public CommandObjectParsed
{
public:
@ -829,11 +831,11 @@ public:
};
CommandObjectProcessConnect (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"process connect",
"Connect to a remote debug service.",
"process connect <remote-url>",
0),
CommandObjectParsed (interpreter,
"process connect",
"Connect to a remote debug service.",
"process connect <remote-url>",
0),
m_options (interpreter)
{
}
@ -843,8 +845,15 @@ public:
}
Options *
GetOptions ()
{
return &m_options;
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
@ -919,14 +928,6 @@ public:
}
return result.Succeeded();
}
Options *
GetOptions ()
{
return &m_options;
}
protected:
CommandOptions m_options;
};
@ -944,16 +945,16 @@ CommandObjectProcessConnect::CommandOptions::g_option_table[] =
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessLoad
class CommandObjectProcessLoad : public CommandObject
class CommandObjectProcessLoad : public CommandObjectParsed
{
public:
CommandObjectProcessLoad (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"process load",
"Load a shared library into the current process.",
"process load <filename> [<filename> ...]",
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
CommandObjectParsed (interpreter,
"process load",
"Load a shared library into the current process.",
"process load <filename> [<filename> ...]",
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
{
}
@ -961,8 +962,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
@ -1003,16 +1005,16 @@ public:
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessUnload
class CommandObjectProcessUnload : public CommandObject
class CommandObjectProcessUnload : public CommandObjectParsed
{
public:
CommandObjectProcessUnload (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"process unload",
"Unload a shared library from the current process using the index returned by a previous call to \"process load\".",
"process unload <index>",
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
CommandObjectParsed (interpreter,
"process unload",
"Unload a shared library from the current process using the index returned by a previous call to \"process load\".",
"process unload <index>",
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
{
}
@ -1020,8 +1022,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
@ -1069,15 +1072,15 @@ public:
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessSignal
class CommandObjectProcessSignal : public CommandObject
class CommandObjectProcessSignal : public CommandObjectParsed
{
public:
CommandObjectProcessSignal (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"process signal",
"Send a UNIX signal to the current process being debugged.",
NULL)
CommandObjectParsed (interpreter,
"process signal",
"Send a UNIX signal to the current process being debugged.",
NULL)
{
CommandArgumentEntry arg;
CommandArgumentData signal_arg;
@ -1097,8 +1100,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
@ -1154,17 +1158,17 @@ public:
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessInterrupt
class CommandObjectProcessInterrupt : public CommandObject
class CommandObjectProcessInterrupt : public CommandObjectParsed
{
public:
CommandObjectProcessInterrupt (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"process interrupt",
"Interrupt the current process being debugged.",
"process interrupt",
eFlagProcessMustBeLaunched)
CommandObjectParsed (interpreter,
"process interrupt",
"Interrupt the current process being debugged.",
"process interrupt",
eFlagProcessMustBeLaunched)
{
}
@ -1172,8 +1176,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
@ -1217,16 +1222,16 @@ public:
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessKill
class CommandObjectProcessKill : public CommandObject
class CommandObjectProcessKill : public CommandObjectParsed
{
public:
CommandObjectProcessKill (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"process kill",
"Terminate the current process being debugged.",
"process kill",
eFlagProcessMustBeLaunched)
CommandObjectParsed (interpreter,
"process kill",
"Terminate the current process being debugged.",
"process kill",
eFlagProcessMustBeLaunched)
{
}
@ -1234,8 +1239,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
@ -1275,15 +1281,15 @@ public:
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessStatus
class CommandObjectProcessStatus : public CommandObject
class CommandObjectProcessStatus : public CommandObjectParsed
{
public:
CommandObjectProcessStatus (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"process status",
"Show the current status and location of executing process.",
"process status",
0)
CommandObjectParsed (interpreter,
"process status",
"Show the current status and location of executing process.",
"process status",
0)
{
}
@ -1293,11 +1299,7 @@ public:
bool
Execute
(
Args& command,
CommandReturnObject &result
)
DoExecute (Args& command, CommandReturnObject &result)
{
Stream &strm = result.GetOutputStream();
result.SetStatus (eReturnStatusSuccessFinishNoResult);
@ -1331,7 +1333,7 @@ public:
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessHandle
class CommandObjectProcessHandle : public CommandObject
class CommandObjectProcessHandle : public CommandObjectParsed
{
public:
@ -1400,10 +1402,10 @@ public:
CommandObjectProcessHandle (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"process handle",
"Show or update what the process and debugger should do with various signals received from the OS.",
NULL),
CommandObjectParsed (interpreter,
"process handle",
"Show or update what the process and debugger should do with various signals received from the OS.",
NULL),
m_options (interpreter)
{
SetHelpLong ("If no signals are specified, update them all. If no update option is specified, list the current values.\n");
@ -1503,8 +1505,9 @@ public:
}
}
protected:
bool
Execute (Args &signal_args, CommandReturnObject &result)
DoExecute (Args &signal_args, CommandReturnObject &result)
{
TargetSP target_sp = m_interpreter.GetDebugger().GetSelectedTarget();
@ -1618,8 +1621,6 @@ public:
return result.Succeeded();
}
protected:
CommandOptions m_options;
};

View File

@ -24,7 +24,7 @@ using namespace lldb_private;
//-------------------------------------------------------------------------
CommandObjectQuit::CommandObjectQuit (CommandInterpreter &interpreter) :
CommandObject (interpreter, "quit", "Quit out of the LLDB debugger.", "quit")
CommandObjectParsed (interpreter, "quit", "Quit out of the LLDB debugger.", "quit")
{
}
@ -33,11 +33,7 @@ CommandObjectQuit::~CommandObjectQuit ()
}
bool
CommandObjectQuit::Execute
(
Args& args,
CommandReturnObject &result
)
CommandObjectQuit::DoExecute (Args& command, CommandReturnObject &result)
{
m_interpreter.BroadcastEvent (CommandInterpreter::eBroadcastBitQuitCommandReceived);
result.SetStatus (eReturnStatusQuit);

View File

@ -22,7 +22,7 @@ namespace lldb_private {
// CommandObjectQuit
//-------------------------------------------------------------------------
class CommandObjectQuit : public CommandObject
class CommandObjectQuit : public CommandObjectParsed
{
public:
@ -31,8 +31,9 @@ public:
virtual
~CommandObjectQuit ();
protected:
virtual bool
Execute (Args& args,
DoExecute (Args& args,
CommandReturnObject &result);
};

View File

@ -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());

File diff suppressed because it is too large Load Diff

View File

@ -36,361 +36,6 @@ public:
};
//-------------------------------------------------------------------------
// CommandObjectSettingsSet
//-------------------------------------------------------------------------
class CommandObjectSettingsSet : public CommandObject
{
public:
CommandObjectSettingsSet (CommandInterpreter &interpreter);
virtual
~CommandObjectSettingsSet ();
virtual bool
Execute (Args& command,
CommandReturnObject &result)
{ return false; }
virtual bool
WantsRawCommandString() { return true; }
// Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
virtual bool
WantsCompletion() { return true; }
virtual bool
ExecuteRawCommandString (const char *raw_command,
CommandReturnObject &result);
virtual Options *
GetOptions ();
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter);
virtual
~CommandOptions ();
virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg);
void
OptionParsingStarting ();
const OptionDefinition*
GetDefinitions ();
// Options table: Required for subclasses of Options.
static OptionDefinition g_option_table[];
// Instance variables to hold the values for command options.
bool m_override;
bool m_reset;
};
virtual 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);
private:
CommandOptions m_options;
};
//-------------------------------------------------------------------------
// CommandObjectSettingsShow -- Show current values
//-------------------------------------------------------------------------
class CommandObjectSettingsShow : public CommandObject
{
public:
CommandObjectSettingsShow (CommandInterpreter &interpreter);
virtual
~CommandObjectSettingsShow ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual 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);
private:
};
//-------------------------------------------------------------------------
// CommandObjectSettingsList -- List settable variables
//-------------------------------------------------------------------------
class CommandObjectSettingsList : public CommandObject
{
public:
CommandObjectSettingsList (CommandInterpreter &interpreter);
virtual
~CommandObjectSettingsList ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual 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);
private:
};
//-------------------------------------------------------------------------
// CommandObjectSettingsRemove
//-------------------------------------------------------------------------
class CommandObjectSettingsRemove : public CommandObject
{
public:
CommandObjectSettingsRemove (CommandInterpreter &interpreter);
virtual
~CommandObjectSettingsRemove ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual 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);
private:
};
//-------------------------------------------------------------------------
// CommandObjectSettingsReplace
//-------------------------------------------------------------------------
class CommandObjectSettingsReplace : public CommandObject
{
public:
CommandObjectSettingsReplace (CommandInterpreter &interpreter);
virtual
~CommandObjectSettingsReplace ();
virtual bool
Execute (Args& command,
CommandReturnObject &result)
{ return false; }
virtual bool
WantsRawCommandString() { return true; }
// Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
virtual bool
WantsCompletion() { return true; }
virtual bool
ExecuteRawCommandString (const char *raw_command,
CommandReturnObject &result);
virtual 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);
private:
};
//-------------------------------------------------------------------------
// CommandObjectSettingsInsertBefore
//-------------------------------------------------------------------------
class CommandObjectSettingsInsertBefore : public CommandObject
{
public:
CommandObjectSettingsInsertBefore (CommandInterpreter &interpreter);
virtual
~CommandObjectSettingsInsertBefore ();
virtual bool
Execute (Args& command,
CommandReturnObject &result)
{ return false; }
virtual bool
WantsRawCommandString() { return true; }
// Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
virtual bool
WantsCompletion() { return true; }
virtual bool
ExecuteRawCommandString (const char *raw_command,
CommandReturnObject &result);
virtual 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);
private:
};
//-------------------------------------------------------------------------
// CommandObjectSettingInsertAfter
//-------------------------------------------------------------------------
class CommandObjectSettingsInsertAfter : public CommandObject
{
public:
CommandObjectSettingsInsertAfter (CommandInterpreter &interpreter);
virtual
~CommandObjectSettingsInsertAfter ();
virtual bool
Execute (Args& command,
CommandReturnObject &result)
{ return false; }
virtual bool
WantsRawCommandString() { return true; }
// Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
virtual bool
WantsCompletion() { return true; }
virtual bool
ExecuteRawCommandString (const char *raw_command,
CommandReturnObject &result);
virtual 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);
private:
};
//-------------------------------------------------------------------------
// CommandObjectSettingsAppend
//-------------------------------------------------------------------------
class CommandObjectSettingsAppend : public CommandObject
{
public:
CommandObjectSettingsAppend (CommandInterpreter &interpreter);
virtual
~CommandObjectSettingsAppend ();
virtual bool
Execute (Args& command,
CommandReturnObject &result)
{ return false; }
virtual bool
WantsRawCommandString() { return true; }
// Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
virtual bool
WantsCompletion() { return true; }
virtual bool
ExecuteRawCommandString (const char *raw_command,
CommandReturnObject &result);
virtual 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);
private:
};
//-------------------------------------------------------------------------
// CommandObjectSettingsClear
//-------------------------------------------------------------------------
class CommandObjectSettingsClear : public CommandObject
{
public:
CommandObjectSettingsClear (CommandInterpreter &interpreter);
virtual
~CommandObjectSettingsClear ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual 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);
private:
};
} // namespace lldb_private
#endif // liblldb_CommandObjectSettings_h_

View File

@ -32,7 +32,7 @@ using namespace lldb_private;
// CommandObjectSourceInfo
//-------------------------------------------------------------------------
class CommandObjectSourceInfo : public CommandObject
class CommandObjectSourceInfo : public CommandObjectParsed
{
class CommandOptions : public Options
@ -96,10 +96,10 @@ class CommandObjectSourceInfo : public CommandObject
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 @@ public:
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 @@ CommandObjectSourceInfo::CommandOptions::g_option_table[] =
// CommandObjectSourceList
//-------------------------------------------------------------------------
class CommandObjectSourceList : public CommandObject
class CommandObjectSourceList : public CommandObjectParsed
{
class CommandOptions : public Options
@ -232,10 +228,10 @@ class CommandObjectSourceList : public CommandObject
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 @@ public:
return &m_options;
}
bool
Execute
(
Args& args,
CommandReturnObject &result
)
virtual const char *
GetRepeatCommand (Args &current_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 @@ public:
return result.Succeeded();
}
virtual const char *GetRepeatCommand (Args &current_command_args, uint32_t index)
{
return m_cmd_name.c_str();
}
protected:
const SymbolContextList *
GetBreakpointLocations ()
{

View File

@ -28,10 +28,10 @@ using namespace lldb_private;
//-------------------------------------------------------------------------
CommandObjectSyntax::CommandObjectSyntax (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"syntax",
"Shows the correct syntax for a given debugger command.",
"syntax <command>")
CommandObjectParsed (interpreter,
"syntax",
"Shows the correct syntax for a given debugger command.",
"syntax <command>")
{
CommandArgumentEntry arg;
CommandArgumentData command_arg;
@ -53,11 +53,7 @@ CommandObjectSyntax::~CommandObjectSyntax()
bool
CommandObjectSyntax::Execute
(
Args& command,
CommandReturnObject &result
)
CommandObjectSyntax::DoExecute (Args& command, CommandReturnObject &result)
{
CommandObject::CommandMap::iterator pos;
CommandObject *cmd_obj;

View File

@ -22,7 +22,7 @@ namespace lldb_private {
// CommandObjectSyntax
//-------------------------------------------------------------------------
class CommandObjectSyntax : public CommandObject
class CommandObjectSyntax : public CommandObjectParsed
{
public:
@ -31,8 +31,9 @@ public:
virtual
~CommandObjectSyntax ();
protected:
virtual bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result);

View File

@ -138,14 +138,14 @@ DumpTargetList (TargetList &target_list, bool show_stopped_process_status, Strea
// "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 @@ public:
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 @@ public:
}
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 @@ private:
// "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 @@ public:
{
}
protected:
virtual bool
Execute (Args& args, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
if (args.GetArgumentCount() == 0)
{
@ -356,15 +359,15 @@ public:
// "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 @@ public:
{
}
protected:
virtual bool
Execute (Args& args, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
if (args.GetArgumentCount() == 1)
{
@ -431,15 +435,15 @@ public:
// "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 @@ public:
{
}
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 @@ public:
return result.Succeeded();
}
Options *
GetOptions ()
{
return &m_option_group;
}
protected:
OptionGroupOptions m_option_group;
OptionGroupBoolean m_cleanup_option;
};
@ -548,15 +552,15 @@ protected:
// "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 @@ public:
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 @@ public:
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 @@ protected:
#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 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@ -916,15 +921,15 @@ public:
#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 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@ -954,15 +960,15 @@ public:
#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 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@ -1073,15 +1080,15 @@ public:
#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 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@ -1117,15 +1125,15 @@ public:
#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 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@ -1772,7 +1781,7 @@ FindModulesByName (Target *target,
// paths
//----------------------------------------------------------------------
class CommandObjectTargetModulesModuleAutoComplete : public CommandObject
class CommandObjectTargetModulesModuleAutoComplete : public CommandObjectParsed
{
public:
@ -1780,7 +1789,7 @@ public:
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 @@ public:
// file paths
//----------------------------------------------------------------------
class CommandObjectTargetModulesSourceFileAutoComplete : public CommandObject
class CommandObjectTargetModulesSourceFileAutoComplete : public CommandObjectParsed
{
public:
@ -1842,7 +1851,7 @@ public:
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 @@ public:
{
}
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 @@ public:
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 @@ public:
{
}
protected:
virtual bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@ -2211,8 +2221,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@ -2312,8 +2323,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@ -2412,14 +2424,14 @@ public:
}
};
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 @@ public:
{
}
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 @@ public:
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 @@ public:
{
}
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 @@ public:
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 @@ protected:
//----------------------------------------------------------------------
// List images with associated information
//----------------------------------------------------------------------
class CommandObjectTargetModulesList : public CommandObject
class CommandObjectTargetModulesList : public CommandObjectParsed
{
public:
@ -2825,10 +2838,10 @@ public:
};
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 @@ public:
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 @@ public:
}
return result.Succeeded();
}
protected:
void
PrintModule (Target *target, Module *module, uint32_t idx, int indent, Stream &strm)
@ -3183,7 +3196,7 @@ CommandObjectTargetModulesList::CommandOptions::g_option_table[] =
//----------------------------------------------------------------------
// Lookup information in images
//----------------------------------------------------------------------
class CommandObjectTargetModulesLookup : public CommandObject
class CommandObjectTargetModulesLookup : public CommandObjectParsed
{
public:
@ -3328,11 +3341,11 @@ public:
};
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 @@ public:
return false;
}
protected:
virtual bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@ -3611,7 +3625,6 @@ public:
}
return result.Succeeded();
}
protected:
CommandOptions m_options;
};
@ -3709,14 +3722,14 @@ private:
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 @@ public:
{
}
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 @@ public:
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 @@ private:
// CommandObjectTargetStopHookAdd
//-------------------------------------------------------------------------
class CommandObjectTargetStopHookAdd : public CommandObject
class CommandObjectTargetStopHookAdd : public CommandObjectParsed
{
public:
@ -4050,10 +4064,10 @@ public:
}
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 @@ public:
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 @@ CommandObjectTargetStopHookAdd::CommandOptions::g_option_table[] =
// 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 @@ public:
{
}
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 @@ public:
// 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 @@ public:
{
}
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 @@ private:
// 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 @@ public:
{
}
protected:
bool
Execute (Args& command,
CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
if (!target)

View File

@ -42,7 +42,7 @@ using namespace lldb_private;
// CommandObjectThreadBacktrace
//-------------------------------------------------------------------------
class CommandObjectThreadBacktrace : public CommandObject
class CommandObjectThreadBacktrace : public CommandObjectParsed
{
public:
@ -121,11 +121,11 @@ public:
};
CommandObjectThreadBacktrace (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"thread backtrace",
"Show the stack for one or more threads. If no threads are specified, show the currently selected thread. Use the thread-index \"all\" to see all threads.",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
CommandObjectParsed (interpreter,
"thread backtrace",
"Show the stack for one or more threads. If no threads are specified, show the currently selected thread. Use the thread-index \"all\" to see all threads.",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
m_options(interpreter)
{
CommandArgumentEntry arg;
@ -152,8 +152,9 @@ public:
return &m_options;
}
protected:
virtual bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
result.SetStatus (eReturnStatusSuccessFinishResult);
Stream &strm = result.GetOutputStream();
@ -250,7 +251,7 @@ public:
}
return result.Succeeded();
}
protected:
CommandOptions m_options;
};
@ -268,7 +269,7 @@ enum StepScope
eStepScopeInstruction
};
class CommandObjectThreadStepWithTypeAndScope : public CommandObject
class CommandObjectThreadStepWithTypeAndScope : public CommandObjectParsed
{
public:
@ -358,7 +359,7 @@ public:
uint32_t flags,
StepType step_type,
StepScope step_scope) :
CommandObject (interpreter, name, help, syntax, flags),
CommandObjectParsed (interpreter, name, help, syntax, flags),
m_step_type (step_type),
m_step_scope (step_scope),
m_options (interpreter)
@ -389,12 +390,9 @@ public:
return &m_options;
}
protected:
virtual bool
Execute
(
Args& command,
CommandReturnObject &result
)
DoExecute (Args& command, CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
bool synchronous_execution = m_interpreter.GetSynchronous();
@ -594,16 +592,16 @@ CommandObjectThreadStepWithTypeAndScope::CommandOptions::g_option_table[] =
// CommandObjectThreadContinue
//-------------------------------------------------------------------------
class CommandObjectThreadContinue : public CommandObject
class CommandObjectThreadContinue : public CommandObjectParsed
{
public:
CommandObjectThreadContinue (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"thread continue",
"Continue execution of one or more threads in an active process.",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
CommandObjectParsed (interpreter,
"thread continue",
"Continue execution of one or more threads in an active process.",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
{
CommandArgumentEntry arg;
CommandArgumentData thread_idx_arg;
@ -626,11 +624,7 @@ public:
}
virtual bool
Execute
(
Args& command,
CommandReturnObject &result
)
DoExecute (Args& command, CommandReturnObject &result)
{
bool synchronous_execution = m_interpreter.GetSynchronous ();
@ -782,7 +776,7 @@ public:
// CommandObjectThreadUntil
//-------------------------------------------------------------------------
class CommandObjectThreadUntil : public CommandObject
class CommandObjectThreadUntil : public CommandObjectParsed
{
public:
@ -879,11 +873,11 @@ public:
};
CommandObjectThreadUntil (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"thread until",
"Run the current or specified thread until it reaches a given line number or leaves the current function.",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
CommandObjectParsed (interpreter,
"thread until",
"Run the current or specified thread until it reaches a given line number or leaves the current function.",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
m_options (interpreter)
{
CommandArgumentEntry arg;
@ -913,12 +907,9 @@ public:
return &m_options;
}
protected:
virtual bool
Execute
(
Args& command,
CommandReturnObject &result
)
DoExecute (Args& command, CommandReturnObject &result)
{
bool synchronous_execution = m_interpreter.GetSynchronous ();
@ -1100,7 +1091,7 @@ public:
}
return result.Succeeded();
}
protected:
CommandOptions m_options;
};
@ -1119,16 +1110,16 @@ CommandObjectThreadUntil::CommandOptions::g_option_table[] =
// CommandObjectThreadSelect
//-------------------------------------------------------------------------
class CommandObjectThreadSelect : public CommandObject
class CommandObjectThreadSelect : public CommandObjectParsed
{
public:
CommandObjectThreadSelect (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"thread select",
"Select a thread as the currently active thread.",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
CommandObjectParsed (interpreter,
"thread select",
"Select a thread as the currently active thread.",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
{
CommandArgumentEntry arg;
CommandArgumentData thread_idx_arg;
@ -1150,12 +1141,9 @@ public:
{
}
protected:
virtual bool
Execute
(
Args& command,
CommandReturnObject &result
)
DoExecute (Args& command, CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process == NULL)
@ -1202,17 +1190,17 @@ public:
// CommandObjectThreadList
//-------------------------------------------------------------------------
class CommandObjectThreadList : public CommandObject
class CommandObjectThreadList : public CommandObjectParsed
{
public:
CommandObjectThreadList (CommandInterpreter &interpreter):
CommandObject (interpreter,
"thread list",
"Show a summary of all current threads in a process.",
"thread list",
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
CommandObjectParsed (interpreter,
"thread list",
"Show a summary of all current threads in a process.",
"thread list",
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
{
}
@ -1220,12 +1208,9 @@ public:
{
}
protected:
bool
Execute
(
Args& command,
CommandReturnObject &result
)
DoExecute (Args& command, CommandReturnObject &result)
{
Stream &strm = result.GetOutputStream();
result.SetStatus (eReturnStatusSuccessFinishNoResult);

View File

@ -98,7 +98,7 @@ public:
class CommandObjectTypeSummaryAdd : public CommandObject
class CommandObjectTypeSummaryAdd : public CommandObjectParsed
{
private:
@ -176,18 +176,19 @@ public:
{
}
bool
Execute (Args& command, CommandReturnObject &result);
static bool
AddSummary(const ConstString& type_name,
lldb::TypeSummaryImplSP entry,
SummaryFormatType type,
std::string category,
Error* error = NULL);
protected:
bool
DoExecute (Args& command, CommandReturnObject &result);
};
class CommandObjectTypeSynthAdd : public CommandObject
class CommandObjectTypeSynthAdd : public CommandObjectParsed
{
private:
@ -297,13 +298,14 @@ private:
CollectPythonScript (SynthAddOptions *options,
CommandReturnObject &result);
bool
Execute_HandwritePython (Args& command, CommandReturnObject &result);
Execute_HandwritePython (Args& command, CommandReturnObject &result);
bool
Execute_PythonClass (Args& command, CommandReturnObject &result);
protected:
bool
Execute (Args& command, CommandReturnObject &result);
DoExecute (Args& command, CommandReturnObject &result);
public:
@ -331,7 +333,7 @@ public:
// CommandObjectTypeFormatAdd
//-------------------------------------------------------------------------
class CommandObjectTypeFormatAdd : public CommandObject
class CommandObjectTypeFormatAdd : public CommandObjectParsed
{
private:
@ -419,10 +421,10 @@ private:
public:
CommandObjectTypeFormatAdd (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type format add",
"Add a new formatting style for a type.",
NULL),
CommandObjectParsed (interpreter,
"type format add",
"Add a new formatting style for a type.",
NULL),
m_option_group (interpreter),
m_format_options (eFormatInvalid),
m_command_options ()
@ -476,8 +478,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -544,14 +547,14 @@ CommandObjectTypeFormatAdd::CommandOptions::GetNumDefinitions ()
// CommandObjectTypeFormatDelete
//-------------------------------------------------------------------------
class CommandObjectTypeFormatDelete : public CommandObject
class CommandObjectTypeFormatDelete : public CommandObjectParsed
{
public:
CommandObjectTypeFormatDelete (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type format delete",
"Delete an existing formatting style for a type.",
NULL)
CommandObjectParsed (interpreter,
"type format delete",
"Delete an existing formatting style for a type.",
NULL)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -569,8 +572,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -612,14 +616,14 @@ public:
// CommandObjectTypeFormatClear
//-------------------------------------------------------------------------
class CommandObjectTypeFormatClear : public CommandObject
class CommandObjectTypeFormatClear : public CommandObjectParsed
{
public:
CommandObjectTypeFormatClear (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type format clear",
"Delete all existing format styles.",
NULL)
CommandObjectParsed (interpreter,
"type format clear",
"Delete all existing format styles.",
NULL)
{
}
@ -627,8 +631,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
DataVisualization::ValueFormats::Clear();
result.SetStatus(eReturnStatusSuccessFinishResult);
@ -653,14 +658,14 @@ struct CommandObjectTypeFormatList_LoopCallbackParam {
RegularExpression* X = NULL) : self(S), result(R), regex(X) {}
};
class CommandObjectTypeFormatList : public CommandObject
class CommandObjectTypeFormatList : public CommandObjectParsed
{
public:
CommandObjectTypeFormatList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type format list",
"Show a list of current formatting styles.",
NULL)
CommandObjectParsed (interpreter,
"type format list",
"Show a list of current formatting styles.",
NULL)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -677,8 +682,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -1230,10 +1236,11 @@ CommandObjectTypeSummaryAdd::Execute_StringSummary (Args& command, CommandReturn
}
CommandObjectTypeSummaryAdd::CommandObjectTypeSummaryAdd (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type summary add",
"Add a new summary style for a type.",
NULL), m_options (interpreter)
CommandObjectParsed (interpreter,
"type summary add",
"Add a new summary style for a type.",
NULL),
m_options (interpreter)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -1312,7 +1319,7 @@ CommandObject (interpreter,
}
bool
CommandObjectTypeSummaryAdd::Execute (Args& command, CommandReturnObject &result)
CommandObjectTypeSummaryAdd::DoExecute (Args& command, CommandReturnObject &result)
{
if (m_options.m_is_add_script)
{
@ -1391,7 +1398,7 @@ CommandObjectTypeSummaryAdd::CommandOptions::g_option_table[] =
// CommandObjectTypeSummaryDelete
//-------------------------------------------------------------------------
class CommandObjectTypeSummaryDelete : public CommandObject
class CommandObjectTypeSummaryDelete : public CommandObjectParsed
{
private:
class CommandOptions : public Options
@ -1471,10 +1478,11 @@ private:
public:
CommandObjectTypeSummaryDelete (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type summary delete",
"Delete an existing summary style for a type.",
NULL), m_options(interpreter)
CommandObjectParsed (interpreter,
"type summary delete",
"Delete an existing summary style for a type.",
NULL),
m_options(interpreter)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -1492,8 +1500,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -1551,7 +1560,7 @@ CommandObjectTypeSummaryDelete::CommandOptions::g_option_table[] =
{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
class CommandObjectTypeSummaryClear : public CommandObject
class CommandObjectTypeSummaryClear : public CommandObjectParsed
{
private:
@ -1628,10 +1637,11 @@ private:
public:
CommandObjectTypeSummaryClear (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type summary clear",
"Delete all existing summary styles.",
NULL), m_options(interpreter)
CommandObjectParsed (interpreter,
"type summary clear",
"Delete all existing summary styles.",
NULL),
m_options(interpreter)
{
}
@ -1639,8 +1649,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
if (m_options.m_delete_all)
@ -1694,7 +1705,7 @@ struct CommandObjectTypeSummaryList_LoopCallbackParam {
RegularExpression* CX = NULL) : self(S), result(R), regex(X), cate_regex(CX) {}
};
class CommandObjectTypeSummaryList : public CommandObject
class CommandObjectTypeSummaryList : public CommandObjectParsed
{
class CommandOptions : public Options
@ -1760,10 +1771,11 @@ class CommandObjectTypeSummaryList : public CommandObject
public:
CommandObjectTypeSummaryList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type summary list",
"Show a list of current summary styles.",
NULL), m_options(interpreter)
CommandObjectParsed (interpreter,
"type summary list",
"Show a list of current summary styles.",
NULL),
m_options(interpreter)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -1780,8 +1792,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -1905,14 +1918,14 @@ CommandObjectTypeSummaryList::CommandOptions::g_option_table[] =
// CommandObjectTypeCategoryEnable
//-------------------------------------------------------------------------
class CommandObjectTypeCategoryEnable : public CommandObject
class CommandObjectTypeCategoryEnable : public CommandObjectParsed
{
public:
CommandObjectTypeCategoryEnable (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type category enable",
"Enable a category as a source of formatters.",
NULL)
CommandObjectParsed (interpreter,
"type category enable",
"Enable a category as a source of formatters.",
NULL)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -1930,8 +1943,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -1974,14 +1988,14 @@ public:
// CommandObjectTypeCategoryDelete
//-------------------------------------------------------------------------
class CommandObjectTypeCategoryDelete : public CommandObject
class CommandObjectTypeCategoryDelete : public CommandObjectParsed
{
public:
CommandObjectTypeCategoryDelete (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type category delete",
"Delete a category and all associated formatters.",
NULL)
CommandObjectParsed (interpreter,
"type category delete",
"Delete a category and all associated formatters.",
NULL)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -1999,8 +2013,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -2046,14 +2061,14 @@ public:
// CommandObjectTypeCategoryDisable
//-------------------------------------------------------------------------
class CommandObjectTypeCategoryDisable : public CommandObject
class CommandObjectTypeCategoryDisable : public CommandObjectParsed
{
public:
CommandObjectTypeCategoryDisable (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type category disable",
"Disable a category as a source of formatters.",
NULL)
CommandObjectParsed (interpreter,
"type category disable",
"Disable a category as a source of formatters.",
NULL)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -2071,8 +2086,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -2122,7 +2138,7 @@ public:
// CommandObjectTypeCategoryList
//-------------------------------------------------------------------------
class CommandObjectTypeCategoryList : public CommandObject
class CommandObjectTypeCategoryList : public CommandObjectParsed
{
private:
@ -2159,10 +2175,10 @@ private:
}
public:
CommandObjectTypeCategoryList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type category list",
"Provide a list of all existing categories.",
NULL)
CommandObjectParsed (interpreter,
"type category list",
"Provide a list of all existing categories.",
NULL)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -2179,8 +2195,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
RegularExpression* regex = NULL;
@ -2229,7 +2246,7 @@ struct CommandObjectTypeFilterList_LoopCallbackParam {
RegularExpression* CX = NULL) : self(S), result(R), regex(X), cate_regex(CX) {}
};
class CommandObjectTypeFilterList : public CommandObject
class CommandObjectTypeFilterList : public CommandObjectParsed
{
class CommandOptions : public Options
@ -2295,10 +2312,11 @@ class CommandObjectTypeFilterList : public CommandObject
public:
CommandObjectTypeFilterList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type filter list",
"Show a list of current filters.",
NULL), m_options(interpreter)
CommandObjectParsed (interpreter,
"type filter list",
"Show a list of current filters.",
NULL),
m_options(interpreter)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -2315,8 +2333,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -2441,7 +2460,7 @@ struct CommandObjectTypeSynthList_LoopCallbackParam {
RegularExpression* CX = NULL) : self(S), result(R), regex(X), cate_regex(CX) {}
};
class CommandObjectTypeSynthList : public CommandObject
class CommandObjectTypeSynthList : public CommandObjectParsed
{
class CommandOptions : public Options
@ -2507,10 +2526,11 @@ class CommandObjectTypeSynthList : public CommandObject
public:
CommandObjectTypeSynthList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type synthetic list",
"Show a list of current synthetic providers.",
NULL), m_options(interpreter)
CommandObjectParsed (interpreter,
"type synthetic list",
"Show a list of current synthetic providers.",
NULL),
m_options(interpreter)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -2527,8 +2547,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -2637,7 +2658,7 @@ CommandObjectTypeSynthList::CommandOptions::g_option_table[] =
// CommandObjectTypeFilterDelete
//-------------------------------------------------------------------------
class CommandObjectTypeFilterDelete : public CommandObject
class CommandObjectTypeFilterDelete : public CommandObjectParsed
{
private:
class CommandOptions : public Options
@ -2716,10 +2737,11 @@ private:
public:
CommandObjectTypeFilterDelete (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type filter delete",
"Delete an existing filter for a type.",
NULL), m_options(interpreter)
CommandObjectParsed (interpreter,
"type filter delete",
"Delete an existing filter for a type.",
NULL),
m_options(interpreter)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -2737,8 +2759,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -2801,7 +2824,7 @@ CommandObjectTypeFilterDelete::CommandOptions::g_option_table[] =
// CommandObjectTypeSynthDelete
//-------------------------------------------------------------------------
class CommandObjectTypeSynthDelete : public CommandObject
class CommandObjectTypeSynthDelete : public CommandObjectParsed
{
private:
class CommandOptions : public Options
@ -2880,10 +2903,11 @@ private:
public:
CommandObjectTypeSynthDelete (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type synthetic delete",
"Delete an existing synthetic provider for a type.",
NULL), m_options(interpreter)
CommandObjectParsed (interpreter,
"type synthetic delete",
"Delete an existing synthetic provider for a type.",
NULL),
m_options(interpreter)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -2901,8 +2925,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -2965,7 +2990,7 @@ CommandObjectTypeSynthDelete::CommandOptions::g_option_table[] =
// CommandObjectTypeFilterClear
//-------------------------------------------------------------------------
class CommandObjectTypeFilterClear : public CommandObject
class CommandObjectTypeFilterClear : public CommandObjectParsed
{
private:
@ -3041,10 +3066,11 @@ private:
public:
CommandObjectTypeFilterClear (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type filter clear",
"Delete all existing filters.",
NULL), m_options(interpreter)
CommandObjectParsed (interpreter,
"type filter clear",
"Delete all existing filters.",
NULL),
m_options(interpreter)
{
}
@ -3052,8 +3078,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
if (m_options.m_delete_all)
@ -3092,7 +3119,7 @@ CommandObjectTypeFilterClear::CommandOptions::g_option_table[] =
// CommandObjectTypeSynthClear
//-------------------------------------------------------------------------
class CommandObjectTypeSynthClear : public CommandObject
class CommandObjectTypeSynthClear : public CommandObjectParsed
{
private:
@ -3168,10 +3195,11 @@ private:
public:
CommandObjectTypeSynthClear (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type synthetic clear",
"Delete all existing synthetic providers.",
NULL), m_options(interpreter)
CommandObjectParsed (interpreter,
"type synthetic clear",
"Delete all existing synthetic providers.",
NULL),
m_options(interpreter)
{
}
@ -3179,8 +3207,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
if (m_options.m_delete_all)
@ -3496,10 +3525,11 @@ CommandObjectTypeSynthAdd::Execute_PythonClass (Args& command, CommandReturnObje
}
CommandObjectTypeSynthAdd::CommandObjectTypeSynthAdd (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type synthetic add",
"Add a new synthetic provider for a type.",
NULL), m_options (interpreter)
CommandObjectParsed (interpreter,
"type synthetic add",
"Add a new synthetic provider for a type.",
NULL),
m_options (interpreter)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -3555,7 +3585,7 @@ CommandObjectTypeSynthAdd::AddSynth(const ConstString& type_name,
}
bool
CommandObjectTypeSynthAdd::Execute (Args& command, CommandReturnObject &result)
CommandObjectTypeSynthAdd::DoExecute (Args& command, CommandReturnObject &result)
{
if (m_options.handwrite_python)
return Execute_HandwritePython(command, result);
@ -3584,7 +3614,7 @@ CommandObjectTypeSynthAdd::CommandOptions::g_option_table[] =
#endif // #ifndef LLDB_DISABLE_PYTHON
class CommandObjectTypeFilterAdd : public CommandObject
class CommandObjectTypeFilterAdd : public CommandObjectParsed
{
private:
@ -3737,11 +3767,11 @@ private:
public:
CommandObjectTypeFilterAdd (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"type filter add",
"Add a new filter for a type.",
NULL),
m_options (interpreter)
CommandObjectParsed (interpreter,
"type filter add",
"Add a new filter for a type.",
NULL),
m_options (interpreter)
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -3785,8 +3815,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();

View File

@ -25,7 +25,7 @@ using namespace lldb_private;
//-------------------------------------------------------------------------
CommandObjectVersion::CommandObjectVersion (CommandInterpreter &interpreter) :
CommandObject (interpreter, "version", "Show version of LLDB debugger.", "version")
CommandObjectParsed (interpreter, "version", "Show version of LLDB debugger.", "version")
{
}
@ -34,11 +34,7 @@ CommandObjectVersion::~CommandObjectVersion ()
}
bool
CommandObjectVersion::Execute
(
Args& args,
CommandReturnObject &result
)
CommandObjectVersion::DoExecute (Args& args, CommandReturnObject &result)
{
result.AppendMessageWithFormat ("%s\n", lldb_private::GetVersion());
result.SetStatus (eReturnStatusSuccessFinishResult);

View File

@ -22,7 +22,7 @@ namespace lldb_private {
// CommandObjectVersion
//-------------------------------------------------------------------------
class CommandObjectVersion : public CommandObject
class CommandObjectVersion : public CommandObjectParsed
{
public:
@ -31,8 +31,9 @@ public:
virtual
~CommandObjectVersion ();
protected:
virtual bool
Execute (Args& args,
DoExecute (Args& args,
CommandReturnObject &result);
};

File diff suppressed because it is too large Load Diff

View File

@ -34,285 +34,6 @@ public:
~CommandObjectMultiwordWatchpoint ();
};
//-------------------------------------------------------------------------
// CommandObjectWatchpointList
//-------------------------------------------------------------------------
class CommandObjectWatchpointList : public CommandObject
{
public:
CommandObjectWatchpointList (CommandInterpreter &interpreter);
virtual
~CommandObjectWatchpointList ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual Options *
GetOptions ();
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter);
virtual
~CommandOptions ();
virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg);
void
OptionParsingStarting ();
const OptionDefinition *
GetDefinitions ();
// Options table: Required for subclasses of Options.
static OptionDefinition g_option_table[];
// Instance variables to hold the values for command options.
lldb::DescriptionLevel m_level;
};
private:
CommandOptions m_options;
};
//-------------------------------------------------------------------------
// CommandObjectWatchpointEnable
//-------------------------------------------------------------------------
class CommandObjectWatchpointEnable : public CommandObject
{
public:
CommandObjectWatchpointEnable (CommandInterpreter &interpreter);
virtual
~CommandObjectWatchpointEnable ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
private:
};
//-------------------------------------------------------------------------
// CommandObjectWatchpointDisable
//-------------------------------------------------------------------------
class CommandObjectWatchpointDisable : public CommandObject
{
public:
CommandObjectWatchpointDisable (CommandInterpreter &interpreter);
virtual
~CommandObjectWatchpointDisable ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
private:
};
//-------------------------------------------------------------------------
// CommandObjectWatchpointDelete
//-------------------------------------------------------------------------
class CommandObjectWatchpointDelete : public CommandObject
{
public:
CommandObjectWatchpointDelete (CommandInterpreter &interpreter);
virtual
~CommandObjectWatchpointDelete ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
private:
};
//-------------------------------------------------------------------------
// CommandObjectWatchpointIgnore
//-------------------------------------------------------------------------
class CommandObjectWatchpointIgnore : public CommandObject
{
public:
CommandObjectWatchpointIgnore (CommandInterpreter &interpreter);
virtual
~CommandObjectWatchpointIgnore ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual Options *
GetOptions ();
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter);
virtual
~CommandOptions ();
virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg);
void
OptionParsingStarting ();
const OptionDefinition *
GetDefinitions ();
// Options table: Required for subclasses of Options.
static OptionDefinition g_option_table[];
// Instance variables to hold the values for command options.
uint32_t m_ignore_count;
};
private:
CommandOptions m_options;
};
//-------------------------------------------------------------------------
// CommandObjectWatchpointModify
//-------------------------------------------------------------------------
class CommandObjectWatchpointModify : public CommandObject
{
public:
CommandObjectWatchpointModify (CommandInterpreter &interpreter);
virtual
~CommandObjectWatchpointModify ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual Options *
GetOptions ();
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter);
virtual
~CommandOptions ();
virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg);
void
OptionParsingStarting ();
const OptionDefinition*
GetDefinitions ();
// Options table: Required for subclasses of Options.
static OptionDefinition g_option_table[];
// Instance variables to hold the values for command options.
std::string m_condition;
bool m_condition_passed;
};
private:
CommandOptions m_options;
};
//-------------------------------------------------------------------------
// CommandObjectWatchpointSet
//-------------------------------------------------------------------------
class CommandObjectWatchpointSet : public CommandObjectMultiword
{
public:
CommandObjectWatchpointSet (CommandInterpreter &interpreter);
virtual
~CommandObjectWatchpointSet ();
};
class CommandObjectWatchpointSetVariable : public CommandObject
{
public:
CommandObjectWatchpointSetVariable (CommandInterpreter &interpreter);
virtual
~CommandObjectWatchpointSetVariable ();
virtual bool
Execute (Args& command,
CommandReturnObject &result);
virtual Options *
GetOptions ();
private:
OptionGroupOptions m_option_group;
OptionGroupWatchpoint m_option_watchpoint;
};
class CommandObjectWatchpointSetExpression : public CommandObject
{
public:
CommandObjectWatchpointSetExpression (CommandInterpreter &interpreter);
virtual
~CommandObjectWatchpointSetExpression ();
virtual bool
Execute (Args& command,
CommandReturnObject &result)
{ return false; }
virtual bool
WantsRawCommandString() { return true; }
// Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
virtual bool
WantsCompletion() { return true; }
virtual bool
ExecuteRawCommandString (const char *raw_command,
CommandReturnObject &result);
virtual Options *
GetOptions ();
private:
OptionGroupOptions m_option_group;
OptionGroupWatchpoint m_option_watchpoint;
};
} // namespace lldb_private
#endif // liblldb_CommandObjectWatchpoint_h_

View File

@ -1562,35 +1562,7 @@ CommandInterpreter::HandleCommand (const char *command_line,
if (log)
log->Printf ("HandleCommand, command line after removing command name(s): '%s'", remainder.c_str());
CommandOverrideCallback command_callback = cmd_obj->GetOverrideCallback();
bool handled = false;
if (wants_raw_input)
{
if (command_callback)
{
std::string full_command (cmd_obj->GetCommandName ());
full_command += ' ';
full_command += remainder;
const char *argv[2] = { NULL, NULL };
argv[0] = full_command.c_str();
handled = command_callback (cmd_obj->GetOverrideCallbackBaton(), argv);
}
if (!handled)
cmd_obj->ExecuteRawCommandString (remainder.c_str(), result);
}
else
{
Args cmd_args (remainder.c_str());
if (command_callback)
{
Args full_args (cmd_obj->GetCommandName ());
full_args.AppendArguments(cmd_args);
handled = command_callback (cmd_obj->GetOverrideCallbackBaton(), full_args.GetConstArgumentVector());
}
if (!handled)
cmd_obj->ExecuteWithOptions (cmd_args, result);
}
cmd_obj->Execute (remainder.c_str(), result);
}
else
{

View File

@ -153,18 +153,6 @@ CommandObject::GetOptions ()
return NULL;
}
Flags&
CommandObject::GetFlags()
{
return m_flags;
}
const Flags&
CommandObject::GetFlags() const
{
return m_flags;
}
bool
CommandObject::ParseOptions
(
@ -214,16 +202,12 @@ CommandObject::ParseOptions
}
return true;
}
bool
CommandObject::ExecuteWithOptions (Args& args, CommandReturnObject &result)
{
for (size_t i = 0; i < args.GetArgumentCount(); ++i)
{
const char *tmp_str = args.GetArgumentAtIndex (i);
if (tmp_str[0] == '`') // back-quote
args.ReplaceArgumentAtIndex (i, m_interpreter.ProcessEmbeddedScriptCommands (tmp_str));
}
bool
CommandObject::CheckFlags (CommandReturnObject &result)
{
if (GetFlags().AnySet (CommandObject::eFlagProcessMustBeLaunched | CommandObject::eFlagProcessMustBePaused))
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
@ -274,12 +258,7 @@ CommandObject::ExecuteWithOptions (Args& args, CommandReturnObject &result)
}
}
}
if (!ParseOptions (args, result))
return false;
// Call the command-specific version of 'Execute', passing it the already processed arguments.
return Execute (args, result);
return true;
}
class CommandDictCommandPartialMatch
@ -846,6 +825,63 @@ CommandObject::GetArgumentDescriptionAsCString (const lldb::CommandArgumentType
return NULL;
}
bool
CommandObjectParsed::Execute (const char *args_string, CommandReturnObject &result)
{
CommandOverrideCallback command_callback = GetOverrideCallback();
bool handled = false;
Args cmd_args (args_string);
if (command_callback)
{
Args full_args (GetCommandName ());
full_args.AppendArguments(cmd_args);
handled = command_callback (GetOverrideCallbackBaton(), full_args.GetConstArgumentVector());
}
if (!handled)
{
for (size_t i = 0; i < cmd_args.GetArgumentCount(); ++i)
{
const char *tmp_str = cmd_args.GetArgumentAtIndex (i);
if (tmp_str[0] == '`') // back-quote
cmd_args.ReplaceArgumentAtIndex (i, m_interpreter.ProcessEmbeddedScriptCommands (tmp_str));
}
if (!CheckFlags(result))
return false;
if (!ParseOptions (cmd_args, result))
return false;
// Call the command-specific version of 'Execute', passing it the already processed arguments.
handled = DoExecute (cmd_args, result);
}
return handled;
}
bool
CommandObjectRaw::Execute (const char *args_string, CommandReturnObject &result)
{
CommandOverrideCallback command_callback = GetOverrideCallback();
bool handled = false;
if (command_callback)
{
std::string full_command (GetCommandName ());
full_command += ' ';
full_command += args_string;
const char *argv[2] = { NULL, NULL };
argv[0] = full_command.c_str();
handled = command_callback (GetOverrideCallbackBaton(), argv);
}
if (!handled)
{
if (!CheckFlags(result))
return false;
else
handled = DoExecute (args_string, result);
}
return handled;
}
static
const char *arch_helper()
{

View File

@ -30,7 +30,7 @@ CommandObjectRegexCommand::CommandObjectRegexCommand
const char *syntax,
uint32_t max_matches
) :
CommandObject (interpreter, name, help, syntax),
CommandObjectRaw (interpreter, name, help, syntax),
m_max_matches (max_matches),
m_entries ()
{
@ -45,18 +45,7 @@ CommandObjectRegexCommand::~CommandObjectRegexCommand()
bool
CommandObjectRegexCommand::Execute
(
Args& command,
CommandReturnObject &result
)
{
return false;
}
bool
CommandObjectRegexCommand::ExecuteRawCommandString
CommandObjectRegexCommand::DoExecute
(
const char *command,
CommandReturnObject &result

View File

@ -30,10 +30,10 @@ using namespace lldb_private;
//-------------------------------------------------------------------------
CommandObjectScript::CommandObjectScript (CommandInterpreter &interpreter, ScriptLanguage script_lang) :
CommandObject (interpreter,
"script",
"Pass an expression to the script interpreter for evaluation and return the results. Drop into the interactive interpreter if no expression is given.",
"script [<script-expression-for-evaluation>]"),
CommandObjectRaw (interpreter,
"script",
"Pass an expression to the script interpreter for evaluation and return the results. Drop into the interactive interpreter if no expression is given.",
"script [<script-expression-for-evaluation>]"),
m_script_lang (script_lang)
{
}
@ -43,7 +43,7 @@ CommandObjectScript::~CommandObjectScript ()
}
bool
CommandObjectScript::ExecuteRawCommandString
CommandObjectScript::DoExecute
(
const char *command,
CommandReturnObject &result
@ -74,21 +74,3 @@ CommandObjectScript::ExecuteRawCommandString
return result.Succeeded();
}
bool
CommandObjectScript::WantsRawCommandString()
{
return true;
}
bool
CommandObjectScript::Execute
(
Args& command,
CommandReturnObject &result
)
{
// everything should be handled in ExecuteRawCommandString
return false;
}

View File

@ -22,7 +22,7 @@ namespace lldb_private {
// CommandObjectScript
//-------------------------------------------------------------------------
class CommandObjectScript : public CommandObject
class CommandObjectScript : public CommandObjectRaw
{
public:
@ -32,15 +32,9 @@ public:
virtual
~CommandObjectScript ();
bool WantsRawCommandString();
protected:
virtual bool
ExecuteRawCommandString (const char *command,
CommandReturnObject &result);
virtual bool
Execute (Args& command,
CommandReturnObject &result);
DoExecute (const char *command, CommandReturnObject &result);
private:
lldb::ScriptLanguage m_script_lang;