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.
@ -383,6 +386,9 @@ public:
m_command_override_baton = baton;
}
virtual bool
Execute (const char *args_string, CommandReturnObject &result) = 0;
protected:
CommandInterpreter &m_interpreter;
std::string m_cmd_name;
@ -394,6 +400,7 @@ 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
@ -401,6 +408,58 @@ protected:
};
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,7 +27,7 @@ using namespace lldb_private;
//-------------------------------------------------------------------------
CommandObjectApropos::CommandObjectApropos (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"apropos",
"Find a list of debugger commands related to a particular word/subject.",
NULL)
@ -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,7 +77,7 @@ CommandObjectArgs::CommandOptions::GetDefinitions ()
}
CommandObjectArgs::CommandObjectArgs (CommandInterpreter &interpreter) :
CommandObject (interpreter,
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"),
@ -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_

View File

@ -27,143 +27,22 @@
using namespace lldb;
using namespace lldb_private;
//-------------------------------------------------------------------------
// CommandObjectBreakpointCommandAdd::CommandOptions
//-------------------------------------------------------------------------
CommandObjectBreakpointCommandAdd::CommandOptions::CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
m_use_commands (false),
m_use_script_language (false),
m_script_language (eScriptLanguageNone),
m_use_one_liner (false),
m_one_liner(),
m_function_name()
{
}
CommandObjectBreakpointCommandAdd::CommandOptions::~CommandOptions ()
{
}
// FIXME: "script-type" needs to have its contents determined dynamically, so somebody can add a new scripting
// language to lldb and have it pickable here without having to change this enumeration by hand and rebuild lldb proper.
static OptionEnumValueElement
g_script_option_enumeration[4] =
{
{ eScriptLanguageNone, "command", "Commands are in the lldb command interpreter language"},
{ eScriptLanguagePython, "python", "Commands are in the Python language."},
{ eSortOrderByName, "default-script", "Commands are in the default scripting language."},
{ 0, NULL, NULL }
};
OptionDefinition
CommandObjectBreakpointCommandAdd::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_1, false, "one-liner", 'o', required_argument, NULL, NULL, eArgTypeOneLiner,
"Specify a one-line breakpoint command inline. Be sure to surround it with quotes." },
{ LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', required_argument, NULL, NULL, eArgTypeBoolean,
"Specify whether breakpoint command execution should terminate on error." },
{ LLDB_OPT_SET_ALL, false, "script-type", 's', required_argument, g_script_option_enumeration, NULL, eArgTypeNone,
"Specify the language for the commands - if none is specified, the lldb command interpreter will be used."},
{ LLDB_OPT_SET_2, false, "python-function", 'F', required_argument, NULL, NULL, eArgTypePythonFunction,
"Give the name of a Python function to run as command for this breakpoint. Be sure to give a module name if appropriate."},
{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
const OptionDefinition*
CommandObjectBreakpointCommandAdd::CommandOptions::GetDefinitions ()
{
return g_option_table;
}
Error
CommandObjectBreakpointCommandAdd::CommandOptions::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 'o':
m_use_one_liner = true;
m_one_liner = option_arg;
break;
case 's':
m_script_language = (lldb::ScriptLanguage) Args::StringToOptionEnum (option_arg,
g_option_table[option_idx].enum_values,
eScriptLanguageNone,
error);
if (m_script_language == eScriptLanguagePython || m_script_language == eScriptLanguageDefault)
{
m_use_script_language = true;
}
else
{
m_use_script_language = false;
}
break;
case 'e':
{
bool success = false;
m_stop_on_error = Args::StringToBoolean(option_arg, false, &success);
if (!success)
error.SetErrorStringWithFormat("invalid value for stop-on-error: \"%s\"", option_arg);
}
break;
case 'F':
{
m_use_one_liner = false;
m_use_script_language = true;
m_function_name.assign(option_arg);
}
break;
default:
break;
}
return error;
}
void
CommandObjectBreakpointCommandAdd::CommandOptions::OptionParsingStarting ()
{
m_use_commands = true;
m_use_script_language = false;
m_script_language = eScriptLanguageNone;
m_use_one_liner = false;
m_stop_on_error = true;
m_one_liner.clear();
m_function_name.clear();
}
//-------------------------------------------------------------------------
// CommandObjectBreakpointCommandAdd
//-------------------------------------------------------------------------
CommandObjectBreakpointCommandAdd::CommandObjectBreakpointCommandAdd (CommandInterpreter &interpreter) :
CommandObject (interpreter,
class CommandObjectBreakpointCommandAdd : public CommandObjectParsed
{
public:
CommandObjectBreakpointCommandAdd (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
"add",
"Add a set of commands to a breakpoint, to be executed whenever the breakpoint is hit.",
NULL),
m_options (interpreter)
{
{
SetHelpLong (
"\nGeneral information about entering breakpoint commands \n\
------------------------------------------------------ \n\
@ -282,7 +161,6 @@ You may enter any debugger command, exactly as you would at the \n\
debugger prompt. You may enter as many debugger commands as you like, \n\
but do NOT enter more than one command per line. \n" );
CommandArgumentEntry arg;
CommandArgumentData bp_id_arg;
@ -295,19 +173,318 @@ but do NOT enter more than one command per line. \n" );
// Push the data for the first argument into the m_arguments vector.
m_arguments.push_back (arg);
}
}
CommandObjectBreakpointCommandAdd::~CommandObjectBreakpointCommandAdd ()
{
}
virtual
~CommandObjectBreakpointCommandAdd () {}
bool
CommandObjectBreakpointCommandAdd::Execute
(
Args& command,
CommandReturnObject &result
)
{
virtual Options *
GetOptions ()
{
return &m_options;
}
void
CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
CommandReturnObject &result)
{
InputReaderSP reader_sp (new InputReader(m_interpreter.GetDebugger()));
std::auto_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
if (reader_sp && data_ap.get())
{
BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release()));
bp_options->SetCallback (BreakpointOptionsCallbackFunction, baton_sp);
Error err (reader_sp->Initialize (CommandObjectBreakpointCommandAdd::GenerateBreakpointCommandCallback,
bp_options, // baton
eInputReaderGranularityLine, // token size, to pass to callback function
"DONE", // end token
"> ", // prompt
true)); // echo input
if (err.Success())
{
m_interpreter.GetDebugger().PushInputReader (reader_sp);
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
{
result.AppendError (err.AsCString());
result.SetStatus (eReturnStatusFailed);
}
}
else
{
result.AppendError("out of memory");
result.SetStatus (eReturnStatusFailed);
}
}
/// Set a one-liner as the callback for the breakpoint.
void
SetBreakpointCommandCallback (BreakpointOptions *bp_options,
const char *oneliner)
{
std::auto_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
// It's necessary to set both user_source and script_source to the oneliner.
// The former is used to generate callback description (as in breakpoint command list)
// while the latter is used for Python to interpret during the actual callback.
data_ap->user_source.AppendString (oneliner);
data_ap->script_source.assign (oneliner);
data_ap->stop_on_error = m_options.m_stop_on_error;
BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release()));
bp_options->SetCallback (BreakpointOptionsCallbackFunction, baton_sp);
return;
}
static size_t
GenerateBreakpointCommandCallback (void *baton,
InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len)
{
StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream();
bool batch_mode = reader.GetDebugger().GetCommandInterpreter().GetBatchCommandMode();
switch (notification)
{
case eInputReaderActivate:
if (!batch_mode)
{
out_stream->Printf ("%s\n", g_reader_instructions);
if (reader.GetPrompt())
out_stream->Printf ("%s", reader.GetPrompt());
out_stream->Flush();
}
break;
case eInputReaderDeactivate:
break;
case eInputReaderReactivate:
if (reader.GetPrompt() && !batch_mode)
{
out_stream->Printf ("%s", reader.GetPrompt());
out_stream->Flush();
}
break;
case eInputReaderAsynchronousOutputWritten:
break;
case eInputReaderGotToken:
if (bytes && bytes_len && baton)
{
BreakpointOptions *bp_options = (BreakpointOptions *) baton;
if (bp_options)
{
Baton *bp_options_baton = bp_options->GetBaton();
if (bp_options_baton)
((BreakpointOptions::CommandData *)bp_options_baton->m_data)->user_source.AppendString (bytes, bytes_len);
}
}
if (!reader.IsDone() && reader.GetPrompt() && !batch_mode)
{
out_stream->Printf ("%s", reader.GetPrompt());
out_stream->Flush();
}
break;
case eInputReaderInterrupt:
{
// Finish, and cancel the breakpoint command.
reader.SetIsDone (true);
BreakpointOptions *bp_options = (BreakpointOptions *) baton;
if (bp_options)
{
Baton *bp_options_baton = bp_options->GetBaton ();
if (bp_options_baton)
{
((BreakpointOptions::CommandData *) bp_options_baton->m_data)->user_source.Clear();
((BreakpointOptions::CommandData *) bp_options_baton->m_data)->script_source.clear();
}
}
if (!batch_mode)
{
out_stream->Printf ("Warning: No command attached to breakpoint.\n");
out_stream->Flush();
}
}
break;
case eInputReaderEndOfFile:
reader.SetIsDone (true);
break;
case eInputReaderDone:
break;
}
return bytes_len;
}
static bool
BreakpointOptionsCallbackFunction (void *baton,
StoppointCallbackContext *context,
lldb::user_id_t break_id,
lldb::user_id_t break_loc_id)
{
bool ret_value = true;
if (baton == NULL)
return true;
BreakpointOptions::CommandData *data = (BreakpointOptions::CommandData *) baton;
StringList &commands = data->user_source;
if (commands.GetSize() > 0)
{
ExecutionContext exe_ctx (context->exe_ctx_ref);
Target *target = exe_ctx.GetTargetPtr();
if (target)
{
CommandReturnObject result;
Debugger &debugger = target->GetDebugger();
// Rig up the results secondary output stream to the debugger's, so the output will come out synchronously
// if the debugger is set up that way.
StreamSP output_stream (debugger.GetAsyncOutputStream());
StreamSP error_stream (debugger.GetAsyncErrorStream());
result.SetImmediateOutputStream (output_stream);
result.SetImmediateErrorStream (error_stream);
bool stop_on_continue = true;
bool echo_commands = false;
bool print_results = true;
debugger.GetCommandInterpreter().HandleCommands (commands,
&exe_ctx,
stop_on_continue,
data->stop_on_error,
echo_commands,
print_results,
eLazyBoolNo,
result);
result.GetImmediateOutputStream()->Flush();
result.GetImmediateErrorStream()->Flush();
}
}
return ret_value;
}
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
m_use_commands (false),
m_use_script_language (false),
m_script_language (eScriptLanguageNone),
m_use_one_liner (false),
m_one_liner(),
m_function_name()
{
}
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 'o':
m_use_one_liner = true;
m_one_liner = option_arg;
break;
case 's':
m_script_language = (lldb::ScriptLanguage) Args::StringToOptionEnum (option_arg,
g_option_table[option_idx].enum_values,
eScriptLanguageNone,
error);
if (m_script_language == eScriptLanguagePython || m_script_language == eScriptLanguageDefault)
{
m_use_script_language = true;
}
else
{
m_use_script_language = false;
}
break;
case 'e':
{
bool success = false;
m_stop_on_error = Args::StringToBoolean(option_arg, false, &success);
if (!success)
error.SetErrorStringWithFormat("invalid value for stop-on-error: \"%s\"", option_arg);
}
break;
case 'F':
{
m_use_one_liner = false;
m_use_script_language = true;
m_function_name.assign(option_arg);
}
break;
default:
break;
}
return error;
}
void
OptionParsingStarting ()
{
m_use_commands = true;
m_use_script_language = false;
m_script_language = eScriptLanguageNone;
m_use_one_liner = false;
m_stop_on_error = true;
m_one_liner.clear();
m_function_name.clear();
}
const OptionDefinition*
GetDefinitions ()
{
return g_option_table;
}
// 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;
};
protected:
virtual bool
DoExecute (Args& command, CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
if (target == NULL)
@ -406,176 +583,60 @@ CommandObjectBreakpointCommandAdd::Execute
}
return result.Succeeded();
}
}
Options *
CommandObjectBreakpointCommandAdd::GetOptions ()
private:
CommandOptions m_options;
static const char *g_reader_instructions;
};
const char *
CommandObjectBreakpointCommandAdd::g_reader_instructions = "Enter your debugger command(s). Type 'DONE' to end.";
// FIXME: "script-type" needs to have its contents determined dynamically, so somebody can add a new scripting
// language to lldb and have it pickable here without having to change this enumeration by hand and rebuild lldb proper.
static OptionEnumValueElement
g_script_option_enumeration[4] =
{
return &m_options;
}
{ eScriptLanguageNone, "command", "Commands are in the lldb command interpreter language"},
{ eScriptLanguagePython, "python", "Commands are in the Python language."},
{ eSortOrderByName, "default-script", "Commands are in the default scripting language."},
{ 0, NULL, NULL }
};
const char *g_reader_instructions = "Enter your debugger command(s). Type 'DONE' to end.";
void
CommandObjectBreakpointCommandAdd::CollectDataForBreakpointCommandCallback
(
BreakpointOptions *bp_options,
CommandReturnObject &result
)
OptionDefinition
CommandObjectBreakpointCommandAdd::CommandOptions::g_option_table[] =
{
InputReaderSP reader_sp (new InputReader(m_interpreter.GetDebugger()));
std::auto_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
if (reader_sp && data_ap.get())
{
BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release()));
bp_options->SetCallback (CommandObjectBreakpointCommand::BreakpointOptionsCallbackFunction, baton_sp);
{ LLDB_OPT_SET_1, false, "one-liner", 'o', required_argument, NULL, NULL, eArgTypeOneLiner,
"Specify a one-line breakpoint command inline. Be sure to surround it with quotes." },
Error err (reader_sp->Initialize (CommandObjectBreakpointCommandAdd::GenerateBreakpointCommandCallback,
bp_options, // baton
eInputReaderGranularityLine, // token size, to pass to callback function
"DONE", // end token
"> ", // prompt
true)); // echo input
if (err.Success())
{
m_interpreter.GetDebugger().PushInputReader (reader_sp);
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
{
result.AppendError (err.AsCString());
result.SetStatus (eReturnStatusFailed);
}
}
else
{
result.AppendError("out of memory");
result.SetStatus (eReturnStatusFailed);
}
{ LLDB_OPT_SET_ALL, false, "stop-on-error", 'e', required_argument, NULL, NULL, eArgTypeBoolean,
"Specify whether breakpoint command execution should terminate on error." },
}
{ LLDB_OPT_SET_ALL, false, "script-type", 's', required_argument, g_script_option_enumeration, NULL, eArgTypeNone,
"Specify the language for the commands - if none is specified, the lldb command interpreter will be used."},
// Set a one-liner as the callback for the breakpoint.
void
CommandObjectBreakpointCommandAdd::SetBreakpointCommandCallback (BreakpointOptions *bp_options,
const char *oneliner)
{
std::auto_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
// It's necessary to set both user_source and script_source to the oneliner.
// The former is used to generate callback description (as in breakpoint command list)
// while the latter is used for Python to interpret during the actual callback.
data_ap->user_source.AppendString (oneliner);
data_ap->script_source.assign (oneliner);
data_ap->stop_on_error = m_options.m_stop_on_error;
BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release()));
bp_options->SetCallback (CommandObjectBreakpointCommand::BreakpointOptionsCallbackFunction, baton_sp);
return;
}
size_t
CommandObjectBreakpointCommandAdd::GenerateBreakpointCommandCallback
(
void *baton,
InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len
)
{
StreamSP out_stream = reader.GetDebugger().GetAsyncOutputStream();
bool batch_mode = reader.GetDebugger().GetCommandInterpreter().GetBatchCommandMode();
switch (notification)
{
case eInputReaderActivate:
if (!batch_mode)
{
out_stream->Printf ("%s\n", g_reader_instructions);
if (reader.GetPrompt())
out_stream->Printf ("%s", reader.GetPrompt());
out_stream->Flush();
}
break;
case eInputReaderDeactivate:
break;
case eInputReaderReactivate:
if (reader.GetPrompt() && !batch_mode)
{
out_stream->Printf ("%s", reader.GetPrompt());
out_stream->Flush();
}
break;
case eInputReaderAsynchronousOutputWritten:
break;
case eInputReaderGotToken:
if (bytes && bytes_len && baton)
{
BreakpointOptions *bp_options = (BreakpointOptions *) baton;
if (bp_options)
{
Baton *bp_options_baton = bp_options->GetBaton();
if (bp_options_baton)
((BreakpointOptions::CommandData *)bp_options_baton->m_data)->user_source.AppendString (bytes, bytes_len);
}
}
if (!reader.IsDone() && reader.GetPrompt() && !batch_mode)
{
out_stream->Printf ("%s", reader.GetPrompt());
out_stream->Flush();
}
break;
case eInputReaderInterrupt:
{
// Finish, and cancel the breakpoint command.
reader.SetIsDone (true);
BreakpointOptions *bp_options = (BreakpointOptions *) baton;
if (bp_options)
{
Baton *bp_options_baton = bp_options->GetBaton ();
if (bp_options_baton)
{
((BreakpointOptions::CommandData *) bp_options_baton->m_data)->user_source.Clear();
((BreakpointOptions::CommandData *) bp_options_baton->m_data)->script_source.clear();
}
}
if (!batch_mode)
{
out_stream->Printf ("Warning: No command attached to breakpoint.\n");
out_stream->Flush();
}
}
break;
case eInputReaderEndOfFile:
reader.SetIsDone (true);
break;
case eInputReaderDone:
break;
}
return bytes_len;
}
{ LLDB_OPT_SET_2, false, "python-function", 'F', required_argument, NULL, NULL, eArgTypePythonFunction,
"Give the name of a Python function to run as command for this breakpoint. Be sure to give a module name if appropriate."},
{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
//-------------------------------------------------------------------------
// CommandObjectBreakpointCommandDelete
//-------------------------------------------------------------------------
CommandObjectBreakpointCommandDelete::CommandObjectBreakpointCommandDelete (CommandInterpreter &interpreter) :
CommandObject (interpreter,
class CommandObjectBreakpointCommandDelete : public CommandObjectParsed
{
public:
CommandObjectBreakpointCommandDelete (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
"delete",
"Delete the set of commands from a breakpoint.",
NULL)
{
{
CommandArgumentEntry arg;
CommandArgumentData bp_id_arg;
@ -588,19 +649,16 @@ CommandObjectBreakpointCommandDelete::CommandObjectBreakpointCommandDelete (Comm
// Push the data for the first argument into the m_arguments vector.
m_arguments.push_back (arg);
}
}
CommandObjectBreakpointCommandDelete::~CommandObjectBreakpointCommandDelete ()
{
}
bool
CommandObjectBreakpointCommandDelete::Execute
(
Args& command,
CommandReturnObject &result
)
{
virtual
~CommandObjectBreakpointCommandDelete () {}
protected:
virtual bool
DoExecute (Args& command, CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
if (target == NULL)
@ -661,19 +719,22 @@ CommandObjectBreakpointCommandDelete::Execute
}
}
return result.Succeeded();
}
}
};
//-------------------------------------------------------------------------
// CommandObjectBreakpointCommandList
//-------------------------------------------------------------------------
CommandObjectBreakpointCommandList::CommandObjectBreakpointCommandList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
class CommandObjectBreakpointCommandList : public CommandObjectParsed
{
public:
CommandObjectBreakpointCommandList (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
"list",
"List the script or set of commands to be executed when the breakpoint is hit.",
NULL)
{
{
CommandArgumentEntry arg;
CommandArgumentData bp_id_arg;
@ -686,19 +747,16 @@ CommandObjectBreakpointCommandList::CommandObjectBreakpointCommandList (CommandI
// Push the data for the first argument into the m_arguments vector.
m_arguments.push_back (arg);
}
}
CommandObjectBreakpointCommandList::~CommandObjectBreakpointCommandList ()
{
}
virtual
~CommandObjectBreakpointCommandList () {}
bool
CommandObjectBreakpointCommandList::Execute
(
Args& command,
CommandReturnObject &result
)
{
protected:
virtual bool
DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
if (target == NULL)
@ -793,7 +851,8 @@ CommandObjectBreakpointCommandList::Execute
}
return result.Succeeded();
}
}
};
//-------------------------------------------------------------------------
// CommandObjectBreakpointCommand
@ -819,60 +878,8 @@ CommandObjectBreakpointCommand::CommandObjectBreakpointCommand (CommandInterpret
status = LoadSubCommand ("list", list_command_object);
}
CommandObjectBreakpointCommand::~CommandObjectBreakpointCommand ()
{
}
bool
CommandObjectBreakpointCommand::BreakpointOptionsCallbackFunction
(
void *baton,
StoppointCallbackContext *context,
lldb::user_id_t break_id,
lldb::user_id_t break_loc_id
)
{
bool ret_value = true;
if (baton == NULL)
return true;
BreakpointOptions::CommandData *data = (BreakpointOptions::CommandData *) baton;
StringList &commands = data->user_source;
if (commands.GetSize() > 0)
{
ExecutionContext exe_ctx (context->exe_ctx_ref);
Target *target = exe_ctx.GetTargetPtr();
if (target)
{
CommandReturnObject result;
Debugger &debugger = target->GetDebugger();
// Rig up the results secondary output stream to the debugger's, so the output will come out synchronously
// if the debugger is set up that way.
StreamSP output_stream (debugger.GetAsyncOutputStream());
StreamSP error_stream (debugger.GetAsyncErrorStream());
result.SetImmediateOutputStream (output_stream);
result.SetImmediateErrorStream (error_stream);
bool stop_on_continue = true;
bool echo_commands = false;
bool print_results = true;
debugger.GetCommandInterpreter().HandleCommands (commands,
&exe_ctx,
stop_on_continue,
data->stop_on_error,
echo_commands,
print_results,
eLazyBoolNo,
result);
result.GetImmediateOutputStream()->Flush();
result.GetImmediateErrorStream()->Flush();
}
}
return ret_value;
}

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,7 +210,7 @@ CommandObjectDisassemble::CommandOptions::g_option_table[] =
//-------------------------------------------------------------------------
CommandObjectDisassemble::CommandObjectDisassemble (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"disassemble",
"Disassemble bytes in the current function, or elsewhere in the executable program as specified by the user.",
"disassemble [<cmd-options>]"),
@ -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,
CommandObjectRaw (interpreter,
"expression",
"Evaluate a C/ObjC/C++ expression in the current program context, using variables currently in scope.",
NULL),
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,12 +52,12 @@ using namespace lldb_private;
// CommandObjectFrameInfo
//-------------------------------------------------------------------------
class CommandObjectFrameInfo : public CommandObject
class CommandObjectFrameInfo : public CommandObjectParsed
{
public:
CommandObjectFrameInfo (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"frame info",
"List information about the currently selected frame in the current thread.",
"frame info",
@ -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,7 +156,7 @@ public:
};
CommandObjectFrameSelect (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"frame select",
"Select a frame by index from within the current thread and make it the current frame.",
NULL,
@ -188,8 +189,9 @@ public:
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
@ -319,12 +321,12 @@ CommandObjectFrameSelect::CommandOptions::g_option_table[] =
//----------------------------------------------------------------------
// List images with associated information
//----------------------------------------------------------------------
class CommandObjectFrameVariable : public CommandObject
class CommandObjectFrameVariable : public CommandObjectParsed
{
public:
CommandObjectFrameVariable (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"frame variable",
"Show frame variables. All argument and local variables "
"that are in scope will be shown when no arguments are given. "
@ -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,7 +26,7 @@ using namespace lldb_private;
//-------------------------------------------------------------------------
CommandObjectHelp::CommandObjectHelp (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"help",
"Show a list of all debugger commands, or give details about specific commands.",
"help [<cmd-name>]"), m_options (interpreter)
@ -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,14 +42,14 @@ using namespace lldb;
using namespace lldb_private;
class CommandObjectLogEnable : public CommandObject
class CommandObjectLogEnable : public CommandObjectParsed
{
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
CommandObjectLogEnable(CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"log enable",
"Enable logging for a single log channel.",
NULL),
@ -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,14 +218,14 @@ 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,
CommandObjectParsed (interpreter,
"log disable",
"Disable one or more log channel categories.",
NULL)
@ -257,8 +257,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& args,
DoExecute (Args& args,
CommandReturnObject &result)
{
const size_t argc = args.GetArgumentCount();
@ -297,14 +298,14 @@ public:
}
};
class CommandObjectLogList : public CommandObject
class CommandObjectLogList : public CommandObjectParsed
{
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
CommandObjectLogList(CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"log list",
"List the log categories for one or more log channels. If none specified, lists them all.",
NULL)
@ -328,8 +329,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& args,
DoExecute (Args& args,
CommandReturnObject &result)
{
const size_t argc = args.GetArgumentCount();
@ -372,14 +374,14 @@ public:
}
};
class CommandObjectLogTimer : public CommandObject
class CommandObjectLogTimer : public CommandObjectParsed
{
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
CommandObjectLogTimer(CommandInterpreter &interpreter) :
CommandObject (interpreter,
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,12 +283,12 @@ public:
//----------------------------------------------------------------------
// Read memory from the inferior process
//----------------------------------------------------------------------
class CommandObjectMemoryRead : public CommandObject
class CommandObjectMemoryRead : public CommandObjectParsed
{
public:
CommandObjectMemoryRead (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"memory read",
"Read from the memory of the process being debugged.",
NULL,
@ -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,10 +867,9 @@ public:
};
CommandObjectMemoryWrite (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"memory write",
"Write to the memory of the process being debugged.",
//"memory write [<cmd-options>] <addr> [value1 value2 ...]",
NULL,
eFlagProcessMustBeLaunched),
m_option_group (interpreter),
@ -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,11 +31,11 @@ using namespace lldb_private;
//----------------------------------------------------------------------
// "platform select <platform-name>"
//----------------------------------------------------------------------
class CommandObjectPlatformSelect : public CommandObject
class CommandObjectPlatformSelect : public CommandObjectParsed
{
public:
CommandObjectPlatformSelect (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"platform select",
"Create a platform if needed and select it as the current platform.",
"platform select <platform-name>",
@ -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)
{
@ -90,36 +119,6 @@ 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,11 +126,11 @@ protected:
//----------------------------------------------------------------------
// "platform list"
//----------------------------------------------------------------------
class CommandObjectPlatformList : public CommandObject
class CommandObjectPlatformList : public CommandObjectParsed
{
public:
CommandObjectPlatformList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"platform list",
"List all platforms that are available.",
NULL,
@ -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,11 +181,11 @@ public:
//----------------------------------------------------------------------
// "platform status"
//----------------------------------------------------------------------
class CommandObjectPlatformStatus : public CommandObject
class CommandObjectPlatformStatus : public CommandObjectParsed
{
public:
CommandObjectPlatformStatus (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"platform status",
"Display status for the currently selected platform.",
NULL,
@ -198,8 +198,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& args, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
Stream &ostrm = result.GetOutputStream();
@ -221,11 +222,11 @@ public:
//----------------------------------------------------------------------
// "platform connect <connect-url>"
//----------------------------------------------------------------------
class CommandObjectPlatformConnect : public CommandObject
class CommandObjectPlatformConnect : public CommandObjectParsed
{
public:
CommandObjectPlatformConnect (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"platform connect",
"Connect a platform by name to be the currently selected platform.",
"platform connect <connect-url>",
@ -238,8 +239,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& args, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
Stream &ostrm = result.GetOutputStream();
@ -270,11 +272,11 @@ public:
//----------------------------------------------------------------------
// "platform disconnect"
//----------------------------------------------------------------------
class CommandObjectPlatformDisconnect : public CommandObject
class CommandObjectPlatformDisconnect : public CommandObjectParsed
{
public:
CommandObjectPlatformDisconnect (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"platform disconnect",
"Disconnect a platform by name to be the currently selected platform.",
"platform disconnect",
@ -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,11 +350,11 @@ public:
//----------------------------------------------------------------------
// "platform process launch"
//----------------------------------------------------------------------
class CommandObjectPlatformProcessLaunch : public CommandObject
class CommandObjectPlatformProcessLaunch : public CommandObjectParsed
{
public:
CommandObjectPlatformProcessLaunch (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"platform process launch",
"Launch a new process on a remote platform.",
"platform process launch program",
@ -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,11 +472,11 @@ protected:
//----------------------------------------------------------------------
// "platform process list"
//----------------------------------------------------------------------
class CommandObjectPlatformProcessList : public CommandObject
class CommandObjectPlatformProcessList : public CommandObjectParsed
{
public:
CommandObjectPlatformProcessList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"platform process list",
"List processes on a remote platform by name, pid, or many other matching attributes.",
"platform process list",
@ -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,11 +747,11 @@ CommandObjectPlatformProcessList::CommandOptions::g_option_table[] =
//----------------------------------------------------------------------
// "platform process info"
//----------------------------------------------------------------------
class CommandObjectPlatformProcessInfo : public CommandObject
class CommandObjectPlatformProcessInfo : public CommandObjectParsed
{
public:
CommandObjectPlatformProcessInfo (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"platform process info",
"Get detailed information for one or more process by process ID.",
"platform process info <pid> [<pid> <pid> ...]",
@ -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,11 +876,11 @@ private:
};
class CommandObjectPlatformShell : public CommandObject
class CommandObjectPlatformShell : public CommandObjectRaw
{
public:
CommandObjectPlatformShell (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectRaw (interpreter,
"platform shell",
"Run a shell command on a the selected platform.",
"platform shell <shell-command>",
@ -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,12 +31,12 @@ using namespace lldb_private;
// CommandObjectProcessLaunch
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessLaunch
class CommandObjectProcessLaunch : public CommandObject
class CommandObjectProcessLaunch : public CommandObjectParsed
{
public:
CommandObjectProcessLaunch (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"process launch",
"Launch the executable in the debugger.",
NULL),
@ -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,7 +433,7 @@ public:
};
CommandObjectProcessAttach (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"process attach",
"Attach to a process.",
"process attach <cmd-options>"),
@ -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,12 +631,12 @@ CommandObjectProcessAttach::CommandOptions::g_option_table[] =
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessContinue
class CommandObjectProcessContinue : public CommandObject
class CommandObjectProcessContinue : public CommandObjectParsed
{
public:
CommandObjectProcessContinue (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"process continue",
"Continue execution of all threads in the current process.",
"process continue",
@ -649,8 +649,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
@ -719,12 +720,12 @@ public:
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessDetach
class CommandObjectProcessDetach : public CommandObject
class CommandObjectProcessDetach : public CommandObjectParsed
{
public:
CommandObjectProcessDetach (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"process detach",
"Detach from the current process being debugged.",
"process detach",
@ -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,7 +831,7 @@ public:
};
CommandObjectProcessConnect (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"process connect",
"Connect to a remote debug service.",
"process connect <remote-url>",
@ -843,8 +845,15 @@ public:
}
Options *
GetOptions ()
{
return &m_options;
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
@ -920,14 +929,6 @@ public:
return result.Succeeded();
}
Options *
GetOptions ()
{
return &m_options;
}
protected:
CommandOptions m_options;
};
@ -944,12 +945,12 @@ CommandObjectProcessConnect::CommandOptions::g_option_table[] =
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessLoad
class CommandObjectProcessLoad : public CommandObject
class CommandObjectProcessLoad : public CommandObjectParsed
{
public:
CommandObjectProcessLoad (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"process load",
"Load a shared library into the current process.",
"process load <filename> [<filename> ...]",
@ -961,8 +962,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
@ -1003,12 +1005,12 @@ public:
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessUnload
class CommandObjectProcessUnload : public CommandObject
class CommandObjectProcessUnload : public CommandObjectParsed
{
public:
CommandObjectProcessUnload (CommandInterpreter &interpreter) :
CommandObject (interpreter,
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>",
@ -1020,8 +1022,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
@ -1069,12 +1072,12 @@ public:
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessSignal
class CommandObjectProcessSignal : public CommandObject
class CommandObjectProcessSignal : public CommandObjectParsed
{
public:
CommandObjectProcessSignal (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"process signal",
"Send a UNIX signal to the current process being debugged.",
NULL)
@ -1097,8 +1100,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
@ -1154,13 +1158,13 @@ public:
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessInterrupt
class CommandObjectProcessInterrupt : public CommandObject
class CommandObjectProcessInterrupt : public CommandObjectParsed
{
public:
CommandObjectProcessInterrupt (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"process interrupt",
"Interrupt the current process being debugged.",
"process interrupt",
@ -1172,8 +1176,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
@ -1217,12 +1222,12 @@ public:
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessKill
class CommandObjectProcessKill : public CommandObject
class CommandObjectProcessKill : public CommandObjectParsed
{
public:
CommandObjectProcessKill (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"process kill",
"Terminate the current process being debugged.",
"process kill",
@ -1234,8 +1239,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
@ -1275,11 +1281,11 @@ public:
//-------------------------------------------------------------------------
#pragma mark CommandObjectProcessStatus
class CommandObjectProcessStatus : public CommandObject
class CommandObjectProcessStatus : public CommandObjectParsed
{
public:
CommandObjectProcessStatus (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"process status",
"Show the current status and location of executing process.",
"process status",
@ -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,7 +1402,7 @@ public:
CommandObjectProcessHandle (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"process handle",
"Show or update what the process and debugger should do with various signals received from the OS.",
NULL),
@ -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,14 +34,13 @@ using namespace lldb_private;
//----------------------------------------------------------------------
// "register read"
//----------------------------------------------------------------------
class CommandObjectRegisterRead : public CommandObject
class CommandObjectRegisterRead : public CommandObjectParsed
{
public:
CommandObjectRegisterRead (CommandInterpreter &interpreter) :
CommandObject (interpreter,
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.",
//"register read [<reg-name1> [<reg-name2> [...]]]",
NULL,
eFlagProcessMustBeLaunched | eFlagProcessMustBePaused),
m_option_group (interpreter),
@ -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,11 +355,11 @@ CommandObjectRegisterRead::CommandOptions::GetNumDefinitions ()
//----------------------------------------------------------------------
// "register write"
//----------------------------------------------------------------------
class CommandObjectRegisterWrite : public CommandObject
class CommandObjectRegisterWrite : public CommandObjectParsed
{
public:
CommandObjectRegisterWrite (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"register write",
"Modify a single register value.",
NULL,
@ -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,7 +96,7 @@ class CommandObjectSourceInfo : public CommandObject
public:
CommandObjectSourceInfo(CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"source info",
"Display information about the source lines from the current executable's debug info.",
"source info [<cmd-options>]"),
@ -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,7 +228,7 @@ class CommandObjectSourceList : public CommandObject
public:
CommandObjectSourceList(CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"source list",
"Display source code (as specified) based on the current executable's debug info.",
NULL),
@ -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,7 +28,7 @@ using namespace lldb_private;
//-------------------------------------------------------------------------
CommandObjectSyntax::CommandObjectSyntax (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"syntax",
"Shows the correct syntax for a given debugger command.",
"syntax <command>")
@ -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,11 +138,11 @@ 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,
CommandObjectParsed (interpreter,
"target create",
"Create a target using the argument as the main executable.",
NULL),
@ -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,11 +311,11 @@ private:
// "target list"
//----------------------------------------------------------------------
class CommandObjectTargetList : public CommandObject
class CommandObjectTargetList : public CommandObjectParsed
{
public:
CommandObjectTargetList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"target list",
"List all current targets in the current debug session.",
NULL,
@ -326,8 +328,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& args, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
if (args.GetArgumentCount() == 0)
{
@ -356,11 +359,11 @@ public:
// "target select"
//----------------------------------------------------------------------
class CommandObjectTargetSelect : public CommandObject
class CommandObjectTargetSelect : public CommandObjectParsed
{
public:
CommandObjectTargetSelect (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"target select",
"Select a target as the current target by target index.",
NULL,
@ -373,8 +376,9 @@ public:
{
}
protected:
virtual bool
Execute (Args& args, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
if (args.GetArgumentCount() == 1)
{
@ -431,11 +435,11 @@ public:
// "target delete"
//----------------------------------------------------------------------
class CommandObjectTargetDelete : public CommandObject
class CommandObjectTargetDelete : public CommandObjectParsed
{
public:
CommandObjectTargetDelete (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"target delete",
"Delete one or more targets by target index.",
NULL,
@ -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,11 +552,11 @@ protected:
// "target variable"
//----------------------------------------------------------------------
class CommandObjectTargetVariable : public CommandObject
class CommandObjectTargetVariable : public CommandObjectParsed
{
public:
CommandObjectTargetVariable (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"target variable",
"Read global variable(s) prior to running your binary.",
NULL,
@ -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,12 +834,12 @@ protected:
#pragma mark CommandObjectTargetModulesSearchPathsAdd
class CommandObjectTargetModulesSearchPathsAdd : public CommandObject
class CommandObjectTargetModulesSearchPathsAdd : public CommandObjectParsed
{
public:
CommandObjectTargetModulesSearchPathsAdd (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"target modules search-paths add",
"Add new image search paths substitution pairs to the current target.",
NULL)
@ -866,8 +870,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@ -916,12 +921,12 @@ public:
#pragma mark CommandObjectTargetModulesSearchPathsClear
class CommandObjectTargetModulesSearchPathsClear : public CommandObject
class CommandObjectTargetModulesSearchPathsClear : public CommandObjectParsed
{
public:
CommandObjectTargetModulesSearchPathsClear (CommandInterpreter &interpreter) :
CommandObject (interpreter,
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,12 +960,12 @@ public:
#pragma mark CommandObjectTargetModulesSearchPathsInsert
class CommandObjectTargetModulesSearchPathsInsert : public CommandObject
class CommandObjectTargetModulesSearchPathsInsert : public CommandObjectParsed
{
public:
CommandObjectTargetModulesSearchPathsInsert (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"target modules search-paths insert",
"Insert a new image search path substitution pair into the current target at the specified index.",
NULL)
@ -1001,8 +1007,9 @@ public:
{
}
protected:
bool
Execute (Args& command,
DoExecute (Args& command,
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
@ -1073,12 +1080,12 @@ public:
#pragma mark CommandObjectTargetModulesSearchPathsList
class CommandObjectTargetModulesSearchPathsList : public CommandObject
class CommandObjectTargetModulesSearchPathsList : public CommandObjectParsed
{
public:
CommandObjectTargetModulesSearchPathsList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
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,12 +1125,12 @@ public:
#pragma mark CommandObjectTargetModulesSearchPathsQuery
class CommandObjectTargetModulesSearchPathsQuery : public CommandObject
class CommandObjectTargetModulesSearchPathsQuery : public CommandObjectParsed
{
public:
CommandObjectTargetModulesSearchPathsQuery (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"target modules search-paths query",
"Transform a path using the first applicable image search path.",
NULL)
@ -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,11 +2424,11 @@ public:
}
};
class CommandObjectTargetModulesAdd : public CommandObject
class CommandObjectTargetModulesAdd : public CommandObjectParsed
{
public:
CommandObjectTargetModulesAdd (CommandInterpreter &interpreter) :
CommandObject (interpreter,
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,7 +2838,7 @@ public:
};
CommandObjectTargetModulesList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"target modules list",
"List current executable and dependent shared library images.",
"target modules list [<cmd-options>]"),
@ -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,7 +3341,7 @@ public:
};
CommandObjectTargetModulesLookup (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"target modules lookup",
"Look up information within executable and dependent shared library images.",
NULL),
@ -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,11 +3722,11 @@ private:
class CommandObjectTargetSymbolsAdd : public CommandObject
class CommandObjectTargetSymbolsAdd : public CommandObjectParsed
{
public:
CommandObjectTargetSymbolsAdd (CommandInterpreter &interpreter) :
CommandObject (interpreter,
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,7 +4064,7 @@ public:
}
CommandObjectTargetStopHookAdd (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"target stop-hook add ",
"Add a hook to be executed when the target stops.",
"target stop-hook add"),
@ -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,12 +4318,12 @@ CommandObjectTargetStopHookAdd::CommandOptions::g_option_table[] =
// CommandObjectTargetStopHookDelete
//-------------------------------------------------------------------------
class CommandObjectTargetStopHookDelete : public CommandObject
class CommandObjectTargetStopHookDelete : public CommandObjectParsed
{
public:
CommandObjectTargetStopHookDelete (CommandInterpreter &interpreter) :
CommandObject (interpreter,
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,12 +4393,12 @@ 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,
CommandObjectParsed (interpreter,
name,
help,
syntax),
@ -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,12 +4464,12 @@ private:
// CommandObjectTargetStopHookList
//-------------------------------------------------------------------------
class CommandObjectTargetStopHookList : public CommandObject
class CommandObjectTargetStopHookList : public CommandObjectParsed
{
public:
CommandObjectTargetStopHookList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
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,7 +121,7 @@ public:
};
CommandObjectThreadBacktrace (CommandInterpreter &interpreter) :
CommandObject (interpreter,
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,
@ -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,12 +592,12 @@ CommandObjectThreadStepWithTypeAndScope::CommandOptions::g_option_table[] =
// CommandObjectThreadContinue
//-------------------------------------------------------------------------
class CommandObjectThreadContinue : public CommandObject
class CommandObjectThreadContinue : public CommandObjectParsed
{
public:
CommandObjectThreadContinue (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"thread continue",
"Continue execution of one or more threads in an active process.",
NULL,
@ -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,7 +873,7 @@ public:
};
CommandObjectThreadUntil (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"thread until",
"Run the current or specified thread until it reaches a given line number or leaves the current function.",
NULL,
@ -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,12 +1110,12 @@ CommandObjectThreadUntil::CommandOptions::g_option_table[] =
// CommandObjectThreadSelect
//-------------------------------------------------------------------------
class CommandObjectThreadSelect : public CommandObject
class CommandObjectThreadSelect : public CommandObjectParsed
{
public:
CommandObjectThreadSelect (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"thread select",
"Select a thread as the currently active thread.",
NULL,
@ -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,13 +1190,13 @@ public:
// CommandObjectThreadList
//-------------------------------------------------------------------------
class CommandObjectThreadList : public CommandObject
class CommandObjectThreadList : public CommandObjectParsed
{
public:
CommandObjectThreadList (CommandInterpreter &interpreter):
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"thread list",
"Show a summary of all current threads in a process.",
"thread list",
@ -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:
@ -302,8 +303,9 @@ private:
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,7 +421,7 @@ private:
public:
CommandObjectTypeFormatAdd (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"type format add",
"Add a new formatting style for a type.",
NULL),
@ -476,8 +478,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -544,11 +547,11 @@ CommandObjectTypeFormatAdd::CommandOptions::GetNumDefinitions ()
// CommandObjectTypeFormatDelete
//-------------------------------------------------------------------------
class CommandObjectTypeFormatDelete : public CommandObject
class CommandObjectTypeFormatDelete : public CommandObjectParsed
{
public:
CommandObjectTypeFormatDelete (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"type format delete",
"Delete an existing formatting style for a type.",
NULL)
@ -569,8 +572,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -612,11 +616,11 @@ public:
// CommandObjectTypeFormatClear
//-------------------------------------------------------------------------
class CommandObjectTypeFormatClear : public CommandObject
class CommandObjectTypeFormatClear : public CommandObjectParsed
{
public:
CommandObjectTypeFormatClear (CommandInterpreter &interpreter) :
CommandObject (interpreter,
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,11 +658,11 @@ 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,
CommandObjectParsed (interpreter,
"type format list",
"Show a list of current formatting styles.",
NULL)
@ -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,
CommandObjectParsed (interpreter,
"type summary add",
"Add a new summary style for a type.",
NULL), m_options (interpreter)
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,
CommandObjectParsed (interpreter,
"type summary delete",
"Delete an existing summary style for a type.",
NULL), m_options(interpreter)
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,
CommandObjectParsed (interpreter,
"type summary clear",
"Delete all existing summary styles.",
NULL), m_options(interpreter)
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,
CommandObjectParsed (interpreter,
"type summary list",
"Show a list of current summary styles.",
NULL), m_options(interpreter)
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,11 +1918,11 @@ CommandObjectTypeSummaryList::CommandOptions::g_option_table[] =
// CommandObjectTypeCategoryEnable
//-------------------------------------------------------------------------
class CommandObjectTypeCategoryEnable : public CommandObject
class CommandObjectTypeCategoryEnable : public CommandObjectParsed
{
public:
CommandObjectTypeCategoryEnable (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"type category enable",
"Enable a category as a source of formatters.",
NULL)
@ -1930,8 +1943,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -1974,11 +1988,11 @@ public:
// CommandObjectTypeCategoryDelete
//-------------------------------------------------------------------------
class CommandObjectTypeCategoryDelete : public CommandObject
class CommandObjectTypeCategoryDelete : public CommandObjectParsed
{
public:
CommandObjectTypeCategoryDelete (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"type category delete",
"Delete a category and all associated formatters.",
NULL)
@ -1999,8 +2013,9 @@ public:
{
}
protected:
bool
Execute (Args& command, CommandReturnObject &result)
DoExecute (Args& command, CommandReturnObject &result)
{
const size_t argc = command.GetArgumentCount();
@ -2046,11 +2061,11 @@ public:
// CommandObjectTypeCategoryDisable
//-------------------------------------------------------------------------
class CommandObjectTypeCategoryDisable : public CommandObject
class CommandObjectTypeCategoryDisable : public CommandObjectParsed
{
public:
CommandObjectTypeCategoryDisable (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"type category disable",
"Disable a category as a source of formatters.",
NULL)
@ -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,7 +2175,7 @@ private:
}
public:
CommandObjectTypeCategoryList (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"type category list",
"Provide a list of all existing categories.",
NULL)
@ -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,
CommandObjectParsed (interpreter,
"type filter list",
"Show a list of current filters.",
NULL), m_options(interpreter)
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,
CommandObjectParsed (interpreter,
"type synthetic list",
"Show a list of current synthetic providers.",
NULL), m_options(interpreter)
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,
CommandObjectParsed (interpreter,
"type filter delete",
"Delete an existing filter for a type.",
NULL), m_options(interpreter)
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,
CommandObjectParsed (interpreter,
"type synthetic delete",
"Delete an existing synthetic provider for a type.",
NULL), m_options(interpreter)
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,
CommandObjectParsed (interpreter,
"type filter clear",
"Delete all existing filters.",
NULL), m_options(interpreter)
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,
CommandObjectParsed (interpreter,
"type synthetic clear",
"Delete all existing synthetic providers.",
NULL), m_options(interpreter)
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,
CommandObjectParsed (interpreter,
"type synthetic add",
"Add a new synthetic provider for a type.",
NULL), m_options (interpreter)
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,7 +3767,7 @@ private:
public:
CommandObjectTypeFilterAdd (CommandInterpreter &interpreter) :
CommandObject (interpreter,
CommandObjectParsed (interpreter,
"type filter add",
"Add a new filter for a type.",
NULL),
@ -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,7 +30,7 @@ using namespace lldb_private;
//-------------------------------------------------------------------------
CommandObjectScript::CommandObjectScript (CommandInterpreter &interpreter, ScriptLanguage script_lang) :
CommandObject (interpreter,
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>]"),
@ -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;