Decoupled Options from CommandInterpreter.

Options used to store a reference to the CommandInterpreter instance
in the base Options class.  This made it impossible to parse options
independent of a CommandInterpreter.

This change removes the reference from the base class.  Instead, it
modifies the options-parsing-related methods to take an
ExecutionContext pointer, which the options may inspect if they need
to do so.

Closes https://reviews.llvm.org/D23416
Reviewers: clayborg, jingham

llvm-svn: 278440
This commit is contained in:
Todd Fiala 2016-08-11 23:51:28 +00:00
parent 1602421c85
commit e1cfbc7942
69 changed files with 915 additions and 695 deletions

View File

@ -314,10 +314,22 @@ public:
/// get processed start at the second argument. The first argument
/// is assumed to be the command and will not be touched.
///
/// param[in] platform_sp
/// The platform used for option validation. This is necessary
/// because an empty execution_context is not enough to get us
/// to a reasonable platform. If the platform isn't given,
/// we'll try to get it from the execution context. If we can't
/// get it from the execution context, we'll skip validation.
///
/// param[in] require_validation
/// When true, it will fail option parsing if validation could
/// not occur due to not having a platform.
///
/// @see class Options
//------------------------------------------------------------------
Error
ParseOptions (Options &options);
ParseOptions (Options &options, ExecutionContext *execution_context,
lldb::PlatformSP platform_sp, bool require_validation);
size_t
FindArgumentIndexForOption (Option *long_options, int long_options_index);

View File

@ -37,12 +37,12 @@ public:
GetDefinitions() override;
Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
bool
GetArchitecture (Platform *platform, ArchSpec &arch);

View File

@ -51,12 +51,12 @@ namespace lldb_private {
}
Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
OptionValueBoolean &
GetOptionValue ()

View File

@ -50,12 +50,12 @@ public:
}
Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
OptionValueFileSpec &
GetOptionValue ()
@ -105,12 +105,12 @@ public:
}
Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
OptionValueFileSpecList &
GetOptionValue ()

View File

