[Lldb-commits] [lldb] r278440 - Decoupled Options from CommandInterpreter.
Jim Ingham via lldb-commits
lldb-commits at lists.llvm.org
Thu Aug 11 18:19:30 PDT 2016
I have no opposition to unit tests in general, but if somebody finds some free time on their hands, it would be really great to make the option definition & argument parsing available to the SB API's so that people could define real lldb Python commands that did completion, help etc as an equal of the built-in commands. That would allow you to kill two birds with one stone, since then you could use the SB API's to test them.
Just a thought while we're allocating other people's time...
Jim
> On Aug 11, 2016, at 5:33 PM, Todd Fiala via lldb-commits <lldb-commits at lists.llvm.org> wrote:
>
> :-)
>
> That would be great. I think it would be useful to invest in that area. I'll add that to my list.
>
> On Thu, Aug 11, 2016 at 5:11 PM, Zachary Turner <zturner at google.com> wrote:
> Have you considered writing some unit test for all the option stuff now?
>
> On Thu, Aug 11, 2016 at 5:10 PM Zachary Turner <zturner at google.com> wrote:
> This sounds very helpful. It also means it should become easier to start unit testing the options framework
>
> On Thu, Aug 11, 2016 at 4:59 PM Todd Fiala via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> Author: tfiala
> Date: Thu Aug 11 18:51:28 2016
> New Revision: 278440
>
> URL: http://llvm.org/viewvc/llvm-project?rev=278440&view=rev
> Log:
> 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
>
> Modified:
> lldb/trunk/include/lldb/Interpreter/Args.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupString.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h
> lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h
> lldb/trunk/include/lldb/Interpreter/Options.h
> lldb/trunk/include/lldb/Target/Platform.h
> lldb/trunk/include/lldb/Target/Process.h
> lldb/trunk/source/Commands/CommandObjectArgs.cpp
> lldb/trunk/source/Commands/CommandObjectArgs.h
> lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
> lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
> lldb/trunk/source/Commands/CommandObjectBugreport.cpp
> lldb/trunk/source/Commands/CommandObjectCommands.cpp
> lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
> lldb/trunk/source/Commands/CommandObjectDisassemble.h
> lldb/trunk/source/Commands/CommandObjectExpression.cpp
> lldb/trunk/source/Commands/CommandObjectExpression.h
> lldb/trunk/source/Commands/CommandObjectFrame.cpp
> lldb/trunk/source/Commands/CommandObjectHelp.cpp
> lldb/trunk/source/Commands/CommandObjectHelp.h
> lldb/trunk/source/Commands/CommandObjectLog.cpp
> lldb/trunk/source/Commands/CommandObjectMemory.cpp
> lldb/trunk/source/Commands/CommandObjectPlatform.cpp
> lldb/trunk/source/Commands/CommandObjectPlugin.cpp
> lldb/trunk/source/Commands/CommandObjectProcess.cpp
> lldb/trunk/source/Commands/CommandObjectRegister.cpp
> lldb/trunk/source/Commands/CommandObjectSettings.cpp
> lldb/trunk/source/Commands/CommandObjectSource.cpp
> lldb/trunk/source/Commands/CommandObjectTarget.cpp
> lldb/trunk/source/Commands/CommandObjectThread.cpp
> lldb/trunk/source/Commands/CommandObjectType.cpp
> lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
> lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
> lldb/trunk/source/Expression/REPL.cpp
> lldb/trunk/source/Interpreter/Args.cpp
> lldb/trunk/source/Interpreter/CommandAlias.cpp
> lldb/trunk/source/Interpreter/CommandObject.cpp
> lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp
> lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp
> lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp
> lldb/trunk/source/Interpreter/OptionGroupFile.cpp
> lldb/trunk/source/Interpreter/OptionGroupFormat.cpp
> lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp
> lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
> lldb/trunk/source/Interpreter/OptionGroupString.cpp
> lldb/trunk/source/Interpreter/OptionGroupUInt64.cpp
> lldb/trunk/source/Interpreter/OptionGroupUUID.cpp
> lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
> lldb/trunk/source/Interpreter/OptionGroupVariable.cpp
> lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp
> lldb/trunk/source/Interpreter/OptionValueArch.cpp
> lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
> lldb/trunk/source/Interpreter/Options.cpp
> lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
> lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
> lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
> lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
> lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
> lldb/trunk/source/Target/Platform.cpp
> lldb/trunk/source/Target/Process.cpp
>
> Modified: lldb/trunk/include/lldb/Interpreter/Args.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Args.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Interpreter/Args.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/Args.h Thu Aug 11 18:51:28 2016
> @@ -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);
>
> Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h Thu Aug 11 18:51:28 2016
> @@ -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);
>
> Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h Thu Aug 11 18:51:28 2016
> @@ -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 ()
>
> Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h Thu Aug 11 18:51:28 2016
> @@ -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 ()
>
> Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h Thu Aug 11 18:51:28 2016
> @@ -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);
>
> Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h Thu Aug 11 18:51:28 2016
> @@ -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 ()
>
> Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h Thu Aug 11 18:51:28 2016
> @@ -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,
>
> Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupString.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupString.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Interpreter/OptionGroupString.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/OptionGroupString.h Thu Aug 11 18:51:28 2016
> @@ -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 ()
>
> Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h Thu Aug 11 18:51:28 2016
> @@ -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 ()
>
> Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h Thu Aug 11 18:51:28 2016
> @@ -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
>
> Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h Thu Aug 11 18:51:28 2016
> @@ -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
>
> Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h Thu Aug 11 18:51:28 2016
> @@ -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)
>
> Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h Thu Aug 11 18:51:28 2016
> @@ -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
>
> Modified: lldb/trunk/include/lldb/Interpreter/Options.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Options.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Interpreter/Options.h (original)
> +++ lldb/trunk/include/lldb/Interpreter/Options.h Thu Aug 11 18:51:28 2016
> @@ -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
>
> Modified: lldb/trunk/include/lldb/Target/Platform.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Target/Platform.h (original)
> +++ lldb/trunk/include/lldb/Target/Platform.h Thu Aug 11 18:51:28 2016
> @@ -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;
>
> Modified: lldb/trunk/include/lldb/Target/Process.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Target/Process.h (original)
> +++ lldb/trunk/include/lldb/Target/Process.h Thu Aug 11 18:51:28 2016
> @@ -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;
>
> Modified: lldb/trunk/source/Commands/CommandObjectArgs.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.cpp?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/source/Commands/CommandObjectArgs.cpp (original)
> +++ lldb/trunk/source/Commands/CommandObjectArgs.cpp Thu Aug 11 18:51:28 2016
> @@ -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::SetOp
> }
>
> void
> -CommandObjectArgs::CommandOptions::OptionParsingStarting ()
> +CommandObjectArgs::CommandOptions::OptionParsingStarting(
> + ExecutionContext *execution_context)
> {
> }
>
>
> Modified: lldb/trunk/source/Commands/CommandObjectArgs.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.h?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/source/Commands/CommandObjectArgs.h (original)
> +++ lldb/trunk/source/Commands/CommandObjectArgs.h Thu Aug 11 18:51:28 2016
> @@ -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;
>
> Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
> +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Thu Aug 11 18:51:28 2016
> @@ -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();
>
> Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original)
> +++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Thu Aug 11 18:51:28 2016
> @@ -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
> 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
> ~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
> }
>
> 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;
> }
>
> Modified: lldb/trunk/source/Commands/CommandObjectBugreport.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBugreport.cpp?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/source/Commands/CommandObjectBugreport.cpp (original)
> +++ lldb/trunk/source/Commands/CommandObjectBugreport.cpp Thu Aug 11 18:51:28 2016
> @@ -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);
>
> Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=278440&r1=278439&r2=278440&view=diff
> ==============================================================================
> --- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
> +++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Thu Aug 11 18:51:28 2016
> @@ -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
> -
>
>
>
> --
> -Todd
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
More information about the lldb-commits
mailing list