diff options
author | Todd Fiala <todd.fiala@gmail.com> | 2016-08-11 23:51:28 +0000 |
---|---|---|
committer | Todd Fiala <todd.fiala@gmail.com> | 2016-08-11 23:51:28 +0000 |
commit | e1cfbc79420fee0b71bad62f8d413b68a0eca91e (patch) | |
tree | ab91f6f91be4051731e37ed69ca9ff8c7bdad1ff /lldb/source/Commands/CommandObjectFrame.cpp | |
parent | 1602421c852d9d7fddbe8c5f014d7861a7848865 (diff) | |
download | llvm-e1cfbc79420fee0b71bad62f8d413b68a0eca91e.zip llvm-e1cfbc79420fee0b71bad62f8d413b68a0eca91e.tar.gz llvm-e1cfbc79420fee0b71bad62f8d413b68a0eca91e.tar.bz2 |
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
Diffstat (limited to 'lldb/source/Commands/CommandObjectFrame.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectFrame.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index cd436df..9af8965 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -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, |