@ -46,12 +46,12 @@ public:
GetDefinitions() override;
Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
lldb::Format
GetFormat () const
@ -111,7 +111,7 @@ public:
protected:
bool
ParserGDBFormatLetter (CommandInterpreter &interpreter,
ParserGDBFormatLetter (ExecutionContext *execution_context,
char format_letter,
lldb::Format &format,
uint32_t &byte_size);

View File

@ -37,12 +37,12 @@ public:
GetDefinitions() override;
Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
const OptionValueFileSpec &
GetFile ()

View File

@ -47,12 +47,12 @@ public:
GetDefinitions() override;
Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
lldb::PlatformSP
CreatePlatformWithOptions (CommandInterpreter &interpreter,

View File

@ -49,12 +49,12 @@ namespace lldb_private {
}
Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
OptionValueString &
GetOptionValue ()

View File

@ -50,12 +50,12 @@ namespace lldb_private {
}
Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
OptionValueUInt64 &
GetOptionValue ()

View File

@ -37,12 +37,12 @@ public:
GetDefinitions() override;
Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
const OptionValueUUID &
GetOptionValue () const

View File

@ -37,12 +37,12 @@ public:
GetDefinitions() override;
Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
bool
AnyOptionWasSet () const

View File

@ -37,12 +37,12 @@ namespace lldb_private {
GetDefinitions() override;
Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg) override;
SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
bool include_frame_options:1,
show_args:1, // Frame option only (include_frame_options == true)

View File

@ -39,12 +39,12 @@ namespace lldb_private {
GetDefinitions() override;
Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg) override;
SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
// Note:
// eWatchRead == LLDB_WATCH_TYPE_READ; and

View File

@ -117,7 +117,7 @@ namespace lldb_private {
class Options
{
public:
Options (CommandInterpreter &interpreter);
Options ();
virtual
~Options ();
@ -160,7 +160,8 @@ public:
void
GenerateOptionUsage (Stream &strm,
CommandObject *cmd);
CommandObject *cmd,
uint32_t screen_width);
bool
SupportsLongOption (const char *long_option);
@ -180,10 +181,10 @@ public:
// Option::OptionParsingStarting() like they did before. This was error
// prone and subclasses shouldn't have to do it.
void
NotifyOptionParsingStarting ();
NotifyOptionParsingStarting (ExecutionContext *execution_context);
Error
NotifyOptionParsingFinished ();
NotifyOptionParsingFinished (ExecutionContext *execution_context);
//------------------------------------------------------------------
/// Set the value of an option.
@ -196,12 +197,17 @@ public:
/// The argument value for the option that the user entered, or
/// nullptr if there is no argument for the current option.
///
/// @param[in] execution_context
/// The execution context to use for evaluating the option.
/// May be nullptr if the option is to be evaluated outside any
/// particular context.
///
/// @see Args::ParseOptions (Options&)
/// @see man getopt_long_only
//------------------------------------------------------------------
virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg) = 0;
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) = 0;
//------------------------------------------------------------------
/// Handles the generic bits of figuring out whether we are in an
@ -245,6 +251,7 @@ public:
int char_pos,
int match_start_point,
int max_return_elements,
CommandInterpreter &interpreter,
bool &word_complete,
lldb_private::StringList &matches);
@ -276,6 +283,9 @@ public:
/// See CommandObject::HandleCompletions for a description of
/// how these work.
///
/// @param[in] interpreter
/// The command interpreter in which we're doing completion.
///
/// @param[out] word_complete
/// \btrue if this is a complete option value (a space will
/// be inserted after the completion.) \bfalse otherwise.
@ -298,21 +308,15 @@ public:
int opt_element_index,
int match_start_point,
int max_return_elements,
CommandInterpreter &interpreter,
bool &word_complete,
StringList &matches);
CommandInterpreter&
GetInterpreter()
{
return m_interpreter;
}
protected:
// This is a set of options expressed as indexes into the options table for this Option.
typedef std::set<int> OptionSet;
typedef std::vector<OptionSet> OptionSetVector;
CommandInterpreter &m_interpreter;
std::vector<Option> m_getopt_table;
OptionSet m_seen_options;
OptionSetVector m_required_options;
@ -343,10 +347,10 @@ protected:
// option parse. Each subclass must override this function and revert
// all option settings to default values.
virtual void
OptionParsingStarting () = 0;
OptionParsingStarting (ExecutionContext *execution_context) = 0;
virtual Error
OptionParsingFinished ()
OptionParsingFinished (ExecutionContext *execution_context)
{
// If subclasses need to know when the options are done being parsed
// they can implement this function to do extra checking
@ -370,15 +374,15 @@ protected:
GetDefinitions () = 0;
virtual Error
SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) = 0;
SetOptionValue (uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) = 0;
virtual void
OptionParsingStarting (CommandInterpreter &interpreter) = 0;
OptionParsingStarting(ExecutionContext *execution_context) = 0;
virtual Error
OptionParsingFinished (CommandInterpreter &interpreter)
OptionParsingFinished(ExecutionContext *execution_context)
{
// If subclasses need to know when the options are done being parsed
// they can implement this function to do extra checking
@ -390,8 +394,8 @@ protected:
class OptionGroupOptions : public Options
{
public:
OptionGroupOptions (CommandInterpreter &interpreter) :
Options (interpreter),
OptionGroupOptions () :
Options (),
m_option_defs (),
m_option_infos (),
m_did_finalize (false)
@ -451,13 +455,14 @@ protected:
Error
SetOptionValue(uint32_t option_idx,
const char *option_arg) override;
const char *option_arg,
ExecutionContext *execution_context) override;
void
OptionParsingStarting() override;
OptionParsingStarting(ExecutionContext *execution_context) override;
Error
OptionParsingFinished() override;
OptionParsingFinished(ExecutionContext *execution_context) override;
const OptionDefinition*
GetDefinitions() override

View File

@ -1326,12 +1326,12 @@ class ModuleCache;
~OptionGroupPlatformRSync() override = default;
lldb_private::Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
const lldb_private::OptionDefinition*
GetDefinitions() override;
@ -1362,12 +1362,12 @@ class ModuleCache;
~OptionGroupPlatformSSH() override = default;
lldb_private::Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
uint32_t
GetNumDefinitions() override;
@ -1396,12 +1396,12 @@ class ModuleCache;
~OptionGroupPlatformCaching() override = default;
lldb_private::Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
uint32_t
GetNumDefinitions() override;

View File

@ -421,20 +421,21 @@ protected:
class ProcessLaunchCommandOptions : public Options
{
public:
ProcessLaunchCommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
ProcessLaunchCommandOptions () :
Options()
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
OptionParsingStarting (nullptr);
}
~ProcessLaunchCommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override;
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override;
void
OptionParsingStarting() override
OptionParsingStarting(ExecutionContext *execution_context) override
{
launch_info.Clear();
disable_aslr = eLazyBoolCalculate;

View File

@ -37,16 +37,18 @@ using namespace lldb_private;
//
CommandObjectArgs::CommandOptions::CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
Options()
{
// Keep only one place to reset the values to their defaults
OptionParsingStarting();
OptionParsingStarting(nullptr);
}
CommandObjectArgs::CommandOptions::~CommandOptions() = default;
Error
CommandObjectArgs::CommandOptions::SetOptionValue (uint32_t option_idx, const char *option_arg)
CommandObjectArgs::CommandOptions::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
@ -57,7 +59,8 @@ CommandObjectArgs::CommandOptions::SetOptionValue (uint32_t option_idx, const ch
}
void
CommandObjectArgs::CommandOptions::OptionParsingStarting ()
CommandObjectArgs::CommandOptions::OptionParsingStarting(
ExecutionContext *execution_context)
{
}

View File

@ -32,10 +32,11 @@ namespace lldb_private {
~CommandOptions() override;
Error
SetOptionValue(uint32_t option_idx, const char *option_arg) override;
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override;
void
OptionParsingStarting() override;
OptionParsingStarting(ExecutionContext *execution_context) override;
const OptionDefinition*
GetDefinitions() override;

View File

@ -69,7 +69,7 @@ public:
"breakpoint set",
"Sets a breakpoint or set of breakpoints in the executable.",
"breakpoint set <cmd-options>"),
m_options (interpreter)
m_options ()
{
}
@ -84,8 +84,8 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions () :
Options (),
m_condition (),
m_filenames (),
m_line_num (0),
@ -116,7 +116,8 @@ public:
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -125,8 +126,9 @@ public:
{
case 'a':
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
m_load_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
m_load_addr =
Args::StringToAddress(execution_context, option_arg,
LLDB_INVALID_ADDRESS, &error);
}
break;
@ -279,9 +281,10 @@ public:
case 'R':
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
lldb::addr_t tmp_offset_addr;
tmp_offset_addr = Args::StringToAddress(&exe_ctx, option_arg, 0, &error);
tmp_offset_addr =
Args::StringToAddress(execution_context, option_arg,
0, &error);
if (error.Success())
m_offset_addr = tmp_offset_addr;
}
@ -355,7 +358,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting (ExecutionContext *execution_context) override
{
m_condition.clear();
m_filenames.Clear();
@ -892,7 +895,7 @@ public:
"If no breakpoint is specified, acts on the last created breakpoint. "
"With the exception of -e, -d and -i, passing an empty argument clears the modification.",
nullptr),
m_options (interpreter)
m_options ()
{
CommandArgumentEntry arg;
CommandObject::AddIDsArgumentData(arg, eArgTypeBreakpointID, eArgTypeBreakpointIDRange);
@ -911,8 +914,8 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions () :
Options (),
m_ignore_count (0),
m_thread_id(LLDB_INVALID_THREAD_ID),
m_thread_id_passed(false),
@ -935,7 +938,8 @@ public:
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1031,7 +1035,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting (ExecutionContext *execution_context) override
{
m_ignore_count = 0;
m_thread_id = LLDB_INVALID_THREAD_ID;
@ -1418,7 +1422,7 @@ public:
"breakpoint list",
"List some or all breakpoints at configurable levels of detail.",
nullptr),
m_options (interpreter)
m_options ()
{
CommandArgumentEntry arg;
CommandArgumentData bp_id_arg;
@ -1445,8 +1449,8 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions () :
Options (),
m_level (lldb::eDescriptionLevelBrief),
m_use_dummy(false)
{
@ -1455,7 +1459,8 @@ public:
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1486,7 +1491,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting (ExecutionContext *execution_context) override
{
m_level = lldb::eDescriptionLevelFull;
m_internal = false;
@ -1622,7 +1627,7 @@ public:
: CommandObjectParsed(interpreter, "breakpoint clear",
"Delete or disable breakpoints matching the specified source file and line.",
"breakpoint clear <cmd-options>"),
m_options(interpreter)
m_options()
{
}
@ -1637,8 +1642,8 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions () :
Options (),
m_filename (),
m_line_num (0)
{
@ -1647,7 +1652,8 @@ public:
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1671,7 +1677,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting (ExecutionContext *execution_context) override
{
m_filename.clear();
m_line_num = 0;
@ -1815,7 +1821,7 @@ public:
"breakpoint delete",
"Delete the specified breakpoint(s). If no breakpoints are specified, delete them all.",
nullptr),
m_options (interpreter)
m_options()
{
CommandArgumentEntry arg;
CommandObject::AddIDsArgumentData(arg, eArgTypeBreakpointID, eArgTypeBreakpointIDRange);
@ -1834,8 +1840,8 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions () :
Options (),
m_use_dummy (false),
m_force (false)
{
@ -1844,7 +1850,8 @@ public:
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1868,7 +1875,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting (ExecutionContext *execution_context) override
{
m_use_dummy = false;
m_force = false;
@ -2025,9 +2032,9 @@ public:
}
Error
SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override
SetOptionValue (uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = g_breakpoint_name_options[option_idx].short_option;
@ -2056,7 +2063,7 @@ public:
}
void
OptionParsingStarting (CommandInterpreter &interpreter) override
OptionParsingStarting (ExecutionContext *execution_context) override
{
m_name.Clear();
m_breakpoint.Clear();
@ -2078,7 +2085,7 @@ public:
"Add a name to the breakpoints provided.",
"breakpoint name add <command-options> <breakpoint-id-list>"),
m_name_options(),
m_option_group(interpreter)
m_option_group()
{
// Create the first variant for the first (and only) argument for this command.
CommandArgumentEntry arg1;
@ -2171,7 +2178,7 @@ public:
"Delete a name from the breakpoints provided.",
"breakpoint name delete <command-options> <breakpoint-id-list>"),
m_name_options(),
m_option_group(interpreter)
m_option_group()
{
// Create the first variant for the first (and only) argument for this command.
CommandArgumentEntry arg1;
@ -2263,7 +2270,7 @@ public:
"List either the names for a breakpoint or the breakpoints for a given name.",
"breakpoint name list <command-options>"),
m_name_options(),
m_option_group(interpreter)
m_option_group()
{
m_option_group.Append (&m_name_options);
m_option_group.Finalize();

View File

@ -42,7 +42,7 @@ public:
" If no breakpoint is specified, adds the commands to the last created breakpoint.",
nullptr),
IOHandlerDelegateMultiline("DONE", IOHandlerDelegate::Completion::LLDBCommand),
m_options(interpreter)
m_options()
{
SetHelpLong (
R"(
@ -295,8 +295,8 @@ are no syntax errors may indicate that a function was declared but never called.
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions () :
Options (),
m_use_commands (false),
m_use_script_language (false),
m_script_language (eScriptLanguageNone),
@ -309,7 +309,8 @@ are no syntax errors may indicate that a function was declared but never called.
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -363,7 +364,7 @@ are no syntax errors may indicate that a function was declared but never called.
}
void
OptionParsingStarting () override
OptionParsingStarting (ExecutionContext *execution_context) override
{
m_use_commands = true;
m_use_script_language = false;
@ -566,7 +567,7 @@ public:
"delete",
"Delete the set of commands from a breakpoint.",
nullptr),
m_options (interpreter)
m_options()
{
CommandArgumentEntry arg;
CommandArgumentData bp_id_arg;
@ -593,16 +594,17 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
m_use_dummy (false)
CommandOptions() :
Options(),
m_use_dummy(false)
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -622,7 +624,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting (ExecutionContext *execution_context) override
{
m_use_dummy = false;
}

View File

@ -36,7 +36,7 @@ public:
"bugreport unwind",
"Create a bugreport for a bug in the stack unwinding code.",
nullptr),
m_option_group(interpreter),
m_option_group(),
m_outfile_options()
{
m_option_group.Append (&m_outfile_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1 | LLDB_OPT_SET_2 | LLDB_OPT_SET_3);

View File

@ -44,7 +44,7 @@ public:
"command history",
"Dump the history of commands in this session.",
nullptr),
m_options (interpreter)
m_options()
{
}
@ -60,8 +60,8 @@ protected:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions() :
Options(),
m_start_idx(0),
m_stop_idx(0),
m_count(0),
@ -72,7 +72,8 @@ protected:
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -107,7 +108,7 @@ protected:
}
void
OptionParsingStarting () override
OptionParsingStarting (ExecutionContext *execution_context) override
{
m_start_idx.Clear();
m_stop_idx.Clear();
@ -238,7 +239,7 @@ public:
CommandObjectCommandsSource(CommandInterpreter &interpreter)
: CommandObjectParsed(interpreter, "command source", "Read and execute LLDB commands from the file <filename>.",
nullptr),
m_options(interpreter)
m_options()
{
CommandArgumentEntry arg;
CommandArgumentData file_arg;
@ -274,8 +275,8 @@ public:
{
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eDiskFileCompletion,
completion_str.c_str(),
match_start_point,
@ -296,8 +297,8 @@ protected:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions() :
Options(),
m_stop_on_error (true),
m_silent_run (false),
m_stop_on_continue (true)
@ -307,7 +308,8 @@ protected:
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -335,7 +337,7 @@ protected:
}
void
OptionParsingStarting () override
OptionParsingStarting (ExecutionContext *execution_context) override
{
m_stop_on_error.Clear();
m_silent_run.Clear();
@ -454,9 +456,9 @@ protected:
}
Error
SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override
SetOptionValue (uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override
{
Error error;
@ -483,7 +485,7 @@ protected:
}
void
OptionParsingStarting (CommandInterpreter &interpreter) override
OptionParsingStarting (ExecutionContext *execution_context) override
{
m_help.Clear();
m_long_help.Clear();
@ -509,7 +511,7 @@ public:
CommandObjectCommandsAlias(CommandInterpreter &interpreter)
: CommandObjectRaw(interpreter, "command alias", "Define a custom command in terms of an existing command.",
nullptr),
m_option_group(interpreter),
m_option_group(),
m_command_options()
{
m_option_group.Append(&m_command_options);
@ -630,8 +632,9 @@ protected:
result.AppendError ("'command alias' requires at least two arguments");
return false;
}
m_option_group.NotifyOptionParsingStarting();
ExecutionContext exe_ctx = GetCommandInterpreter().GetExecutionContext();
m_option_group.NotifyOptionParsingStarting(&exe_ctx);
const char * remainder = nullptr;
@ -663,7 +666,7 @@ protected:
if (!ParseOptions (args, result))
return false;
Error error (m_option_group.NotifyOptionParsingFinished());
Error error (m_option_group.NotifyOptionParsingFinished(&exe_ctx));
if (error.Fail())
{
result.AppendError (error.AsCString());
@ -1092,7 +1095,7 @@ public:
"Define a custom command in terms of existing commands by matching regular expressions.",
"command regex <cmd-name> [s/<regex>/<subst>/ ...]"),
IOHandlerDelegateMultiline("", IOHandlerDelegate::Completion::LLDBCommand),
m_options(interpreter)
m_options()
{
SetHelpLong(R"(
)" "This command allows the user to create powerful regular expression commands \
@ -1359,15 +1362,16 @@ private:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1389,7 +1393,7 @@ private:
}
void
OptionParsingStarting () override
OptionParsingStarting (ExecutionContext *execution_context) override
{
m_help.clear();
m_syntax.clear();
@ -1676,7 +1680,7 @@ public:
"command script import",
"Import a scripting module in LLDB.",
nullptr),
m_options(interpreter)
m_options()
{
CommandArgumentEntry arg1;
CommandArgumentData cmd_arg;
@ -1706,8 +1710,8 @@ public:
{
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eDiskFileCompletion,
completion_str.c_str(),
match_start_point,
@ -1728,15 +1732,16 @@ protected:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1755,7 +1760,7 @@ protected:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_allow_reload = true;
}
@ -1850,7 +1855,7 @@ public:
"Add a scripted function as an LLDB command.",
nullptr),
IOHandlerDelegateMultiline ("DONE"),
m_options (interpreter)
m_options()
{
CommandArgumentEntry arg1;
CommandArgumentData cmd_arg;
@ -1878,8 +1883,8 @@ protected:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions() :
Options(),
m_class_name(),
m_funct_name(),
m_short_help(),
@ -1890,7 +1895,8 @@ protected:
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1923,7 +1929,7 @@ protected:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_class_name.clear();
m_funct_name.clear();

View File

@ -34,8 +34,8 @@
using namespace lldb;
using namespace lldb_private;
CommandObjectDisassemble::CommandOptions::CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter),
CommandObjectDisassemble::CommandOptions::CommandOptions() :
Options(),
num_lines_context(0),
num_instructions (0),
func_name(),
@ -50,13 +50,15 @@ CommandObjectDisassemble::CommandOptions::CommandOptions (CommandInterpreter &in
some_location_specified (false),
symbol_containing_addr ()
{
OptionParsingStarting();
OptionParsingStarting(nullptr);
}
CommandObjectDisassemble::CommandOptions::~CommandOptions() = default;
Error
CommandObjectDisassemble::CommandOptions::SetOptionValue (uint32_t option_idx, const char *option_arg)
CommandObjectDisassemble::CommandOptions::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
@ -88,16 +90,16 @@ CommandObjectDisassemble::CommandOptions::SetOptionValue (uint32_t option_idx, c
case 's':
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
start_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
start_addr = Args::StringToAddress(execution_context, option_arg,
LLDB_INVALID_ADDRESS, &error);
if (start_addr != LLDB_INVALID_ADDRESS)
some_location_specified = true;
}
break;
case 'e':
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
end_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
end_addr = Args::StringToAddress(execution_context, option_arg,
LLDB_INVALID_ADDRESS, &error);
if (end_addr != LLDB_INVALID_ADDRESS)
some_location_specified = true;
}
@ -127,9 +129,11 @@ CommandObjectDisassemble::CommandOptions::SetOptionValue (uint32_t option_idx, c
case 'F':
{
Target *target = m_interpreter.GetExecutionContext().GetTargetPtr();
if (target->GetArchitecture().GetTriple().getArch() == llvm::Triple::x86
|| target->GetArchitecture().GetTriple().getArch() == llvm::Triple::x86_64)
TargetSP target_sp = execution_context ?
execution_context->GetTargetSP() : TargetSP();
if (target_sp &&
(target_sp->GetArchitecture().GetTriple().getArch() == llvm::Triple::x86
|| target_sp->GetArchitecture().GetTriple().getArch() == llvm::Triple::x86_64))
{
flavor_string.assign (option_arg);
}
@ -148,14 +152,22 @@ CommandObjectDisassemble::CommandOptions::SetOptionValue (uint32_t option_idx, c
break;
case 'A':
if (!arch.SetTriple (option_arg, m_interpreter.GetPlatform (true).get()))
arch.SetTriple (option_arg);
if (execution_context)
{
auto target_sp = execution_context ?
execution_context->GetTargetSP() : TargetSP();
auto platform_sp =
target_sp ? target_sp->GetPlatform() : PlatformSP();
if (!arch.SetTriple (option_arg, platform_sp.get()))
arch.SetTriple (option_arg);
}
break;
case 'a':
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
symbol_containing_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
symbol_containing_addr =
Args::StringToAddress(execution_context,option_arg,
LLDB_INVALID_ADDRESS, &error);
if (symbol_containing_addr != LLDB_INVALID_ADDRESS)
{
some_location_specified = true;
@ -172,7 +184,8 @@ CommandObjectDisassemble::CommandOptions::SetOptionValue (uint32_t option_idx, c
}
void
CommandObjectDisassemble::CommandOptions::OptionParsingStarting ()
CommandObjectDisassemble::CommandOptions::OptionParsingStarting(
ExecutionContext *execution_context)
{
show_mixed = false;
show_bytes = false;
@ -188,7 +201,8 @@ CommandObjectDisassemble::CommandOptions::OptionParsingStarting ()
raw = false;
plugin_name.clear();
Target *target = m_interpreter.GetExecutionContext().GetTargetPtr();
Target *target =
execution_context ? execution_context->GetTargetPtr() : nullptr;
// This is a hack till we get the ability to specify features based on architecture. For now GetDisassemblyFlavor
// is really only valid for x86 (and for the llvm assembler plugin, but I'm papering over that since that is the
@ -212,7 +226,8 @@ CommandObjectDisassemble::CommandOptions::OptionParsingStarting ()
}
Error
CommandObjectDisassemble::CommandOptions::OptionParsingFinished ()
CommandObjectDisassemble::CommandOptions::OptionParsingFinished(
ExecutionContext *execution_context)
{
if (!some_location_specified)
current_function = true;
@ -262,7 +277,7 @@ CommandObjectDisassemble::CommandObjectDisassemble(CommandInterpreter &interpret
"Defaults to the current function for the current thread and "
"stack frame.",
"disassemble [<cmd-options>]"),
m_options(interpreter)
m_options()
{
}
@ -315,7 +330,10 @@ CommandObjectDisassemble::DoExecute (Args& command, CommandReturnObject &result)
if (command.GetArgumentCount() != 0)
{
result.AppendErrorWithFormat ("\"disassemble\" arguments are specified as options.\n");
GetOptions()->GenerateOptionUsage (result.GetErrorStream(), this);
const int terminal_width =
GetCommandInterpreter().GetDebugger().GetTerminalWidth();
GetOptions()->GenerateOptionUsage(result.GetErrorStream(), this,
terminal_width);
result.SetStatus (eReturnStatusFailed);
return false;
}

View File

@ -30,15 +30,16 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter);
CommandOptions();
~CommandOptions() override;
Error
SetOptionValue(uint32_t option_idx, const char *option_arg) override;
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override;
void
OptionParsingStarting() override;
OptionParsingStarting(ExecutionContext *execution_context) override;
const OptionDefinition*
GetDefinitions() override;
@ -58,7 +59,7 @@ public:
}
Error
OptionParsingFinished() override;
OptionParsingFinished(ExecutionContext *execution_context) override;
bool show_mixed; // Show mixed source/assembly
bool show_bytes;

View File

@ -74,9 +74,9 @@ CommandObjectExpression::CommandOptions::GetNumDefinitions ()
}
Error
CommandObjectExpression::CommandOptions::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
CommandObjectExpression::CommandOptions::SetOptionValue (uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
@ -188,13 +188,15 @@ CommandObjectExpression::CommandOptions::SetOptionValue (CommandInterpreter &int
}
void
CommandObjectExpression::CommandOptions::OptionParsingStarting (CommandInterpreter &interpreter)
CommandObjectExpression::CommandOptions::OptionParsingStarting(
ExecutionContext *execution_context)
{
Process *process = interpreter.GetExecutionContext().GetProcessPtr();
if (process != nullptr)
auto process_sp =
execution_context ? execution_context->GetProcessSP() : ProcessSP();
if (process_sp)
{
ignore_breakpoints = process->GetIgnoreBreakpointsInExpressions();
unwind_on_error = process->GetUnwindOnErrorInExpressions();
ignore_breakpoints = process_sp->GetIgnoreBreakpointsInExpressions();
unwind_on_error = process_sp->GetUnwindOnErrorInExpressions();
}
else
{
@ -225,7 +227,7 @@ CommandObjectExpression::CommandObjectExpression(CommandInterpreter &interpreter
"Evaluate an expression on the current thread. Displays any returned value with LLDB's default formatting.",
nullptr, eCommandProcessMustBePaused | eCommandTryTargetAPILock),
IOHandlerDelegate(IOHandlerDelegate::Completion::Expression),
m_option_group(interpreter),
m_option_group(),
m_format_options(eFormatDefault),
m_repl_option(LLDB_OPT_SET_1, false, "repl", 'r', "Drop into REPL", false, true),
m_command_options(),
@ -517,7 +519,8 @@ CommandObjectExpression::DoExecute(const char *command,
CommandReturnObject &result)
{
m_fixed_expression.clear();
m_option_group.NotifyOptionParsingStarting();
auto exe_ctx = GetCommandInterpreter().GetExecutionContext();
m_option_group.NotifyOptionParsingStarting(&exe_ctx);
const char * expr = nullptr;
@ -555,7 +558,7 @@ CommandObjectExpression::DoExecute(const char *command,
if (!ParseOptions (args, result))
return false;
Error error (m_option_group.NotifyOptionParsingFinished());
Error error (m_option_group.NotifyOptionParsingFinished(&exe_ctx));
if (error.Fail())
{
result.AppendError (error.AsCString());

View File

@ -44,12 +44,12 @@ public:
GetDefinitions() override;
Error
SetOptionValue(CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override;
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override;
void
OptionParsingStarting(CommandInterpreter &interpreter) override;
OptionParsingStarting(ExecutionContext *execution_context) override;
// Options table: Required for subclasses of Options.

View File

@ -90,16 +90,17 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
CommandOptions() :
Options()
{
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
bool success = false;
@ -121,7 +122,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
relative_frame_offset = INT32_MIN;
}
@ -144,7 +145,7 @@ public:
"Select the current stack frame by index from within the current thread (see 'thread backtrace'.)",
nullptr, eCommandRequiresThread | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched |
eCommandProcessMustBePaused),
m_options(interpreter)
m_options()
{
CommandArgumentEntry arg;
CommandArgumentData index_arg;
@ -247,7 +248,10 @@ protected:
{
result.AppendErrorWithFormat ("too many arguments; expected frame-index, saw '%s'.\n",
command.GetArgumentAtIndex(0));
m_options.GenerateOptionUsage (result.GetErrorStream(), this);
m_options.GenerateOptionUsage(result.GetErrorStream(), this,
GetCommandInterpreter()
.GetDebugger()
.GetTerminalWidth());
return false;
}
}
@ -294,7 +298,7 @@ public:
"'var->child.x'.",
nullptr, eCommandRequiresFrame | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched |
eCommandProcessMustBePaused | eCommandRequiresProcess),
m_option_group(interpreter),
m_option_group(),
m_option_variable(true), // Include the frame specific options by passing "true"
m_option_format(eFormatDefault),
m_varobj_options()
@ -339,8 +343,8 @@ public:
// Arguments are the standard source file completer.
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eVariablePathCompletion,
completion_str.c_str(),
match_start_point,

View File

@ -53,7 +53,7 @@ CommandObjectHelp::CommandObjectHelp(CommandInterpreter &interpreter)
: CommandObjectParsed(interpreter, "help",
"Show a list of all debugger commands, or give details about a specific command.",
"help [<cmd-name>]"),
m_options(interpreter)
m_options()
{
CommandArgumentEntry arg;
CommandArgumentData command_arg;

View File

@ -52,15 +52,16 @@ public:
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
}
~CommandOptions() override {}
Error
SetOptionValue(uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -85,7 +86,7 @@ public:
}
void
OptionParsingStarting() override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_show_aliases = true;
m_show_user_defined = true;

View File

@ -47,7 +47,7 @@ public:
"log enable",
"Enable logging for a single log channel.",
nullptr),
m_options (interpreter)
m_options()
{
CommandArgumentEntry arg1;
CommandArgumentEntry arg2;
@ -104,17 +104,18 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
log_file (),
log_options (0)
CommandOptions() :
Options(),
log_file(),
log_options(0)
{
}
~CommandOptions () override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -140,7 +141,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
log_file.Clear();
log_options = 0;

View File

@ -86,9 +86,9 @@ public:
}
Error
SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg) override
SetOptionValue (uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = g_option_table[option_idx].short_option;
@ -125,7 +125,7 @@ public:
}
void
OptionParsingStarting (CommandInterpreter &interpreter) override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_num_per_line.Clear();
m_output_as_binary = false;
@ -323,7 +323,7 @@ public:
CommandObjectMemoryRead(CommandInterpreter &interpreter)
: CommandObjectParsed(interpreter, "memory read", "Read from the memory of the current target process.",
nullptr, eCommandRequiresTarget | eCommandProcessMustBePaused),
m_option_group(interpreter),
m_option_group(),
m_format_options(eFormatBytesWithASCII, 1, 8),
m_memory_options(),
m_outfile_options(),
@ -993,9 +993,9 @@ public:
}
Error
SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg) override
SetOptionValue (uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = g_memory_find_option_table[option_idx].short_option;
@ -1028,7 +1028,7 @@ public:
}
void
OptionParsingStarting (CommandInterpreter &interpreter) override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_expr.Clear();
m_string.Clear();
@ -1044,7 +1044,7 @@ public:
CommandObjectMemoryFind(CommandInterpreter &interpreter)
: CommandObjectParsed(interpreter, "memory find", "Find a value in the memory of the current target process.",
nullptr, eCommandRequiresProcess | eCommandProcessMustBeLaunched),
m_option_group(interpreter),
m_option_group(),
m_memory_options()
{
CommandArgumentEntry arg1;
@ -1274,9 +1274,9 @@ public:
}
Error
SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg) override
SetOptionValue (uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = g_memory_write_option_table[option_idx].short_option;
@ -1311,7 +1311,7 @@ public:
}
void
OptionParsingStarting (CommandInterpreter &interpreter) override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_infile.Clear();
m_infile_offset = 0;
@ -1324,7 +1324,7 @@ public:
CommandObjectMemoryWrite(CommandInterpreter &interpreter)
: CommandObjectParsed(interpreter, "memory write", "Write to the memory of the current target process.",
nullptr, eCommandRequiresProcess | eCommandProcessMustBeLaunched),
m_option_group(interpreter),
m_option_group(),
m_format_options(eFormatBytes, 1, UINT64_MAX),
m_memory_options()
{

View File

@ -89,9 +89,9 @@ public:
~OptionPermissions() override = default;
lldb_private::Error
SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg) override
SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
char short_option = (char) GetDefinitions()[option_idx].short_option;
@ -152,7 +152,7 @@ public:
}
void
OptionParsingStarting (CommandInterpreter &interpreter) override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_permissions = 0;
}
@ -189,7 +189,7 @@ public:
"Create a platform if needed and select it as the current platform.",
"platform select <platform-name>",
0),
m_option_group (interpreter),
m_option_group (),
m_platform_options (false) // Don't include the "--platform" option by passing false
{
m_option_group.Append (&m_platform_options, LLDB_OPT_SET_ALL, 1);
@ -210,7 +210,7 @@ public:
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
CommandCompletions::PlatformPluginNames(m_interpreter,
CommandCompletions::PlatformPluginNames(GetCommandInterpreter(),
completion_str.c_str(),
match_start_point,
max_return_elements,
@ -517,7 +517,7 @@ public:
"Set settings for the current target's platform, or for a platform by name.",
"platform settings",
0),
m_options (interpreter),
m_options(),
m_option_working_dir (LLDB_OPT_SET_1, false, "working-dir", 'w', 0, eArgTypePath, "The working directory for the platform.")
{
m_options.Append (&m_option_working_dir, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
@ -568,7 +568,7 @@ public:
"Make a new directory on the remote end.",
nullptr,
0),
m_options(interpreter)
m_options()
{
}
@ -633,7 +633,7 @@ public:
"Open a file on the remote end.",
nullptr,
0),
m_options(interpreter)
m_options()
{
}
@ -752,7 +752,7 @@ public:
"Read data from a file on the remote end.",
nullptr,
0),
m_options (interpreter)
m_options()
{
}
@ -792,15 +792,16 @@ protected:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
char short_option = (char) m_getopt_table[option_idx].val;
@ -827,7 +828,7 @@ protected:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_offset = 0;
m_count = 1;
@ -872,7 +873,7 @@ public:
"Write data to a file on the remote end.",
nullptr,
0),
m_options (interpreter)
m_options()
{
}
@ -914,15 +915,16 @@ protected:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
char short_option = (char) m_getopt_table[option_idx].val;
@ -947,7 +949,7 @@ protected:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_offset = 0;
m_data.clear();
@ -1220,7 +1222,7 @@ public:
"Launch a new process on a remote platform.",
"platform process launch program",
eCommandRequiresTarget | eCommandTryTargetAPILock),
m_options (interpreter)
m_options()
{
}
@ -1332,7 +1334,7 @@ public:
"List processes on a remote platform by name, pid, or many other matching attributes.",
"platform process list",
0),
m_options (interpreter)
m_options()
{
}
@ -1451,8 +1453,8 @@ protected:
class CommandOptions : public Options
{
public:
CommandOptions(CommandInterpreter &interpreter) :
Options(interpreter),
CommandOptions() :
Options(),
match_info(),
show_args(false),
verbose(false)
@ -1480,7 +1482,8 @@ protected:
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1525,7 +1528,18 @@ protected:
break;
case 'a':
match_info.GetProcessInfo().GetArchitecture().SetTriple (option_arg, m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform().get());
{
TargetSP target_sp = execution_context ?
execution_context->GetTargetSP() : TargetSP();
DebuggerSP debugger_sp = target_sp ?
target_sp->GetDebugger().shared_from_this() :
DebuggerSP();
PlatformSP platform_sp = debugger_sp ?
debugger_sp->GetPlatformList().GetSelectedPlatform() :
PlatformSP();
match_info.GetProcessInfo().GetArchitecture().SetTriple(
option_arg, platform_sp.get());
}
break;
case 'n':
@ -1570,7 +1584,7 @@ protected:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
match_info.Clear();
show_args = false;
@ -1727,17 +1741,18 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
CommandOptions() :
Options()
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
char short_option = (char) m_getopt_table[option_idx].val;
@ -1778,7 +1793,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
attach_info.Clear();
}
@ -1797,6 +1812,7 @@ public:
int opt_element_index,
int match_start_point,
int max_return_elements,
CommandInterpreter &interpreter,
bool &word_complete,
StringList &matches) override
{
@ -1816,7 +1832,7 @@ public:
const char *partial_name = nullptr;
partial_name = input.GetArgumentAtIndex(opt_arg_pos);
PlatformSP platform_sp (m_interpreter.GetPlatform (true));
PlatformSP platform_sp(interpreter.GetPlatform(true));
if (platform_sp)
{
ProcessInstanceInfoList process_infos;
@ -1856,7 +1872,7 @@ public:
"platform process attach",
"Attach to a process.",
"platform process attach <cmd-options>"),
m_options (interpreter)
m_options()
{
}
@ -1948,8 +1964,8 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter),
CommandOptions() :
Options(),
timeout(10)
{
}
@ -1970,7 +1986,8 @@ public:
Error
SetOptionValue (uint32_t option_idx,
const char *option_value) override
const char *option_value,
ExecutionContext *execution_context) override
{
Error error;
@ -1995,7 +2012,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
}
@ -2008,7 +2025,7 @@ public:
CommandObjectPlatformShell(CommandInterpreter &interpreter)
: CommandObjectRaw(interpreter, "platform shell", "Run a shell command on the current platform.",
"platform shell <shell-command>", 0),
m_options(interpreter)
m_options()
{
}
@ -2023,7 +2040,9 @@ public:
bool
DoExecute (const char *raw_command_line, CommandReturnObject &result) override
{
m_options.NotifyOptionParsingStarting();
ExecutionContext exe_ctx =
GetCommandInterpreter().GetExecutionContext();
m_options.NotifyOptionParsingStarting(&exe_ctx);
const char* expr = nullptr;

View File

@ -56,8 +56,8 @@ public:
{
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eDiskFileCompletion,
completion_str.c_str(),
match_start_point,

View File

@ -126,7 +126,7 @@ public:
nullptr,
eCommandRequiresTarget,
"restart"),
m_options (interpreter)
m_options()
{
CommandArgumentEntry arg;
CommandArgumentData run_args_arg;
@ -156,8 +156,8 @@ public:
{
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eDiskFileCompletion,
completion_str.c_str(),
match_start_point,
@ -328,17 +328,18 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
CommandOptions() :
Options()
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -387,7 +388,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
attach_info.Clear();
}
@ -406,6 +407,7 @@ public:
int opt_element_index,
int match_start_point,
int max_return_elements,
CommandInterpreter &interpreter,
bool &word_complete,
StringList &matches) override
{
@ -425,7 +427,7 @@ public:
const char *partial_name = nullptr;
partial_name = input.GetArgumentAtIndex(opt_arg_pos);
PlatformSP platform_sp (m_interpreter.GetPlatform (true));
PlatformSP platform_sp(interpreter.GetPlatform(true));
if (platform_sp)
{
ProcessInstanceInfoList process_infos;
@ -467,7 +469,7 @@ public:
"process attach <cmd-options>",
0,
"attach"),
m_options (interpreter)
m_options()
{
}
@ -632,7 +634,7 @@ public:
eCommandTryTargetAPILock |
eCommandProcessMustBeLaunched |
eCommandProcessMustBePaused ),
m_options(interpreter)
m_options()
{
}
@ -642,17 +644,18 @@ protected:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
CommandOptions() :
Options()
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -673,7 +676,7 @@ protected:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_ignore = 0;
}
@ -818,16 +821,17 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -856,7 +860,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_keep_stopped = eLazyBoolCalculate;
}
@ -879,7 +883,7 @@ public:
: CommandObjectParsed(interpreter, "process detach", "Detach from the current target process.",
"process detach",
eCommandRequiresProcess | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched),
m_options(interpreter)
m_options()
{
}
@ -943,17 +947,18 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
CommandOptions() :
Options()
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -972,7 +977,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
plugin_name.clear();
}
@ -998,7 +1003,7 @@ public:
"Connect to a remote debug service.",
"process connect <remote-url>",
0),
m_options (interpreter)
m_options()
{
}
@ -1100,17 +1105,18 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
CommandOptions() :
Options()
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1129,7 +1135,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
do_install = false;
install_path.Clear();
@ -1158,7 +1164,7 @@ public:
eCommandTryTargetAPILock |
eCommandProcessMustBeLaunched |
eCommandProcessMustBePaused ),
m_options (interpreter)
m_options()
{
}
@ -1577,16 +1583,17 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1610,7 +1617,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
stop.clear();
notify.clear();
@ -1639,7 +1646,7 @@ public:
interpreter, "process handle",
"Manage LLDB handling of OS signals for the current target process. Defaults to showing current policy.",
nullptr),
m_options(interpreter)
m_options()
{
SetHelpLong ("\nIf no signals are specified, update them all. If no update "
"option is specified, list the current values.");

View File

@ -50,7 +50,7 @@ public:
eCommandRequiresRegContext |
eCommandProcessMustBeLaunched |
eCommandProcessMustBePaused ),
m_option_group (interpreter),
m_option_group(),
m_format_options (eFormatDefault),
m_command_options ()
{
@ -279,7 +279,7 @@ protected:
}
void
OptionParsingStarting (CommandInterpreter &interpreter) override
OptionParsingStarting(ExecutionContext *execution_context) override
{
set_indexes.Clear();
dump_all_sets.Clear();
@ -287,9 +287,9 @@ protected:
}
Error
SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override
SetOptionValue (uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = g_option_table[option_idx].short_option;

View File

@ -32,7 +32,7 @@ class CommandObjectSettingsSet : public CommandObjectRaw
public:
CommandObjectSettingsSet(CommandInterpreter &interpreter)
: CommandObjectRaw(interpreter, "settings set", "Set the value of the specified debugger setting.", nullptr),
m_options(interpreter)
m_options()
{
CommandArgumentEntry arg1;
CommandArgumentEntry arg2;
@ -95,16 +95,17 @@ insert-before or insert-after."
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
m_global (false)
CommandOptions() :
Options(),
m_global(false)
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -123,7 +124,7 @@ insert-before or insert-after."
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_global = false;
}
@ -168,7 +169,7 @@ insert-before or insert-after."
if (cursor_index == setting_var_idx)
{
// Attempting to complete setting variable name
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eSettingsNameCompletion,
completion_str.c_str(),
match_start_point,
@ -328,7 +329,7 @@ public:
{
std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eSettingsNameCompletion,
completion_str.c_str(),
match_start_point,
@ -418,7 +419,7 @@ public:
{
std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eSettingsNameCompletion,
completion_str.c_str(),
match_start_point,
@ -524,7 +525,7 @@ public:
// Attempting to complete variable name
if (cursor_index < 2)
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eSettingsNameCompletion,
completion_str.c_str(),
match_start_point,
@ -532,7 +533,6 @@ public:
nullptr,
word_complete,
matches);
return matches.GetSize();
}
@ -655,7 +655,7 @@ public:
// Attempting to complete variable name
if (cursor_index < 2)
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eSettingsNameCompletion,
completion_str.c_str(),
match_start_point,
@ -774,7 +774,7 @@ public:
// Attempting to complete variable name
if (cursor_index < 2)
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eSettingsNameCompletion,
completion_str.c_str(),
match_start_point,
@ -896,7 +896,7 @@ public:
// Attempting to complete variable name
if (cursor_index < 2)
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eSettingsNameCompletion,
completion_str.c_str(),
match_start_point,
@ -1007,7 +1007,7 @@ public:
// Attempting to complete variable name
if (cursor_index < 2)
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eSettingsNameCompletion,
completion_str.c_str(),
match_start_point,
@ -1106,7 +1106,7 @@ public:
// Attempting to complete variable name
if (cursor_index < 2)
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eSettingsNameCompletion,
completion_str.c_str(),
match_start_point,

View File

@ -45,12 +45,13 @@ class CommandObjectSourceInfo : public CommandObjectParsed
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) : Options(interpreter) {}
CommandOptions() : Options() {}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = g_option_table[option_idx].short_option;
@ -84,8 +85,10 @@ class CommandObjectSourceInfo : public CommandObjectParsed
case 'a':
{
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
address = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
address = Args::StringToAddress(execution_context,
option_arg,
LLDB_INVALID_ADDRESS,
&error);
}
break;
case 's':
@ -100,7 +103,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
file_spec.Clear();
file_name.clear();
@ -137,7 +140,7 @@ public:
"process. Defaults to instruction pointer in current stack "
"frame.",
nullptr, eCommandRequiresTarget),
m_options(interpreter)
m_options()
{
}
@ -728,15 +731,16 @@ class CommandObjectSourceList : public CommandObjectParsed
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
CommandOptions() :
Options()
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = g_option_table[option_idx].short_option;
@ -764,8 +768,10 @@ class CommandObjectSourceList : public CommandObjectParsed
case 'a':
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
address = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
address = Args::StringToAddress(execution_context,
option_arg,
LLDB_INVALID_ADDRESS,
&error);
}
break;
case 's':
@ -787,7 +793,7 @@ class CommandObjectSourceList : public CommandObjectParsed
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
file_spec.Clear();
file_name.clear();
@ -825,7 +831,7 @@ public:
: CommandObjectParsed(interpreter, "source list",
"Display source code for the current target process as specified by options.", nullptr,
eCommandRequiresTarget),
m_options(interpreter)
m_options()
{
}

View File

@ -157,7 +157,7 @@ public:
"target create",
"Create a target using the argument as the main executable.",
nullptr),
m_option_group (interpreter),
m_option_group (),
m_arch_option (),
m_core_file (LLDB_OPT_SET_1, false, "core", 'c', 0, eArgTypeFilename, "Fullpath to a core file to use for this target."),
m_platform_path (LLDB_OPT_SET_1, false, "platform-path", 'P', 0, eArgTypePath, "Path to the remote file to use for this target."),
@ -208,7 +208,7 @@ public:
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eDiskFileCompletion,
completion_str.c_str(),
match_start_point,
@ -594,7 +594,7 @@ public:
"target delete",
"Delete one or more targets by target index.",
nullptr),
m_option_group(interpreter),
m_option_group(),
m_all_option(LLDB_OPT_SET_1, false, "all", 'a', "Delete all targets.", false, true),
m_cleanup_option(
LLDB_OPT_SET_1,
@ -728,7 +728,7 @@ public:
: CommandObjectParsed(interpreter, "target variable",
"Read global variables for the current target, before or while running a process.",
nullptr, eCommandRequiresTarget),
m_option_group(interpreter),
m_option_group(),
m_option_variable(false), // Don't include frame options
m_option_format(eFormatDefault),
m_option_compile_units(LLDB_OPT_SET_1, false, "file", SHORT_OPTION_FILE, 0, eArgTypeFilename,
@ -2068,7 +2068,7 @@ public:
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eModuleCompletion,
completion_str.c_str(),
match_start_point,
@ -2127,7 +2127,7 @@ public:
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eSourceFileCompletion,
completion_str.c_str(),
match_start_point,
@ -2220,7 +2220,7 @@ public:
"target modules dump symtab",
"Dump the symbol table from one or more target modules.",
nullptr),
m_options(interpreter)
m_options()
{
}
@ -2235,16 +2235,17 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter),
m_sort_order (eSortOrderNone)
CommandOptions() :
Options(),
m_sort_order(eSortOrderNone)
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -2266,7 +2267,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_sort_order = eSortOrderNone;
}
@ -2704,7 +2705,7 @@ public:
"target modules add",
"Add a new module to the current target's modules.",
"target modules add [<module>]"),
m_option_group (interpreter),
m_option_group(),
m_symbol_file (LLDB_OPT_SET_1, false, "symfile", 's', 0, eArgTypeFilename, "Fullpath to a stand alone debug symbols file for when debug symbols are not in the executable.")
{
m_option_group.Append (&m_uuid_option_group, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
@ -2733,7 +2734,7 @@ public:
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eDiskFileCompletion,
completion_str.c_str(),
match_start_point,
@ -2900,7 +2901,7 @@ public:
"target modules load",
"Set the load addresses for one or more sections in a target module.",
"target modules load [--file <module> --uuid <uuid>] <sect-name> <address> [<sect-name> <address> ....]"),
m_option_group (interpreter),
m_option_group(),
m_file_option (LLDB_OPT_SET_1, false, "file", 'f', 0, eArgTypeName, "Fullpath or basename for module to load.", ""),
m_slide_option(LLDB_OPT_SET_1, false, "slide", 's', 0, eArgTypeOffset, "Set the load address for all sections to be the virtual address in the file plus the offset.", 0)
{
@ -3155,8 +3156,8 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter),
CommandOptions() :
Options(),
m_format_array(),
m_use_global_module_list (false),
m_module_addr (LLDB_INVALID_ADDRESS)
@ -3166,7 +3167,8 @@ public:
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
@ -3177,8 +3179,10 @@ public:
}
else if (short_option == 'a')
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
m_module_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
m_module_addr = Args::StringToAddress(execution_context,
option_arg,
LLDB_INVALID_ADDRESS,
&error);
}
else
{
@ -3191,7 +3195,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_format_array.clear();
m_use_global_module_list = false;
@ -3220,7 +3224,7 @@ public:
"target modules list",
"List current executable and dependent shared library images.",
"target modules list [<cmd-options>]"),
m_options (interpreter)
m_options()
{
}
@ -3594,8 +3598,8 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter),
CommandOptions() :
Options(),
m_type(eLookupTypeInvalid),
m_str(),
m_addr(LLDB_INVALID_ADDRESS)
@ -3605,7 +3609,8 @@ public:
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
@ -3615,10 +3620,12 @@ public:
{
case 'a':
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
m_str = option_arg;
m_type = eLookupTypeAddress;
m_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
m_addr = Args::StringToAddress(execution_context,
option_arg,
LLDB_INVALID_ADDRESS,
&error);
if (m_addr == LLDB_INVALID_ADDRESS)
error.SetErrorStringWithFormat ("invalid address string '%s'", option_arg);
break;
@ -3638,7 +3645,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_type = eLookupTypeInvalid;
m_str.clear();
@ -3671,7 +3678,7 @@ public:
eCommandRequiresProcess |
eCommandProcessMustBeLaunched |
eCommandProcessMustBePaused ),
m_options (interpreter)
m_options()
{
}
@ -3900,16 +3907,17 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
CommandOptions() :
Options()
{
OptionParsingStarting();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
@ -3920,8 +3928,10 @@ public:
case 'a':
{
m_type = eLookupTypeAddress;
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
m_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
m_addr = Args::StringToAddress(execution_context,
option_arg,
LLDB_INVALID_ADDRESS,
&error);
}
break;
@ -3986,7 +3996,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_type = eLookupTypeInvalid;
m_str.clear();
@ -4027,7 +4037,7 @@ public:
"Look up information within executable and dependent shared library images.",
nullptr,
eCommandRequiresTarget),
m_options (interpreter)
m_options()
{
CommandArgumentEntry arg;
CommandArgumentData file_arg;
@ -4190,7 +4200,10 @@ public:
break;
default:
m_options.GenerateOptionUsage (result.GetErrorStream(), this);
m_options.GenerateOptionUsage(result.GetErrorStream(), this,
GetCommandInterpreter()
.GetDebugger()
.GetTerminalWidth());
syntax_error = true;
break;
}
@ -4392,7 +4405,7 @@ public:
"target symbols add",
"Add a debug symbol file to one of the target's current modules by specifying a path to a debug symbols file, or using the options to specify a module to download symbols for.",
"target symbols add [<symfile>]", eCommandRequiresTarget),
m_option_group (interpreter),
m_option_group(),
m_file_option (LLDB_OPT_SET_1, false, "shlib", 's', CommandCompletions::eModuleCompletion, eArgTypeShlibName, "Fullpath or basename for module to find debug symbols for."),
m_current_frame_option (LLDB_OPT_SET_2, false, "frame", 'F', "Locate the debug symbols the currently selected frame.", false, true)
@ -4418,7 +4431,7 @@ public:
std::string completion_str (input.GetArgumentAtIndex(cursor_index));
completion_str.erase (cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
CommandCompletions::eDiskFileCompletion,
completion_str.c_str(),
match_start_point,
@ -4847,8 +4860,8 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter),
CommandOptions() :
Options(),
m_line_start(0),
m_line_end (UINT_MAX),
m_func_name_type_mask (eFunctionNameTypeAuto),
@ -4868,7 +4881,8 @@ public:
}
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -4958,7 +4972,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_class_name.clear();
m_function_name.clear();
@ -5007,7 +5021,7 @@ public:
"Add a hook to be executed when the target stops.",
"target stop-hook add"),
IOHandlerDelegateMultiline ("DONE", IOHandlerDelegate::Completion::LLDBCommand),
m_options (interpreter)
m_options()
{
}

View File

@ -153,17 +153,18 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
CommandOptions() :
Options()
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -206,7 +207,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_count = UINT32_MAX;
m_start = 0;
@ -236,7 +237,7 @@ public:
"to see all threads.",
nullptr, eCommandRequiresProcess | eCommandRequiresThread | eCommandTryTargetAPILock |
eCommandProcessMustBeLaunched | eCommandProcessMustBePaused),
m_options(interpreter)
m_options()
{
}
@ -334,17 +335,18 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -429,14 +431,16 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_step_in_avoid_no_debug = eLazyBoolCalculate;
m_step_out_avoid_no_debug = eLazyBoolCalculate;
m_run_mode = eOnlyDuringStepping;
// Check if we are in Non-Stop mode
lldb::TargetSP target_sp = m_interpreter.GetDebugger().GetSelectedTarget();
TargetSP target_sp =
execution_context ? execution_context->GetTargetSP() :
TargetSP();
if (target_sp && target_sp->GetNonStopModeEnabled())
m_run_mode = eOnlyThisThread;
@ -484,7 +488,7 @@ public:
eCommandProcessMustBePaused ),
m_step_type (step_type),
m_step_scope (step_scope),
m_options (interpreter)
m_options()
{
CommandArgumentEntry arg;
CommandArgumentData thread_id_arg;
@ -1007,19 +1011,20 @@ public:
uint32_t m_thread_idx;
uint32_t m_frame_idx;
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions() :
Options(),
m_thread_idx(LLDB_INVALID_THREAD_ID),
m_frame_idx(LLDB_INVALID_FRAME_ID)
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1028,8 +1033,9 @@ public:
{
case 'a':
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
lldb::addr_t tmp_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
lldb::addr_t tmp_addr =
Args::StringToAddress(execution_context, option_arg,
LLDB_INVALID_ADDRESS, &error);
if (error.Success())
m_until_addrs.push_back(tmp_addr);
}
@ -1070,7 +1076,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_thread_idx = LLDB_INVALID_THREAD_ID;
m_frame_idx = 0;
@ -1101,7 +1107,7 @@ public:
"the current function as a safety measure.",
nullptr, eCommandRequiresThread | eCommandTryTargetAPILock |
eCommandProcessMustBeLaunched | eCommandProcessMustBePaused),
m_options(interpreter)
m_options()
{
CommandArgumentEntry arg;
CommandArgumentData line_num_arg;
@ -1461,23 +1467,24 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_json_thread = false;
m_json_stopinfo = false;
}
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
const int short_option = m_getopt_table[option_idx].val;
Error error;
@ -1516,7 +1523,7 @@ public:
"Show an extended summary of one or more threads. Defaults to the current thread.", "thread info",
eCommandRequiresProcess | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched |
eCommandProcessMustBePaused),
m_options(interpreter)
m_options()
{
m_add_return = false;
}
@ -1574,18 +1581,19 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
m_from_expression (false)
CommandOptions() :
Options(),
m_from_expression(false)
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1612,7 +1620,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_from_expression = false;
}
@ -1639,7 +1647,7 @@ public:
"frame.",
"thread return", eCommandRequiresFrame | eCommandTryTargetAPILock |
eCommandProcessMustBeLaunched | eCommandProcessMustBePaused),
m_options(interpreter)
m_options()
{
CommandArgumentEntry arg;
CommandArgumentData expression_arg;
@ -1770,16 +1778,16 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_filenames.Clear();
m_line_num = 0;
@ -1789,7 +1797,8 @@ public:
}
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
bool success;
const int short_option = m_getopt_table[option_idx].val;
@ -1813,10 +1822,10 @@ public:
return Error("invalid line offset: '%s'.", option_arg);
break;
case 'a':
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
m_load_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
}
m_load_addr = Args::StringToAddress(execution_context,
option_arg,
LLDB_INVALID_ADDRESS,
&error);
break;
case 'r':
m_force = true;
@ -1851,7 +1860,7 @@ public:
eCommandTryTargetAPILock |
eCommandProcessMustBeLaunched |
eCommandProcessMustBePaused ),
m_options (interpreter)
m_options()
{
}
@ -1967,17 +1976,18 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter)
CommandOptions() :
Options()
{
// Keep default values of all options in one place: OptionParsingStarting ()
OptionParsingStarting ();
OptionParsingStarting(nullptr);
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1998,7 +2008,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_verbose = false;
m_internal = false;
@ -2026,7 +2036,7 @@ public:
"current thread. Use the thread-index \"all\" to see all threads.",
nullptr, eCommandRequiresProcess | eCommandRequiresThread | eCommandTryTargetAPILock |
eCommandProcessMustBeLaunched | eCommandProcessMustBePaused),
m_options(interpreter)
m_options()
{
}

View File

@ -131,17 +131,18 @@ private:
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
Options()
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override;
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override;
void
OptionParsingStarting () override;
OptionParsingStarting(ExecutionContext *execution_context) override;
const OptionDefinition*
GetDefinitions () override
@ -361,15 +362,16 @@ private:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -410,7 +412,7 @@ private:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_cascade = true;
m_class_name = "";
@ -639,7 +641,7 @@ private:
}
void
OptionParsingStarting (CommandInterpreter &interpreter) override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_cascade = true;
m_skip_pointers = false;
@ -650,9 +652,9 @@ private:
}
Error
SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override
SetOptionValue(uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = g_option_table[option_idx].short_option;
@ -718,9 +720,9 @@ public:
"type format add",
"Add a new formatting style for a type.",
nullptr),
m_option_group (interpreter),
m_format_options (eFormatInvalid),
m_command_options ()
m_option_group(),
m_format_options(eFormatInvalid),
m_command_options()
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -877,15 +879,16 @@ protected:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -910,7 +913,7 @@ protected:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_delete_all = false;
m_category = "default";
@ -952,7 +955,7 @@ public:
name,
help,
nullptr),
m_options(interpreter),
m_options(),
m_formatter_kind_mask(formatter_kind_mask)
{
CommandArgumentEntry type_arg;
@ -1056,15 +1059,16 @@ private:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1083,7 +1087,7 @@ private:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_delete_all = false;
}
@ -1120,7 +1124,7 @@ public:
name,
help,
nullptr),
m_options(interpreter),
m_options(),
m_formatter_kind_mask(formatter_kind_mask)
{
}
@ -1215,8 +1219,8 @@ class CommandObjectTypeFormatterList : public CommandObjectParsed
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions() :
Options(),
m_category_regex("",""),
m_category_language(lldb::eLanguageTypeUnknown, lldb::eLanguageTypeUnknown)
{
@ -1225,7 +1229,8 @@ class CommandObjectTypeFormatterList : public CommandObjectParsed
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1250,7 +1255,7 @@ class CommandObjectTypeFormatterList : public CommandObjectParsed
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_category_regex.Clear();
m_category_language.Clear();
@ -1295,7 +1300,7 @@ public:
name,
help,
nullptr),
m_options(interpreter)
m_options()
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -1473,7 +1478,11 @@ public:
#endif // LLDB_DISABLE_PYTHON
Error
CommandObjectTypeSummaryAdd::CommandOptions::SetOptionValue (uint32_t option_idx, const char *option_arg)
CommandObjectTypeSummaryAdd::CommandOptions::SetOptionValue(uint32_t option_idx,
const char
*option_arg,
ExecutionContext
*execution_context)
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -1539,7 +1548,8 @@ CommandObjectTypeSummaryAdd::CommandOptions::SetOptionValue (uint32_t option_idx
}
void
CommandObjectTypeSummaryAdd::CommandOptions::OptionParsingStarting ()
CommandObjectTypeSummaryAdd::CommandOptions::OptionParsingStarting(
ExecutionContext *execution_context)
{
m_flags.Clear().SetCascades().SetDontShowChildren().SetDontShowValue(false);
m_flags.SetShowMembersOneLiner(false).SetSkipPointers(false).SetSkipReferences(false).SetHideItemNames(false);
@ -2069,8 +2079,8 @@ class CommandObjectTypeCategoryDefine : public CommandObjectParsed
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions() :
Options(),
m_define_enabled(false,false),
m_cate_language(eLanguageTypeUnknown,eLanguageTypeUnknown)
{
@ -2079,7 +2089,8 @@ class CommandObjectTypeCategoryDefine : public CommandObjectParsed
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -2101,7 +2112,7 @@ class CommandObjectTypeCategoryDefine : public CommandObjectParsed
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_define_enabled.Clear();
m_cate_language.Clear();
@ -2137,7 +2148,7 @@ public:
"type category define",
"Define a new category as a source of formatters.",
nullptr),
m_options(interpreter)
m_options()
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -2199,15 +2210,16 @@ class CommandObjectTypeCategoryEnable : public CommandObjectParsed
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -2231,7 +2243,7 @@ class CommandObjectTypeCategoryEnable : public CommandObjectParsed
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_language = lldb::eLanguageTypeUnknown;
}
@ -2266,7 +2278,7 @@ public:
"type category enable",
"Enable a category as a source of formatters.",
nullptr),
m_options(interpreter)
m_options()
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -2419,15 +2431,16 @@ class CommandObjectTypeCategoryDisable : public CommandObjectParsed
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue (uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -2451,7 +2464,7 @@ class CommandObjectTypeCategoryDisable : public CommandObjectParsed
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_language = lldb::eLanguageTypeUnknown;
}
@ -2485,7 +2498,7 @@ public:
"type category disable",
"Disable a category as a source of formatters.",
nullptr),
m_options(interpreter)
m_options()
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -2845,7 +2858,7 @@ CommandObjectTypeSynthAdd::CommandObjectTypeSynthAdd (CommandInterpreter &interp
"Add a new synthetic provider for a type.",
nullptr),
IOHandlerDelegateMultiline ("DONE"),
m_options (interpreter)
m_options()
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -2928,15 +2941,16 @@ private:
typedef std::vector<std::string> option_vector;
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter)
CommandOptions() :
Options()
{
}
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -2974,7 +2988,7 @@ private:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_cascade = true;
m_skip_pointers = false;
@ -3076,7 +3090,7 @@ public:
"type filter add",
"Add a new filter for a type.",
nullptr),
m_options (interpreter)
m_options()
{
CommandArgumentEntry type_arg;
CommandArgumentData type_style_arg;
@ -3257,9 +3271,9 @@ protected:
}
Error
SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_value) override
SetOptionValue (uint32_t option_idx,
const char *option_value,
ExecutionContext *execution_context) override
{
Error error;
@ -3284,7 +3298,7 @@ protected:
}
void
OptionParsingStarting (CommandInterpreter &interpreter) override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_show_help = false;
m_language = eLanguageTypeUnknown;
@ -3307,7 +3321,7 @@ public:
"Lookup types and declarations in the current target, following language-specific naming conventions.",
"type lookup <type-specifier>",
eCommandRequiresTarget),
m_option_group(interpreter),
m_option_group(),
m_command_options()
{
m_option_group.Append(&m_command_options);
@ -3356,8 +3370,9 @@ public:
result.SetError("type lookup cannot be invoked without a type name as argument");
return false;
}
m_option_group.NotifyOptionParsingStarting();
auto exe_ctx = GetCommandInterpreter().GetExecutionContext();
m_option_group.NotifyOptionParsingStarting(&exe_ctx);
const char * name_of_type = nullptr;
@ -3389,7 +3404,8 @@ public:
if (!ParseOptions (args, result))
return false;
Error error (m_option_group.NotifyOptionParsingFinished());
Error error(m_option_group.NotifyOptionParsingFinished(
&exe_ctx));
if (error.Fail())
{
result.AppendError (error.AsCString());
@ -3401,9 +3417,9 @@ public:
if (nullptr == name_of_type)
name_of_type = raw_command_line;
TargetSP target_sp(GetCommandInterpreter().GetDebugger().GetSelectedTarget());
const bool fill_all_in = true;
ExecutionContext exe_ctx(target_sp.get(), fill_all_in);
// TargetSP target_sp(GetCommandInterpreter().GetDebugger().GetSelectedTarget());
// const bool fill_all_in = true;
// ExecutionContext exe_ctx(target_sp.get(), fill_all_in);
ExecutionContextScope *best_scope = exe_ctx.GetBestExecutionContextScope();
bool any_found = false;

View File

@ -170,7 +170,7 @@ public:
"watchpoint list",
"List all watchpoints at configurable levels of detail.",
nullptr),
m_options(interpreter)
m_options()
{
CommandArgumentEntry arg;
CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
@ -189,8 +189,8 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter),
CommandOptions() :
Options(),
m_level(lldb::eDescriptionLevelBrief) // Watchpoint List defaults to brief descriptions
{
}
@ -198,7 +198,8 @@ public:
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -223,7 +224,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_level = lldb::eDescriptionLevelFull;
}
@ -589,7 +590,7 @@ public:
"watchpoint ignore",
"Set ignore count on the specified watchpoint(s). If no watchpoints are specified, set them all.",
nullptr),
m_options (interpreter)
m_options()
{
CommandArgumentEntry arg;
CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
@ -608,8 +609,8 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions() :
Options(),
m_ignore_count (0)
{
}
@ -617,7 +618,8 @@ public:
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -638,7 +640,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_ignore_count = 0;
}
@ -738,7 +740,7 @@ public:
"If no watchpoint is specified, act on the last created watchpoint. "
"Passing an empty argument clears the modification.",
nullptr),
m_options (interpreter)
m_options()
{
CommandArgumentEntry arg;
CommandObject::AddIDsArgumentData(arg, eArgTypeWatchpointID, eArgTypeWatchpointIDRange);
@ -757,8 +759,8 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions() :
Options(),
m_condition (),
m_condition_passed (false)
{
@ -767,7 +769,8 @@ public:
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -790,7 +793,7 @@ public:
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_condition.clear();
m_condition_passed = false;
@ -907,7 +910,7 @@ public:
eCommandTryTargetAPILock |
eCommandProcessMustBeLaunched |
eCommandProcessMustBePaused ),
m_option_group (interpreter),
m_option_group(),
m_option_watchpoint ()
{
SetHelpLong(
@ -1116,7 +1119,7 @@ public:
eCommandTryTargetAPILock |
eCommandProcessMustBeLaunched |
eCommandProcessMustBePaused ),
m_option_group (interpreter),
m_option_group(),
m_option_watchpoint ()
{
SetHelpLong(
@ -1162,7 +1165,8 @@ protected:
bool
DoExecute (const char *raw_command, CommandReturnObject &result) override
{
m_option_group.NotifyOptionParsingStarting(); // This is a raw command, so notify the option group
auto exe_ctx = GetCommandInterpreter().GetExecutionContext();
m_option_group.NotifyOptionParsingStarting(&exe_ctx); // This is a raw command, so notify the option group
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
StackFrame *frame = m_exe_ctx.GetFramePtr();
@ -1197,7 +1201,8 @@ protected:
if (!ParseOptions (args, result))
return false;
Error error (m_option_group.NotifyOptionParsingFinished());
Error error(m_option_group.NotifyOptionParsingFinished(
&exe_ctx));
if (error.Fail())
{
result.AppendError (error.AsCString());

View File

@ -41,7 +41,7 @@ public:
interpreter, "add",
"Add a set of LLDB commands to a watchpoint, to be executed whenever the watchpoint is hit.", nullptr),
IOHandlerDelegateMultiline("DONE", IOHandlerDelegate::Completion::LLDBCommand),
m_options(interpreter)
m_options()
{
SetHelpLong (
R"(
@ -280,8 +280,8 @@ are no syntax errors may indicate that a function was declared but never called.
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
CommandOptions() :
Options(),
m_use_commands (false),
m_use_script_language (false),
m_script_language (eScriptLanguageNone),
@ -294,7 +294,8 @@ are no syntax errors may indicate that a function was declared but never called.
~CommandOptions() override = default;
Error
SetOptionValue (uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -338,7 +339,7 @@ are no syntax errors may indicate that a function was declared but never called.
}
void
OptionParsingStarting () override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_use_commands = true;
m_use_script_language = false;

View File

@ -32,10 +32,10 @@ REPL::REPL(LLVMCastKind kind, Target &target) :
{
// Make sure all option values have sane defaults
Debugger &debugger = m_target.GetDebugger();
CommandInterpreter &ci = debugger.GetCommandInterpreter();
m_format_options.OptionParsingStarting(ci);
m_varobj_options.OptionParsingStarting(ci);
m_command_options.OptionParsingStarting(ci);
auto exe_ctx = debugger.GetCommandInterpreter().GetExecutionContext();
m_format_options.OptionParsingStarting(&exe_ctx);
m_varobj_options.OptionParsingStarting(&exe_ctx);
m_command_options.OptionParsingStarting(&exe_ctx);
// Default certain settings for REPL regardless of the global settings.
m_command_options.unwind_on_error = false;

View File

@ -550,7 +550,8 @@ Args::SetArguments (const char **argv)
Error
Args::ParseOptions (Options &options)
Args::ParseOptions (Options &options, ExecutionContext *execution_context,
PlatformSP platform_sp, bool require_validation)
{
StreamString sstr;
Error error;
@ -622,17 +623,47 @@ Args::ParseOptions (Options &options)
if (long_options_index >= 0 && long_options[long_options_index].definition)
{
const OptionDefinition *def = long_options[long_options_index].definition;
CommandInterpreter &interpreter = options.GetInterpreter();
if (!platform_sp)
{
// User did not pass in an explicit platform. Try to grab
// from the execution context.
TargetSP target_sp = execution_context ?
execution_context->GetTargetSP() : TargetSP();
platform_sp = target_sp ?
target_sp->GetPlatform() : PlatformSP();
}
OptionValidator *validator = def->validator;
if (validator && !validator->IsValid(*interpreter.GetPlatform(true), interpreter.GetExecutionContext()))
if (!platform_sp && require_validation)
{
error.SetErrorStringWithFormat("Option \"%s\" invalid. %s", def->long_option, def->validator->LongConditionString());
// Caller requires validation but we cannot validate as we
// don't have the mandatory platform against which to
// validate.
error.SetErrorString("cannot validate options: "
"no platform available");
return error;
}
else
bool validation_failed = false;
if (platform_sp)
{
// Ensure we have an execution context, empty or not.
ExecutionContext dummy_context;
ExecutionContext *exe_ctx_p =
execution_context ? execution_context : &dummy_context;
if (validator && !validator->IsValid(*platform_sp, *exe_ctx_p))
{
validation_failed = true;
error.SetErrorStringWithFormat("Option \"%s\" invalid. %s", def->long_option, def->validator->LongConditionString());
}
}
// As long as validation didn't fail, we set the option value.
if (!validation_failed)
error = options.SetOptionValue(long_options_index,
(def->option_has_arg == OptionParser::eNoArgument) ? nullptr : OptionParser::GetOptionArgument());
}
(def->option_has_arg == OptionParser::eNoArgument) ? nullptr : OptionParser::GetOptionArgument(),
execution_context);
}
else
{

View File

@ -12,6 +12,7 @@
#include "llvm/Support/ErrorHandling.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandObject.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/Options.h"
@ -38,7 +39,9 @@ ProcessAliasOptionsArgs (lldb::CommandObjectSP &cmd_obj_sp,
if (options)
{
// See if any options were specified as part of the alias; if so, handle them appropriately.
options->NotifyOptionParsingStarting ();
ExecutionContext exe_ctx =
cmd_obj_sp->GetCommandInterpreter().GetExecutionContext();
options->NotifyOptionParsingStarting(&exe_ctx);
args.Unshift ("dummy_arg");
args.ParseAliasOptions (*options, result, option_arg_vector, options_string);
args.Shift ();

View File

@ -159,18 +159,23 @@ CommandObject::ParseOptions
if (options != nullptr)
{
Error error;
options->NotifyOptionParsingStarting();
auto exe_ctx = GetCommandInterpreter().GetExecutionContext();
options->NotifyOptionParsingStarting(&exe_ctx);
// ParseOptions calls getopt_long_only, which always skips the zero'th item in the array and starts at position 1,
// so we need to push a dummy value into position zero.
args.Unshift("dummy_string");
error = args.ParseOptions (*options);
const bool require_validation = true;
error = args.ParseOptions(*options, &exe_ctx,
GetCommandInterpreter().GetPlatform(true),
require_validation);
// The "dummy_string" will have already been removed by ParseOptions,
// so no need to remove it.
if (error.Success())
error = options->NotifyOptionParsingFinished();
error = options->NotifyOptionParsingFinished(&exe_ctx);
if (error.Success())
{
@ -188,7 +193,10 @@ CommandObject::ParseOptions
else
{
// No error string, output the usage information into result
options->GenerateOptionUsage (result.GetErrorStream(), this);
options->GenerateOptionUsage(result.GetErrorStream(), this,
GetCommandInterpreter()
.GetDebugger()
.GetTerminalWidth());
}
}
result.SetStatus (eReturnStatusFailed);
@ -393,6 +401,7 @@ CommandObject::HandleCompletion
cursor_char_position,
match_start_point,
max_return_elements,
GetCommandInterpreter(),
word_complete,
matches);
if (handled_by_options)
@ -438,7 +447,9 @@ CommandObject::HelpTextContainsWord (const char *search_word,
&& GetOptions() != nullptr)
{
StreamString usage_help;
GetOptions()->GenerateOptionUsage (usage_help, this);
GetOptions()->GenerateOptionUsage(usage_help, this,
GetCommandInterpreter()
.GetDebugger().GetTerminalWidth());
if (usage_help.GetSize() > 0)
{
const char *usage_text = usage_help.GetData();
@ -929,7 +940,9 @@ CommandObject::GenerateHelpText (Stream &output_strm)
Options *options = GetOptions();
if (options != nullptr)
{
options->GenerateOptionUsage(output_strm, this);
options->GenerateOptionUsage(output_strm, this,
GetCommandInterpreter()
.GetDebugger().GetTerminalWidth());
}
const char *long_help = GetHelpLong();
if ((long_help != nullptr) && (strlen(long_help) > 0))

View File

@ -131,7 +131,7 @@ CommandObjectRegexCommand::HandleCompletion (Args &input,
if (m_completion_type_mask)
{
std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
CommandCompletions::InvokeCommonCompletionCallbacks (GetCommandInterpreter(),
m_completion_type_mask,
completion_str.c_str(),
match_start_point,

View File

@ -57,9 +57,9 @@ OptionGroupArchitecture::GetArchitecture (Platform *platform, ArchSpec &arch)
Error
OptionGroupArchitecture::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupArchitecture::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
const int short_option = g_option_table[option_idx].short_option;
@ -79,7 +79,8 @@ OptionGroupArchitecture::SetOptionValue (CommandInterpreter &interpreter,
}
void
OptionGroupArchitecture::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupArchitecture::OptionParsingStarting(
ExecutionContext *execution_context)
{
m_arch_str.clear();
}

View File

@ -43,9 +43,9 @@ OptionGroupBoolean::~OptionGroupBoolean ()
}
Error
OptionGroupBoolean::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupBoolean::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
if (m_option_definition.option_has_arg == OptionParser::eNoArgument)
@ -62,7 +62,7 @@ OptionGroupBoolean::SetOptionValue (CommandInterpreter &interpreter,
}
void
OptionGroupBoolean::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupBoolean::OptionParsingStarting(ExecutionContext *execution_context)
{
m_value.Clear();
}

View File

@ -43,16 +43,16 @@ OptionGroupFile::~OptionGroupFile ()
}
Error
OptionGroupFile::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupFile::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error (m_file.SetValueFromString (option_arg));
return error;
}
void
OptionGroupFile::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupFile::OptionParsingStarting(ExecutionContext *execution_context)
{
m_file.Clear();
}
@ -84,16 +84,16 @@ OptionGroupFileList::~OptionGroupFileList ()
}
Error
OptionGroupFileList::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupFileList::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error (m_file_list.SetValueFromString (option_arg));
return error;
}
void
OptionGroupFileList::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupFileList::OptionParsingStarting(ExecutionContext *execution_context)
{
m_file_list.Clear();
}

View File

@ -66,9 +66,9 @@ OptionGroupFormat::GetDefinitions ()
}
Error
OptionGroupFormat::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupFormat::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
const int short_option = g_option_table[option_idx].short_option;
@ -123,7 +123,9 @@ OptionGroupFormat::SetOptionValue (CommandInterpreter &interpreter,
Format format = eFormatDefault;
uint32_t byte_size = 0;
while (ParserGDBFormatLetter (interpreter, gdb_format_cstr[0], format, byte_size))
while (ParserGDBFormatLetter (execution_context,
gdb_format_cstr[0], format,
byte_size))
{
++gdb_format_cstr;
}
@ -143,7 +145,8 @@ OptionGroupFormat::SetOptionValue (CommandInterpreter &interpreter,
// Anything that wasn't set correctly should be set to the
// previous default
if (format == eFormatInvalid)
ParserGDBFormatLetter (interpreter, m_prev_gdb_format, format, byte_size);
ParserGDBFormatLetter (execution_context, m_prev_gdb_format,
format, byte_size);
const bool byte_size_enabled = m_byte_size.GetDefaultValue() < UINT64_MAX;
const bool count_enabled = m_count.GetDefaultValue() < UINT64_MAX;
@ -151,7 +154,7 @@ OptionGroupFormat::SetOptionValue (CommandInterpreter &interpreter,
{
// Byte size is enabled
if (byte_size == 0)
ParserGDBFormatLetter (interpreter, m_prev_gdb_size, format, byte_size);
ParserGDBFormatLetter (execution_context, m_prev_gdb_size, format, byte_size);
}
else
{
@ -205,7 +208,9 @@ OptionGroupFormat::SetOptionValue (CommandInterpreter &interpreter,
}
bool
OptionGroupFormat::ParserGDBFormatLetter (CommandInterpreter &interpreter, char format_letter, Format &format, uint32_t &byte_size)
OptionGroupFormat::ParserGDBFormatLetter(ExecutionContext *execution_context,
char format_letter, Format &format,
uint32_t &byte_size)
{
m_has_gdb_format = true;
switch (format_letter)
@ -218,10 +223,10 @@ OptionGroupFormat::ParserGDBFormatLetter (CommandInterpreter &interpreter, char
case 'f': format = eFormatFloat; m_prev_gdb_format = format_letter; return true;
case 'a': format = eFormatAddressInfo;
{
ExecutionContext exe_ctx(interpreter.GetExecutionContext());
Target *target = exe_ctx.GetTargetPtr();
if (target)
byte_size = target->GetArchitecture().GetAddressByteSize();
TargetSP target_sp = execution_context ?
execution_context->GetTargetSP() : TargetSP();
if (target_sp)
byte_size = target_sp->GetArchitecture().GetAddressByteSize();
m_prev_gdb_format = format_letter;
return true;
}
@ -258,7 +263,7 @@ OptionGroupFormat::ParserGDBFormatLetter (CommandInterpreter &interpreter, char
}
void
OptionGroupFormat::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupFormat::OptionParsingStarting(ExecutionContext *execution_context)
{
m_format.Clear();
m_byte_size.Clear();

View File

@ -52,9 +52,9 @@ OptionGroupOutputFile::GetDefinitions ()
}
Error
OptionGroupOutputFile::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupOutputFile::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
const int short_option = g_option_table[option_idx].short_option;
@ -78,7 +78,8 @@ OptionGroupOutputFile::SetOptionValue (CommandInterpreter &interpreter,
}
void
OptionGroupOutputFile::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupOutputFile::OptionParsingStarting(
ExecutionContext *execution_context)
{
m_file.Clear();
m_append.Clear();

View File

@ -70,7 +70,7 @@ OptionGroupPlatform::CreatePlatformWithOptions (CommandInterpreter &interpreter,
}
void
OptionGroupPlatform::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupPlatform::OptionParsingStarting(ExecutionContext *execution_context)
{
m_platform_name.clear();
m_sdk_sysroot.Clear();
@ -107,9 +107,9 @@ OptionGroupPlatform::GetNumDefinitions ()
Error
OptionGroupPlatform::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupPlatform::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
if (!m_include_platform_option)

View File

@ -44,16 +44,16 @@ OptionGroupString::~OptionGroupString ()
}
Error
OptionGroupString::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupString::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error (m_value.SetValueFromString (option_arg));
return error;
}
void
OptionGroupString::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupString::OptionParsingStarting(ExecutionContext *execution_context)
{
m_value.Clear();
}

View File

@ -44,16 +44,16 @@ OptionGroupUInt64::~OptionGroupUInt64 ()
}
Error
OptionGroupUInt64::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupUInt64::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error (m_value.SetValueFromString (option_arg));
return error;
}
void
OptionGroupUInt64::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupUInt64::OptionParsingStarting(ExecutionContext *execution_context)
{
m_value.Clear();
}

View File

@ -46,9 +46,9 @@ OptionGroupUUID::GetDefinitions ()
}
Error
OptionGroupUUID::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupUUID::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
const int short_option = g_option_table[option_idx].short_option;
@ -70,7 +70,7 @@ OptionGroupUUID::SetOptionValue (CommandInterpreter &interpreter,
}
void
OptionGroupUUID::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupUUID::OptionParsingStarting(ExecutionContext *execution_context)
{
m_uuid.Clear();
}

View File

@ -63,9 +63,10 @@ OptionGroupValueObjectDisplay::GetDefinitions ()
Error
OptionGroupValueObjectDisplay::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupValueObjectDisplay::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext
*execution_context)
{
Error error;
const int short_option = g_option_table[option_idx].short_option;
@ -138,7 +139,8 @@ OptionGroupValueObjectDisplay::SetOptionValue (CommandInterpreter &interpreter,
}
void
OptionGroupValueObjectDisplay::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupValueObjectDisplay::OptionParsingStarting(ExecutionContext
*execution_context)
{
// If these defaults change, be sure to modify AnyOptionWasSet().
show_types = false;
@ -153,10 +155,11 @@ OptionGroupValueObjectDisplay::OptionParsingStarting (CommandInterpreter &interp
be_raw = false;
ignore_cap = false;
run_validator = false;
Target *target = interpreter.GetExecutionContext().GetTargetPtr();
if (target != nullptr)
use_dynamic = target->GetPreferDynamicValue();
TargetSP target_sp =
execution_context ? execution_context->GetTargetSP() : TargetSP();
if (target_sp)
use_dynamic = target_sp->GetPreferDynamicValue();
else
{
// If we don't have any targets, then dynamic values won't do us much good.

View File

@ -68,9 +68,9 @@ OptionGroupVariable::~OptionGroupVariable ()
}
Error
OptionGroupVariable::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupVariable::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
if (!include_frame_options)
@ -101,7 +101,7 @@ OptionGroupVariable::SetOptionValue (CommandInterpreter &interpreter,
}
void
OptionGroupVariable::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupVariable::OptionParsingStarting(ExecutionContext *execution_context)
{
show_args = true; // Frame option only
show_locals = true; // Frame option only

View File

@ -68,9 +68,9 @@ OptionGroupWatchpoint::~OptionGroupWatchpoint ()
}
Error
OptionGroupWatchpoint::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupWatchpoint::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
const int short_option = g_option_table[option_idx].short_option;
@ -100,7 +100,8 @@ OptionGroupWatchpoint::SetOptionValue (CommandInterpreter &interpreter,
}
void
OptionGroupWatchpoint::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupWatchpoint::OptionParsingStarting(ExecutionContext
*execution_context)
{
watch_type_specified = false;
watch_type = eWatchInvalid;

View File

@ -17,6 +17,7 @@
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandCompletions.h"
#include "lldb/Interpreter/CommandInterpreter.h"
using namespace lldb;
using namespace lldb_private;

View File

@ -17,6 +17,7 @@
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandCompletions.h"
#include "lldb/Interpreter/CommandInterpreter.h"
using namespace lldb;
using namespace lldb_private;

View File

@ -31,8 +31,7 @@ using namespace lldb_private;
//-------------------------------------------------------------------------
// Options
//-------------------------------------------------------------------------
Options::Options (CommandInterpreter &interpreter) :
m_interpreter (interpreter),
Options::Options () :
m_getopt_table ()
{
BuildValidOptionSets();
@ -43,17 +42,17 @@ Options::~Options ()
}
void
Options::NotifyOptionParsingStarting ()
Options::NotifyOptionParsingStarting(ExecutionContext *execution_context)
{
m_seen_options.clear();
// Let the subclass reset its option values
OptionParsingStarting ();
OptionParsingStarting(execution_context);
}
Error
Options::NotifyOptionParsingFinished ()
Options::NotifyOptionParsingFinished(ExecutionContext *execution_context)
{
return OptionParsingFinished ();
return OptionParsingFinished(execution_context);
}
void
@ -475,11 +474,11 @@ void
Options::GenerateOptionUsage
(
Stream &strm,
CommandObject *cmd
CommandObject *cmd,
uint32_t screen_width
)
{
const bool only_print_args = cmd->IsDashDashCommand();
const uint32_t screen_width = m_interpreter.GetDebugger().GetTerminalWidth();
const OptionDefinition *opt_defs = GetDefinitions();
const uint32_t save_indent_level = strm.GetIndentLevel();
@ -760,6 +759,7 @@ Options::HandleOptionCompletion
int char_pos,
int match_start_point,
int max_return_elements,
CommandInterpreter &interpreter,
bool &word_complete,
lldb_private::StringList &matches
)
@ -882,6 +882,7 @@ Options::HandleOptionCompletion
i,
match_start_point,
max_return_elements,
interpreter,
word_complete,
matches);
return true;
@ -912,6 +913,7 @@ Options::HandleOptionArgumentCompletion
int opt_element_index,
int match_start_point,
int max_return_elements,
CommandInterpreter &interpreter,
bool &word_complete,
lldb_private::StringList &matches
)
@ -982,7 +984,7 @@ Options::HandleOptionArgumentCompletion
if (module_name)
{
FileSpec module_spec(module_name, false);
lldb::TargetSP target_sp = m_interpreter.GetDebugger().GetSelectedTarget();
lldb::TargetSP target_sp = interpreter.GetDebugger().GetSelectedTarget();
// Search filters require a target...
if (target_sp)
filter_ap.reset (new SearchFilterByModule (target_sp, module_spec));
@ -992,7 +994,7 @@ Options::HandleOptionArgumentCompletion
}
}
return CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
return CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
completion_mask,
input.GetArgumentAtIndex (opt_arg_pos),
match_start_point,
@ -1056,7 +1058,8 @@ OptionGroupOptions::Finalize ()
Error
OptionGroupOptions::SetOptionValue (uint32_t option_idx,
const char *option_value)
const char *option_value,
ExecutionContext *execution_context)
{
// After calling OptionGroupOptions::Append(...), you must finalize the groups
// by calling OptionGroupOptions::Finlize()
@ -1065,9 +1068,9 @@ OptionGroupOptions::SetOptionValue (uint32_t option_idx,
Error error;
if (option_idx < m_option_infos.size())
{
error = m_option_infos[option_idx].option_group->SetOptionValue (m_interpreter,
m_option_infos[option_idx].option_index,
option_value);
error = m_option_infos[option_idx].option_group->SetOptionValue (m_option_infos[option_idx].option_index,
option_value,
execution_context);
}
else
@ -1078,7 +1081,7 @@ OptionGroupOptions::SetOptionValue (uint32_t option_idx,
}
void
OptionGroupOptions::OptionParsingStarting ()
OptionGroupOptions::OptionParsingStarting (ExecutionContext *execution_context)
{
std::set<OptionGroup*> group_set;
OptionInfos::iterator pos, end = m_option_infos.end();
@ -1087,13 +1090,13 @@ OptionGroupOptions::OptionParsingStarting ()
OptionGroup* group = pos->option_group;
if (group_set.find(group) == group_set.end())
{
group->OptionParsingStarting (m_interpreter);
group->OptionParsingStarting(execution_context);
group_set.insert(group);
}
}
}
Error
OptionGroupOptions::OptionParsingFinished ()
OptionGroupOptions::OptionParsingFinished (ExecutionContext *execution_context)
{
std::set<OptionGroup*> group_set;
Error error;
@ -1103,7 +1106,7 @@ OptionGroupOptions::OptionParsingFinished ()
OptionGroup* group = pos->option_group;
if (group_set.find(group) == group_set.end())
{
error = group->OptionParsingFinished (m_interpreter);
error = group->OptionParsingFinished (execution_context);
group_set.insert(group);
if (error.Fail())
return error;

View File

@ -492,15 +492,16 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions (CommandInterpreter &interpreter) :
Options(interpreter),
CommandOptions() :
Options(),
m_verbose(false,false)
{}
~CommandOptions() override = default;
Error
SetOptionValue(uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -520,7 +521,7 @@ public:
}
void
OptionParsingStarting() override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_verbose.Clear();
}
@ -543,7 +544,7 @@ public:
eCommandRequiresProcess |
eCommandProcessMustBeLaunched |
eCommandProcessMustBePaused ),
m_options(interpreter)
m_options()
{
CommandArgumentEntry arg;
CommandArgumentData index_arg;

View File

@ -3659,7 +3659,7 @@ public:
"Sets a breakpoint on a renderscript kernel.",
"renderscript kernel breakpoint set <kernel_name> [-c x,y,z]",
eCommandRequiresProcess | eCommandProcessMustBeLaunched | eCommandProcessMustBePaused),
m_options(interpreter)
m_options()
{
}
@ -3674,12 +3674,13 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions(CommandInterpreter &interpreter) : Options(interpreter) {}
CommandOptions() : Options() {}
~CommandOptions() override = default;
Error
SetOptionValue(uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -3726,7 +3727,7 @@ public:
}
void
OptionParsingStarting() override
OptionParsingStarting(ExecutionContext *execution_context) override
{
// -1 means the -c option hasn't been set
m_coord[0] = -1;
@ -3950,7 +3951,7 @@ public:
: CommandObjectParsed(interpreter, "renderscript allocation dump",
"Displays the contents of a particular allocation", "renderscript allocation dump <ID>",
eCommandRequiresProcess | eCommandProcessMustBeLaunched),
m_options(interpreter)
m_options()
{
}
@ -3965,12 +3966,13 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions(CommandInterpreter &interpreter) : Options(interpreter) {}
CommandOptions() : Options() {}
~CommandOptions() override = default;
Error
SetOptionValue(uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -3993,7 +3995,7 @@ public:
}
void
OptionParsingStarting() override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_outfile.Clear();
}
@ -4084,7 +4086,7 @@ public:
: CommandObjectParsed(interpreter, "renderscript allocation list",
"List renderscript allocations and their information.", "renderscript allocation list",
eCommandRequiresProcess | eCommandProcessMustBeLaunched),
m_options(interpreter)
m_options()
{
}
@ -4099,12 +4101,13 @@ public:
class CommandOptions : public Options
{
public:
CommandOptions(CommandInterpreter &interpreter) : Options(interpreter), m_id(0) {}
CommandOptions() : Options(), m_id(0) {}
~CommandOptions() override = default;
Error
SetOptionValue(uint32_t option_idx, const char *option_arg) override
SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -4125,7 +4128,7 @@ public:
}
void
OptionParsingStarting() override
OptionParsingStarting(ExecutionContext *execution_context) override
{
m_id = 0;
}

View File

@ -75,7 +75,7 @@ PlatformPOSIX::GetConnectionOptions (lldb_private::CommandInterpreter& interpret
auto iter = m_options.find(&interpreter), end = m_options.end();
if (iter == end)
{
std::unique_ptr<lldb_private::OptionGroupOptions> options(new OptionGroupOptions(interpreter));
std::unique_ptr<lldb_private::OptionGroupOptions> options(new OptionGroupOptions());
options->Append(m_option_group_platform_rsync.get());
options->Append(m_option_group_platform_ssh.get());
options->Append(m_option_group_platform_caching.get());

View File

@ -1050,7 +1050,7 @@ public:
"process plugin packet send",
"Send a custom packet through the KDP protocol by specifying the command byte and the packet payload data. A packet will be sent with a correct header and payload, and the raw result bytes will be displayed as a string value. ",
NULL),
m_option_group (interpreter),
m_option_group(),
m_command_byte(LLDB_OPT_SET_1, true , "command", 'c', 0, eArgTypeNone, "Specify the command byte to use when sending the KDP request packet.", 0),
m_packet_data (LLDB_OPT_SET_1, false, "payload", 'p', 0, eArgTypeNone, "Specify packet payload bytes as a hex ASCII string with no spaces or hex prefixes.", NULL)
{

View File

@ -5215,7 +5215,7 @@ public:
"process plugin packet speed-test",
"Tests packet speeds of various sizes to determine the performance characteristics of the GDB remote connection. ",
NULL),
m_option_group (interpreter),
m_option_group (),
m_num_packets (LLDB_OPT_SET_1, false, "count", 'c', 0, eArgTypeCount, "The number of packets to send of each varying size (default is 1000).", 1000),
m_max_send (LLDB_OPT_SET_1, false, "max-send", 's', 0, eArgTypeCount, "The maximum number of bytes to send in a packet. Sizes increase in powers of 2 while the size is less than or equal to this option value. (default 1024).", 1024),
m_max_recv (LLDB_OPT_SET_1, false, "max-receive", 'r', 0, eArgTypeCount, "The maximum number of bytes to receive in a packet. Sizes increase in powers of 2 while the size is less than or equal to this option value. (default 1024).", 1024),

View File

@ -1593,7 +1593,7 @@ OptionGroupPlatformRSync::GetDefinitions ()
}
void
OptionGroupPlatformRSync::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupPlatformRSync::OptionParsingStarting(ExecutionContext *execution_context)
{
m_rsync = false;
m_rsync_opts.clear();
@ -1602,9 +1602,9 @@ OptionGroupPlatformRSync::OptionParsingStarting (CommandInterpreter &interpreter
}
lldb_private::Error
OptionGroupPlatformRSync::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupPlatformRSync::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
char short_option = (char) GetDefinitions()[option_idx].short_option;
@ -1653,16 +1653,17 @@ OptionGroupPlatformSSH::GetDefinitions ()
}
void
OptionGroupPlatformSSH::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupPlatformSSH::OptionParsingStarting(ExecutionContext
*execution_context)
{
m_ssh = false;
m_ssh_opts.clear();
}
lldb_private::Error
OptionGroupPlatformSSH::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupPlatformSSH::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
char short_option = (char) GetDefinitions()[option_idx].short_option;
@ -1697,15 +1698,16 @@ OptionGroupPlatformCaching::GetDefinitions ()
}
void
OptionGroupPlatformCaching::OptionParsingStarting (CommandInterpreter &interpreter)
OptionGroupPlatformCaching::OptionParsingStarting(ExecutionContext
*execution_context)
{
m_cache_dir.clear();
}
lldb_private::Error
OptionGroupPlatformCaching::SetOptionValue (CommandInterpreter &interpreter,
uint32_t option_idx,
const char *option_arg)
OptionGroupPlatformCaching::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
char short_option = (char) GetDefinitions()[option_idx].short_option;

View File

@ -442,7 +442,9 @@ ProcessInstanceInfo::DumpAsTableRow (Stream &s, Platform *platform, bool show_ar
}
Error
ProcessLaunchCommandOptions::SetOptionValue (uint32_t option_idx, const char *option_arg)
ProcessLaunchCommandOptions::SetOptionValue(uint32_t option_idx,
const char *option_arg,
ExecutionContext *execution_context)
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@ -503,8 +505,14 @@ ProcessLaunchCommandOptions::SetOptionValue (uint32_t option_idx, const char *op
break;
case 'a':
if (!launch_info.GetArchitecture().SetTriple (option_arg, m_interpreter.GetPlatform(true).get()))
launch_info.GetArchitecture().SetTriple (option_arg);
{
TargetSP target_sp = execution_context ?
execution_context->GetTargetSP() : TargetSP();
PlatformSP platform_sp = target_sp ?
target_sp->GetPlatform() : PlatformSP();
if (!launch_info.GetArchitecture().SetTriple (option_arg, platform_sp.get()))
launch_info.GetArchitecture().SetTriple (option_arg);
}
break;
case 'A': // Disable ASLR.