<div dir="ltr">This sounds very helpful. It also means it should become easier to start unit testing the options framework</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 11, 2016 at 4:59 PM Todd Fiala via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org">lldb-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: tfiala<br>
Date: Thu Aug 11 18:51:28 2016<br>
New Revision: 278440<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=278440&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=278440&view=rev</a><br>
Log:<br>
Decoupled Options from CommandInterpreter.<br>
<br>
Options used to store a reference to the CommandInterpreter instance<br>
in the base Options class. This made it impossible to parse options<br>
independent of a CommandInterpreter.<br>
<br>
This change removes the reference from the base class. Instead, it<br>
modifies the options-parsing-related methods to take an<br>
ExecutionContext pointer, which the options may inspect if they need<br>
to do so.<br>
<br>
Closes <a href="https://reviews.llvm.org/D23416" rel="noreferrer" target="_blank">https://reviews.llvm.org/D23416</a><br>
Reviewers: clayborg, jingham<br>
<br>
Modified:<br>
lldb/trunk/include/lldb/Interpreter/Args.h<br>
lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h<br>
lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h<br>
lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h<br>
lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h<br>
lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h<br>
lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h<br>
lldb/trunk/include/lldb/Interpreter/OptionGroupString.h<br>
lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h<br>
lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h<br>
lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h<br>
lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h<br>
lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h<br>
lldb/trunk/include/lldb/Interpreter/Options.h<br>
lldb/trunk/include/lldb/Target/Platform.h<br>
lldb/trunk/include/lldb/Target/Process.h<br>
lldb/trunk/source/Commands/CommandObjectArgs.cpp<br>
lldb/trunk/source/Commands/CommandObjectArgs.h<br>
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp<br>
lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp<br>
lldb/trunk/source/Commands/CommandObjectBugreport.cpp<br>
lldb/trunk/source/Commands/CommandObjectCommands.cpp<br>
lldb/trunk/source/Commands/CommandObjectDisassemble.cpp<br>
lldb/trunk/source/Commands/CommandObjectDisassemble.h<br>
lldb/trunk/source/Commands/CommandObjectExpression.cpp<br>
lldb/trunk/source/Commands/CommandObjectExpression.h<br>
lldb/trunk/source/Commands/CommandObjectFrame.cpp<br>
lldb/trunk/source/Commands/CommandObjectHelp.cpp<br>
lldb/trunk/source/Commands/CommandObjectHelp.h<br>
lldb/trunk/source/Commands/CommandObjectLog.cpp<br>
lldb/trunk/source/Commands/CommandObjectMemory.cpp<br>
lldb/trunk/source/Commands/CommandObjectPlatform.cpp<br>
lldb/trunk/source/Commands/CommandObjectPlugin.cpp<br>
lldb/trunk/source/Commands/CommandObjectProcess.cpp<br>
lldb/trunk/source/Commands/CommandObjectRegister.cpp<br>
lldb/trunk/source/Commands/CommandObjectSettings.cpp<br>
lldb/trunk/source/Commands/CommandObjectSource.cpp<br>
lldb/trunk/source/Commands/CommandObjectTarget.cpp<br>
lldb/trunk/source/Commands/CommandObjectThread.cpp<br>
lldb/trunk/source/Commands/CommandObjectType.cpp<br>
lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp<br>
lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp<br>
lldb/trunk/source/Expression/REPL.cpp<br>
lldb/trunk/source/Interpreter/Args.cpp<br>
lldb/trunk/source/Interpreter/CommandAlias.cpp<br>
lldb/trunk/source/Interpreter/CommandObject.cpp<br>
lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp<br>
lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp<br>
lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp<br>
lldb/trunk/source/Interpreter/OptionGroupFile.cpp<br>
lldb/trunk/source/Interpreter/OptionGroupFormat.cpp<br>
lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp<br>
lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp<br>
lldb/trunk/source/Interpreter/OptionGroupString.cpp<br>
lldb/trunk/source/Interpreter/OptionGroupUInt64.cpp<br>
lldb/trunk/source/Interpreter/OptionGroupUUID.cpp<br>
lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp<br>
lldb/trunk/source/Interpreter/OptionGroupVariable.cpp<br>
lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp<br>
lldb/trunk/source/Interpreter/OptionValueArch.cpp<br>
lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp<br>
lldb/trunk/source/Interpreter/Options.cpp<br>
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp<br>
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp<br>
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp<br>
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp<br>
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp<br>
lldb/trunk/source/Target/Platform.cpp<br>
lldb/trunk/source/Target/Process.cpp<br>
<br>
Modified: lldb/trunk/include/lldb/Interpreter/Args.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Args.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Args.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Interpreter/Args.h (original)<br>
+++ lldb/trunk/include/lldb/Interpreter/Args.h Thu Aug 11 18:51:28 2016<br>
@@ -314,10 +314,22 @@ public:<br>
/// get processed start at the second argument. The first argument<br>
/// is assumed to be the command and will not be touched.<br>
///<br>
+ /// param[in] platform_sp<br>
+ /// The platform used for option validation. This is necessary<br>
+ /// because an empty execution_context is not enough to get us<br>
+ /// to a reasonable platform. If the platform isn't given,<br>
+ /// we'll try to get it from the execution context. If we can't<br>
+ /// get it from the execution context, we'll skip validation.<br>
+ ///<br>
+ /// param[in] require_validation<br>
+ /// When true, it will fail option parsing if validation could<br>
+ /// not occur due to not having a platform.<br>
+ ///<br>
/// @see class Options<br>
//------------------------------------------------------------------<br>
Error<br>
- ParseOptions (Options &options);<br>
+ ParseOptions (Options &options, ExecutionContext *execution_context,<br>
+ lldb::PlatformSP platform_sp, bool require_validation);<br>
<br>
size_t<br>
FindArgumentIndexForOption (Option *long_options, int long_options_index);<br>
<br>
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h (original)<br>
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h Thu Aug 11 18:51:28 2016<br>
@@ -37,12 +37,12 @@ public:<br>
GetDefinitions() override;<br>
<br>
Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
bool<br>
GetArchitecture (Platform *platform, ArchSpec &arch);<br>
<br>
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h (original)<br>
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h Thu Aug 11 18:51:28 2016<br>
@@ -51,12 +51,12 @@ namespace lldb_private {<br>
}<br>
<br>
Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
OptionValueBoolean &<br>
GetOptionValue ()<br>
<br>
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h (original)<br>
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h Thu Aug 11 18:51:28 2016<br>
@@ -50,12 +50,12 @@ public:<br>
}<br>
<br>
Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
OptionValueFileSpec &<br>
GetOptionValue ()<br>
@@ -105,12 +105,12 @@ public:<br>
}<br>
<br>
Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
OptionValueFileSpecList &<br>
GetOptionValue ()<br>
<br>
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h (original)<br>
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h Thu Aug 11 18:51:28 2016<br>
@@ -46,12 +46,12 @@ public:<br>
GetDefinitions() override;<br>
<br>
Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
lldb::Format<br>
GetFormat () const<br>
@@ -111,7 +111,7 @@ public:<br>
<br>
protected:<br>
bool<br>
- ParserGDBFormatLetter (CommandInterpreter &interpreter,<br>
+ ParserGDBFormatLetter (ExecutionContext *execution_context,<br>
char format_letter,<br>
lldb::Format &format,<br>
uint32_t &byte_size);<br>
<br>
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h (original)<br>
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h Thu Aug 11 18:51:28 2016<br>
@@ -37,12 +37,12 @@ public:<br>
GetDefinitions() override;<br>
<br>
Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
const OptionValueFileSpec &<br>
GetFile ()<br>
<br>
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h (original)<br>
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h Thu Aug 11 18:51:28 2016<br>
@@ -47,12 +47,12 @@ public:<br>
GetDefinitions() override;<br>
<br>
Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
lldb::PlatformSP<br>
CreatePlatformWithOptions (CommandInterpreter &interpreter,<br>
<br>
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupString.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupString.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupString.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Interpreter/OptionGroupString.h (original)<br>
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupString.h Thu Aug 11 18:51:28 2016<br>
@@ -49,12 +49,12 @@ namespace lldb_private {<br>
}<br>
<br>
Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
OptionValueString &<br>
GetOptionValue ()<br>
<br>
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h (original)<br>
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h Thu Aug 11 18:51:28 2016<br>
@@ -50,12 +50,12 @@ namespace lldb_private {<br>
}<br>
<br>
Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
OptionValueUInt64 &<br>
GetOptionValue ()<br>
<br>
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h (original)<br>
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h Thu Aug 11 18:51:28 2016<br>
@@ -37,12 +37,12 @@ public:<br>
GetDefinitions() override;<br>
<br>
Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
const OptionValueUUID &<br>
GetOptionValue () const<br>
<br>
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h (original)<br>
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h Thu Aug 11 18:51:28 2016<br>
@@ -37,12 +37,12 @@ public:<br>
GetDefinitions() override;<br>
<br>
Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
bool<br>
AnyOptionWasSet () const<br>
<br>
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h (original)<br>
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h Thu Aug 11 18:51:28 2016<br>
@@ -37,12 +37,12 @@ namespace lldb_private {<br>
GetDefinitions() override;<br>
<br>
Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_arg) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_arg,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
bool include_frame_options:1,<br>
show_args:1, // Frame option only (include_frame_options == true)<br>
<br>
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h (original)<br>
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h Thu Aug 11 18:51:28 2016<br>
@@ -39,12 +39,12 @@ namespace lldb_private {<br>
GetDefinitions() override;<br>
<br>
Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_arg) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_arg,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
// Note:<br>
// eWatchRead == LLDB_WATCH_TYPE_READ; and<br>
<br>
Modified: lldb/trunk/include/lldb/Interpreter/Options.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Options.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Options.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Interpreter/Options.h (original)<br>
+++ lldb/trunk/include/lldb/Interpreter/Options.h Thu Aug 11 18:51:28 2016<br>
@@ -117,7 +117,7 @@ namespace lldb_private {<br>
class Options<br>
{<br>
public:<br>
- Options (CommandInterpreter &interpreter);<br>
+ Options ();<br>
<br>
virtual<br>
~Options ();<br>
@@ -160,7 +160,8 @@ public:<br>
<br>
void<br>
GenerateOptionUsage (Stream &strm,<br>
- CommandObject *cmd);<br>
+ CommandObject *cmd,<br>
+ uint32_t screen_width);<br>
<br>
bool<br>
SupportsLongOption (const char *long_option);<br>
@@ -180,10 +181,10 @@ public:<br>
// Option::OptionParsingStarting() like they did before. This was error<br>
// prone and subclasses shouldn't have to do it.<br>
void<br>
- NotifyOptionParsingStarting ();<br>
+ NotifyOptionParsingStarting (ExecutionContext *execution_context);<br>
<br>
Error<br>
- NotifyOptionParsingFinished ();<br>
+ NotifyOptionParsingFinished (ExecutionContext *execution_context);<br>
<br>
//------------------------------------------------------------------<br>
/// Set the value of an option.<br>
@@ -196,12 +197,17 @@ public:<br>
/// The argument value for the option that the user entered, or<br>
/// nullptr if there is no argument for the current option.<br>
///<br>
+ /// @param[in] execution_context<br>
+ /// The execution context to use for evaluating the option.<br>
+ /// May be nullptr if the option is to be evaluated outside any<br>
+ /// particular context.<br>
///<br>
/// @see Args::ParseOptions (Options&)<br>
/// @see man getopt_long_only<br>
//------------------------------------------------------------------<br>
virtual Error<br>
- SetOptionValue (uint32_t option_idx, const char *option_arg) = 0;<br>
+ SetOptionValue (uint32_t option_idx, const char *option_arg,<br>
+ ExecutionContext *execution_context) = 0;<br>
<br>
//------------------------------------------------------------------<br>
/// Handles the generic bits of figuring out whether we are in an<br>
@@ -245,6 +251,7 @@ public:<br>
int char_pos,<br>
int match_start_point,<br>
int max_return_elements,<br>
+ CommandInterpreter &interpreter,<br>
bool &word_complete,<br>
lldb_private::StringList &matches);<br>
<br>
@@ -276,6 +283,9 @@ public:<br>
/// See CommandObject::HandleCompletions for a description of<br>
/// how these work.<br>
///<br>
+ /// @param[in] interpreter<br>
+ /// The command interpreter in which we're doing completion.<br>
+ ///<br>
/// @param[out] word_complete<br>
/// \btrue if this is a complete option value (a space will<br>
/// be inserted after the completion.) \bfalse otherwise.<br>
@@ -298,21 +308,15 @@ public:<br>
int opt_element_index,<br>
int match_start_point,<br>
int max_return_elements,<br>
+ CommandInterpreter &interpreter,<br>
bool &word_complete,<br>
StringList &matches);<br>
<br>
- CommandInterpreter&<br>
- GetInterpreter()<br>
- {<br>
- return m_interpreter;<br>
- }<br>
-<br>
protected:<br>
// This is a set of options expressed as indexes into the options table for this Option.<br>
typedef std::set<int> OptionSet;<br>
typedef std::vector<OptionSet> OptionSetVector;<br>
<br>
- CommandInterpreter &m_interpreter;<br>
std::vector<Option> m_getopt_table;<br>
OptionSet m_seen_options;<br>
OptionSetVector m_required_options;<br>
@@ -343,10 +347,10 @@ protected:<br>
// option parse. Each subclass must override this function and revert<br>
// all option settings to default values.<br>
virtual void<br>
- OptionParsingStarting () = 0;<br>
+ OptionParsingStarting (ExecutionContext *execution_context) = 0;<br>
<br>
virtual Error<br>
- OptionParsingFinished ()<br>
+ OptionParsingFinished (ExecutionContext *execution_context)<br>
{<br>
// If subclasses need to know when the options are done being parsed<br>
// they can implement this function to do extra checking<br>
@@ -370,15 +374,15 @@ protected:<br>
GetDefinitions () = 0;<br>
<br>
virtual Error<br>
- SetOptionValue (CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) = 0;<br>
+ SetOptionValue (uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) = 0;<br>
<br>
virtual void<br>
- OptionParsingStarting (CommandInterpreter &interpreter) = 0;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) = 0;<br>
<br>
virtual Error<br>
- OptionParsingFinished (CommandInterpreter &interpreter)<br>
+ OptionParsingFinished(ExecutionContext *execution_context)<br>
{<br>
// If subclasses need to know when the options are done being parsed<br>
// they can implement this function to do extra checking<br>
@@ -390,8 +394,8 @@ protected:<br>
class OptionGroupOptions : public Options<br>
{<br>
public:<br>
- OptionGroupOptions (CommandInterpreter &interpreter) :<br>
- Options (interpreter),<br>
+ OptionGroupOptions () :<br>
+ Options (),<br>
m_option_defs (),<br>
m_option_infos (),<br>
m_did_finalize (false)<br>
@@ -451,13 +455,14 @@ protected:<br>
<br>
Error<br>
SetOptionValue(uint32_t option_idx,<br>
- const char *option_arg) override;<br>
+ const char *option_arg,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting() override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
Error<br>
- OptionParsingFinished() override;<br>
+ OptionParsingFinished(ExecutionContext *execution_context) override;<br>
<br>
const OptionDefinition*<br>
GetDefinitions() override<br>
<br>
Modified: lldb/trunk/include/lldb/Target/Platform.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Target/Platform.h (original)<br>
+++ lldb/trunk/include/lldb/Target/Platform.h Thu Aug 11 18:51:28 2016<br>
@@ -1326,12 +1326,12 @@ class ModuleCache;<br>
~OptionGroupPlatformRSync() override = default;<br>
<br>
lldb_private::Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
const lldb_private::OptionDefinition*<br>
GetDefinitions() override;<br>
@@ -1362,12 +1362,12 @@ class ModuleCache;<br>
~OptionGroupPlatformSSH() override = default;<br>
<br>
lldb_private::Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
uint32_t<br>
GetNumDefinitions() override;<br>
@@ -1396,12 +1396,12 @@ class ModuleCache;<br>
~OptionGroupPlatformCaching() override = default;<br>
<br>
lldb_private::Error<br>
- SetOptionValue(CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override;<br>
+ SetOptionValue(uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting(CommandInterpreter &interpreter) override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
uint32_t<br>
GetNumDefinitions() override;<br>
<br>
Modified: lldb/trunk/include/lldb/Target/Process.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Target/Process.h (original)<br>
+++ lldb/trunk/include/lldb/Target/Process.h Thu Aug 11 18:51:28 2016<br>
@@ -421,20 +421,21 @@ protected:<br>
class ProcessLaunchCommandOptions : public Options<br>
{<br>
public:<br>
- ProcessLaunchCommandOptions (CommandInterpreter &interpreter) :<br>
- Options(interpreter)<br>
+ ProcessLaunchCommandOptions () :<br>
+ Options()<br>
{<br>
// Keep default values of all options in one place: OptionParsingStarting ()<br>
- OptionParsingStarting ();<br>
+ OptionParsingStarting (nullptr);<br>
}<br>
<br>
~ProcessLaunchCommandOptions() override = default;<br>
<br>
Error<br>
- SetOptionValue (uint32_t option_idx, const char *option_arg) override;<br>
+ SetOptionValue (uint32_t option_idx, const char *option_arg,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting() override<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override<br>
{<br>
launch_info.Clear();<br>
disable_aslr = eLazyBoolCalculate;<br>
<br>
Modified: lldb/trunk/source/Commands/CommandObjectArgs.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.cpp?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.cpp?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Commands/CommandObjectArgs.cpp (original)<br>
+++ lldb/trunk/source/Commands/CommandObjectArgs.cpp Thu Aug 11 18:51:28 2016<br>
@@ -37,16 +37,18 @@ using namespace lldb_private;<br>
//<br>
<br>
CommandObjectArgs::CommandOptions::CommandOptions (CommandInterpreter &interpreter) :<br>
- Options(interpreter)<br>
+ Options()<br>
{<br>
// Keep only one place to reset the values to their defaults<br>
- OptionParsingStarting();<br>
+ OptionParsingStarting(nullptr);<br>
}<br>
<br>
CommandObjectArgs::CommandOptions::~CommandOptions() = default;<br>
<br>
Error<br>
-CommandObjectArgs::CommandOptions::SetOptionValue (uint32_t option_idx, const char *option_arg)<br>
+CommandObjectArgs::CommandOptions::SetOptionValue(uint32_t option_idx,<br>
+ const char *option_arg,<br>
+ ExecutionContext *execution_context)<br>
{<br>
Error error;<br>
<br>
@@ -57,7 +59,8 @@ CommandObjectArgs::CommandOptions::SetOp<br>
}<br>
<br>
void<br>
-CommandObjectArgs::CommandOptions::OptionParsingStarting ()<br>
+CommandObjectArgs::CommandOptions::OptionParsingStarting(<br>
+ ExecutionContext *execution_context)<br>
{<br>
}<br>
<br>
<br>
Modified: lldb/trunk/source/Commands/CommandObjectArgs.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.h?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.h?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Commands/CommandObjectArgs.h (original)<br>
+++ lldb/trunk/source/Commands/CommandObjectArgs.h Thu Aug 11 18:51:28 2016<br>
@@ -32,10 +32,11 @@ namespace lldb_private {<br>
~CommandOptions() override;<br>
<br>
Error<br>
- SetOptionValue(uint32_t option_idx, const char *option_arg) override;<br>
+ SetOptionValue(uint32_t option_idx, const char *option_arg,<br>
+ ExecutionContext *execution_context) override;<br>
<br>
void<br>
- OptionParsingStarting() override;<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override;<br>
<br>
const OptionDefinition*<br>
GetDefinitions() override;<br>
<br>
Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)<br>
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Thu Aug 11 18:51:28 2016<br>
@@ -69,7 +69,7 @@ public:<br>
"breakpoint set",<br>
"Sets a breakpoint or set of breakpoints in the executable.",<br>
"breakpoint set <cmd-options>"),<br>
- m_options (interpreter)<br>
+ m_options ()<br>
{<br>
}<br>
<br>
@@ -84,8 +84,8 @@ public:<br>
class CommandOptions : public Options<br>
{<br>
public:<br>
- CommandOptions (CommandInterpreter &interpreter) :<br>
- Options (interpreter),<br>
+ CommandOptions () :<br>
+ Options (),<br>
m_condition (),<br>
m_filenames (),<br>
m_line_num (0),<br>
@@ -116,7 +116,8 @@ public:<br>
~CommandOptions() override = default;<br>
<br>
Error<br>
- SetOptionValue (uint32_t option_idx, const char *option_arg) override<br>
+ SetOptionValue (uint32_t option_idx, const char *option_arg,<br>
+ ExecutionContext *execution_context) override<br>
{<br>
Error error;<br>
const int short_option = m_getopt_table[option_idx].val;<br>
@@ -125,8 +126,9 @@ public:<br>
{<br>
case 'a':<br>
{<br>
- ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());<br>
- m_load_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);<br>
+ m_load_addr =<br>
+ Args::StringToAddress(execution_context, option_arg,<br>
+ LLDB_INVALID_ADDRESS, &error);<br>
}<br>
break;<br>
<br>
@@ -279,9 +281,10 @@ public:<br>
<br>
case 'R':<br>
{<br>
- ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());<br>
lldb::addr_t tmp_offset_addr;<br>
- tmp_offset_addr = Args::StringToAddress(&exe_ctx, option_arg, 0, &error);<br>
+ tmp_offset_addr =<br>
+ Args::StringToAddress(execution_context, option_arg,<br>
+ 0, &error);<br>
if (error.Success())<br>
m_offset_addr = tmp_offset_addr;<br>
}<br>
@@ -355,7 +358,7 @@ public:<br>
}<br>
<br>
void<br>
- OptionParsingStarting () override<br>
+ OptionParsingStarting (ExecutionContext *execution_context) override<br>
{<br>
m_condition.clear();<br>
m_filenames.Clear();<br>
@@ -892,7 +895,7 @@ public:<br>
"If no breakpoint is specified, acts on the last created breakpoint. "<br>
"With the exception of -e, -d and -i, passing an empty argument clears the modification.",<br>
nullptr),<br>
- m_options (interpreter)<br>
+ m_options ()<br>
{<br>
CommandArgumentEntry arg;<br>
CommandObject::AddIDsArgumentData(arg, eArgTypeBreakpointID, eArgTypeBreakpointIDRange);<br>
@@ -911,8 +914,8 @@ public:<br>
class CommandOptions : public Options<br>
{<br>
public:<br>
- CommandOptions (CommandInterpreter &interpreter) :<br>
- Options (interpreter),<br>
+ CommandOptions () :<br>
+ Options (),<br>
m_ignore_count (0),<br>
m_thread_id(LLDB_INVALID_THREAD_ID),<br>
m_thread_id_passed(false),<br>
@@ -935,7 +938,8 @@ public:<br>
~CommandOptions() override = default;<br>
<br>
Error<br>
- SetOptionValue (uint32_t option_idx, const char *option_arg) override<br>
+ SetOptionValue (uint32_t option_idx, const char *option_arg,<br>
+ ExecutionContext *execution_context) override<br>
{<br>
Error error;<br>
const int short_option = m_getopt_table[option_idx].val;<br>
@@ -1031,7 +1035,7 @@ public:<br>
}<br>
<br>
void<br>
- OptionParsingStarting () override<br>
+ OptionParsingStarting (ExecutionContext *execution_context) override<br>
{<br>
m_ignore_count = 0;<br>
m_thread_id = LLDB_INVALID_THREAD_ID;<br>
@@ -1418,7 +1422,7 @@ public:<br>
"breakpoint list",<br>
"List some or all breakpoints at configurable levels of detail.",<br>
nullptr),<br>
- m_options (interpreter)<br>
+ m_options ()<br>
{<br>
CommandArgumentEntry arg;<br>
CommandArgumentData bp_id_arg;<br>
@@ -1445,8 +1449,8 @@ public:<br>
class CommandOptions : public Options<br>
{<br>
public:<br>
- CommandOptions (CommandInterpreter &interpreter) :<br>
- Options (interpreter),<br>
+ CommandOptions () :<br>
+ Options (),<br>
m_level (lldb::eDescriptionLevelBrief),<br>
m_use_dummy(false)<br>
{<br>
@@ -1455,7 +1459,8 @@ public:<br>
~CommandOptions() override = default;<br>
<br>
Error<br>
- SetOptionValue (uint32_t option_idx, const char *option_arg) override<br>
+ SetOptionValue (uint32_t option_idx, const char *option_arg,<br>
+ ExecutionContext *execution_context) override<br>
{<br>
Error error;<br>
const int short_option = m_getopt_table[option_idx].val;<br>
@@ -1486,7 +1491,7 @@ public:<br>
}<br>
<br>
void<br>
- OptionParsingStarting () override<br>
+ OptionParsingStarting (ExecutionContext *execution_context) override<br>
{<br>
m_level = lldb::eDescriptionLevelFull;<br>
m_internal = false;<br>
@@ -1622,7 +1627,7 @@ public:<br>
: CommandObjectParsed(interpreter, "breakpoint clear",<br>
"Delete or disable breakpoints matching the specified source file and line.",<br>
"breakpoint clear <cmd-options>"),<br>
- m_options(interpreter)<br>
+ m_options()<br>
{<br>
}<br>
<br>
@@ -1637,8 +1642,8 @@ public:<br>
class CommandOptions : public Options<br>
{<br>
public:<br>
- CommandOptions (CommandInterpreter &interpreter) :<br>
- Options (interpreter),<br>
+ CommandOptions () :<br>
+ Options (),<br>
m_filename (),<br>
m_line_num (0)<br>
{<br>
@@ -1647,7 +1652,8 @@ public:<br>
~CommandOptions() override = default;<br>
<br>
Error<br>
- SetOptionValue (uint32_t option_idx, const char *option_arg) override<br>
+ SetOptionValue (uint32_t option_idx, const char *option_arg,<br>
+ ExecutionContext *execution_context) override<br>
{<br>
Error error;<br>
const int short_option = m_getopt_table[option_idx].val;<br>
@@ -1671,7 +1677,7 @@ public:<br>
}<br>
<br>
void<br>
- OptionParsingStarting () override<br>
+ OptionParsingStarting (ExecutionContext *execution_context) override<br>
{<br>
m_filename.clear();<br>
m_line_num = 0;<br>
@@ -1815,7 +1821,7 @@ public:<br>
"breakpoint delete",<br>
"Delete the specified breakpoint(s). If no breakpoints are specified, delete them all.",<br>
nullptr),<br>
- m_options (interpreter)<br>
+ m_options()<br>
{<br>
CommandArgumentEntry arg;<br>
CommandObject::AddIDsArgumentData(arg, eArgTypeBreakpointID, eArgTypeBreakpointIDRange);<br>
@@ -1834,8 +1840,8 @@ public:<br>
class CommandOptions : public Options<br>
{<br>
public:<br>
- CommandOptions (CommandInterpreter &interpreter) :<br>
- Options (interpreter),<br>
+ CommandOptions () :<br>
+ Options (),<br>
m_use_dummy (false),<br>
m_force (false)<br>
{<br>
@@ -1844,7 +1850,8 @@ public:<br>
~CommandOptions() override = default;<br>
<br>
Error<br>
- SetOptionValue (uint32_t option_idx, const char *option_arg) override<br>
+ SetOptionValue (uint32_t option_idx, const char *option_arg,<br>
+ ExecutionContext *execution_context) override<br>
{<br>
Error error;<br>
const int short_option = m_getopt_table[option_idx].val;<br>
@@ -1868,7 +1875,7 @@ public:<br>
}<br>
<br>
void<br>
- OptionParsingStarting () override<br>
+ OptionParsingStarting (ExecutionContext *execution_context) override<br>
{<br>
m_use_dummy = false;<br>
m_force = false;<br>
@@ -2025,9 +2032,9 @@ public:<br>
}<br>
<br>
Error<br>
- SetOptionValue (CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override<br>
+ SetOptionValue (uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override<br>
{<br>
Error error;<br>
const int short_option = g_breakpoint_name_options[option_idx].short_option;<br>
@@ -2056,7 +2063,7 @@ public:<br>
}<br>
<br>
void<br>
- OptionParsingStarting (CommandInterpreter &interpreter) override<br>
+ OptionParsingStarting (ExecutionContext *execution_context) override<br>
{<br>
m_name.Clear();<br>
m_breakpoint.Clear();<br>
@@ -2078,7 +2085,7 @@ public:<br>
"Add a name to the breakpoints provided.",<br>
"breakpoint name add <command-options> <breakpoint-id-list>"),<br>
m_name_options(),<br>
- m_option_group(interpreter)<br>
+ m_option_group()<br>
{<br>
// Create the first variant for the first (and only) argument for this command.<br>
CommandArgumentEntry arg1;<br>
@@ -2171,7 +2178,7 @@ public:<br>
"Delete a name from the breakpoints provided.",<br>
"breakpoint name delete <command-options> <breakpoint-id-list>"),<br>
m_name_options(),<br>
- m_option_group(interpreter)<br>
+ m_option_group()<br>
{<br>
// Create the first variant for the first (and only) argument for this command.<br>
CommandArgumentEntry arg1;<br>
@@ -2263,7 +2270,7 @@ public:<br>
"List either the names for a breakpoint or the breakpoints for a given name.",<br>
"breakpoint name list <command-options>"),<br>
m_name_options(),<br>
- m_option_group(interpreter)<br>
+ m_option_group()<br>
{<br>
m_option_group.Append (&m_name_options);<br>
m_option_group.Finalize();<br>
<br>
Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original)<br>
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Thu Aug 11 18:51:28 2016<br>
@@ -42,7 +42,7 @@ public:<br>
" If no breakpoint is specified, adds the commands to the last created breakpoint.",<br>
nullptr),<br>
IOHandlerDelegateMultiline("DONE", IOHandlerDelegate::Completion::LLDBCommand),<br>
- m_options(interpreter)<br>
+ m_options()<br>
{<br>
SetHelpLong (<br>
R"(<br>
@@ -295,8 +295,8 @@ are no syntax errors may indicate that a<br>
class CommandOptions : public Options<br>
{<br>
public:<br>
- CommandOptions (CommandInterpreter &interpreter) :<br>
- Options (interpreter),<br>
+ CommandOptions () :<br>
+ Options (),<br>
m_use_commands (false),<br>
m_use_script_language (false),<br>
m_script_language (eScriptLanguageNone),<br>
@@ -309,7 +309,8 @@ are no syntax errors may indicate that a<br>
~CommandOptions() override = default;<br>
<br>
Error<br>
- SetOptionValue (uint32_t option_idx, const char *option_arg) override<br>
+ SetOptionValue (uint32_t option_idx, const char *option_arg,<br>
+ ExecutionContext *execution_context) override<br>
{<br>
Error error;<br>
const int short_option = m_getopt_table[option_idx].val;<br>
@@ -363,7 +364,7 @@ are no syntax errors may indicate that a<br>
}<br>
<br>
void<br>
- OptionParsingStarting () override<br>
+ OptionParsingStarting (ExecutionContext *execution_context) override<br>
{<br>
m_use_commands = true;<br>
m_use_script_language = false;<br>
@@ -566,7 +567,7 @@ public:<br>
"delete",<br>
"Delete the set of commands from a breakpoint.",<br>
nullptr),<br>
- m_options (interpreter)<br>
+ m_options()<br>
{<br>
CommandArgumentEntry arg;<br>
CommandArgumentData bp_id_arg;<br>
@@ -593,16 +594,17 @@ public:<br>
class CommandOptions : public Options<br>
{<br>
public:<br>
- CommandOptions (CommandInterpreter &interpreter) :<br>
- Options (interpreter),<br>
- m_use_dummy (false)<br>
+ CommandOptions() :<br>
+ Options(),<br>
+ m_use_dummy(false)<br>
{<br>
}<br>
<br>
~CommandOptions() override = default;<br>
<br>
Error<br>
- SetOptionValue (uint32_t option_idx, const char *option_arg) override<br>
+ SetOptionValue (uint32_t option_idx, const char *option_arg,<br>
+ ExecutionContext *execution_context) override<br>
{<br>
Error error;<br>
const int short_option = m_getopt_table[option_idx].val;<br>
@@ -622,7 +624,7 @@ public:<br>
}<br>
<br>
void<br>
- OptionParsingStarting () override<br>
+ OptionParsingStarting (ExecutionContext *execution_context) override<br>
{<br>
m_use_dummy = false;<br>
}<br>
<br>
Modified: lldb/trunk/source/Commands/CommandObjectBugreport.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBugreport.cpp?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBugreport.cpp?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Commands/CommandObjectBugreport.cpp (original)<br>
+++ lldb/trunk/source/Commands/CommandObjectBugreport.cpp Thu Aug 11 18:51:28 2016<br>
@@ -36,7 +36,7 @@ public:<br>
"bugreport unwind",<br>
"Create a bugreport for a bug in the stack unwinding code.",<br>
nullptr),<br>
- m_option_group(interpreter),<br>
+ m_option_group(),<br>
m_outfile_options()<br>
{<br>
m_option_group.Append (&m_outfile_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1 | LLDB_OPT_SET_2 | LLDB_OPT_SET_3);<br>
<br>
Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=278440&r1=278439&r2=278440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=278440&r1=278439&r2=278440&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)<br>
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Thu Aug 11 18:51:28 2016<br>
@@ -44,7 +44,7 @@ public:<br>
"command history",<br>
"Dump the history of commands in this session.",<br>
nullptr),<br>
- m_options (interpreter)<br>
+ m_options()<br>
{<br>
}<br>
<br>
@@ -60,8 +60,8 @@ protected:<br>
class CommandOptions : public Options<br>
{<br>
public:<br>
- CommandOptions (CommandInterpreter &interpreter) :<br>
- Options (interpreter),<br>
+ CommandOptions() :<br>
+ Options(),<br>
m_start_idx(0),<br>
m_stop_idx(0),<br>
m_count(0),<br>
@@ -72,7 +72,8 @@ protected:<br>
~CommandOptions() override = default;<br>
<br>
Error<br>
- SetOptionValue (uint32_t option_idx, const char *option_arg) override<br>
+ SetOptionValue (uint32_t option_idx, const char *option_arg,<br>
+ ExecutionContext *execution_context) override<br>
{<br>
Error error;<br>
const int short_option = m_getopt_table[option_idx].val;<br>
@@ -107,7 +108,7 @@ protected:<br>
}<br>
<br>
void<br>
- OptionParsingStarting () override<br>
+ OptionParsingStarting (ExecutionContext *execution_context) override<br>
{<br>
m_start_idx.Clear();<br>
m_stop_idx.Clear();<br>
@@ -238,7 +239,7 @@ public:<br>
CommandObjectCommandsSource(CommandInterpreter &interpreter)<br>
: CommandObjectParsed(interpreter, "command source", "Read and execute LLDB commands from the file <filename>.",<br>
nullptr),<br>
- m_options(interpreter)<br>
+ m_options()<br>
{<br>
CommandArgumentEntry arg;<br>
CommandArgumentData file_arg;<br>
@@ -274,8 +275,8 @@ public:<br>
{<br>
std::string completion_str (input.GetArgumentAtIndex(cursor_index));<br>
completion_str.erase (cursor_char_position);<br>
-<br>
- CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,<br>
+<br>
+ CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),<br>
CommandCompletions::eDiskFileCompletion,<br>
completion_str.c_str(),<br>
match_start_point,<br>
@@ -296,8 +297,8 @@ protected:<br>
class CommandOptions : public Options<br>
{<br>
public:<br>
- CommandOptions (CommandInterpreter &interpreter) :<br>
- Options (interpreter),<br>
+ CommandOptions() :<br>
+ Options(),<br>
m_stop_on_error (true),<br>
m_silent_run (false),<br>
m_stop_on_continue (true)<br>
@@ -307,7 +308,8 @@ protected:<br>
~CommandOptions() override = default;<br>
<br>
Error<br>
- SetOptionValue (uint32_t option_idx, const char *option_arg) override<br>
+ SetOptionValue (uint32_t option_idx, const char *option_arg,<br>
+ ExecutionContext *execution_context) override<br>
{<br>
Error error;<br>
const int short_option = m_getopt_table[option_idx].val;<br>
@@ -335,7 +337,7 @@ protected:<br>
}<br>
<br>
void<br>
- OptionParsingStarting () override<br>
+ OptionParsingStarting (ExecutionContext *execution_context) override<br>
{<br>
m_stop_on_error.Clear();<br>
m_silent_run.Clear();<br>
@@ -454,9 +456,9 @@ protected:<br>
}<br>
<br>
Error<br>
- SetOptionValue (CommandInterpreter &interpreter,<br>
- uint32_t option_idx,<br>
- const char *option_value) override<br>
+ SetOptionValue (uint32_t option_idx,<br>
+ const char *option_value,<br>
+ ExecutionContext *execution_context) override<br>
{<br>
Error error;<br>
<br>
@@ -483,7 +485,7 @@ protected:<br>
}<br>
<br>
void<br>
- OptionParsingStarting (CommandInterpreter &interpreter) override<br>
+ OptionParsingStarting (ExecutionContext *execution_context) override<br>
{<br>
m_help.Clear();<br>
m_long_help.Clear();<br>
@@ -509,7 +511,7 @@ public:<br>
CommandObjectCommandsAlias(CommandInterpreter &interpreter)<br>
: CommandObjectRaw(interpreter, "command alias", "Define a custom command in terms of an existing command.",<br>
nullptr),<br>
- m_option_group(interpreter),<br>
+ m_option_group(),<br>
m_command_options()<br>
{<br>
m_option_group.Append(&m_command_options);<br>
@@ -630,8 +632,9 @@ protected:<br>
result.AppendError ("'command alias' requires at least two arguments");<br>
return false;<br>
}<br>
-<br>
- m_option_group.NotifyOptionParsingStarting();<br>
+<br>
+ ExecutionContext exe_ctx = GetCommandInterpreter().GetExecutionContext();<br>
+ m_option_group.NotifyOptionParsingStarting(&exe_ctx);<br>
<br>
const char * remainder = nullptr;<br>
<br>
@@ -663,7 +666,7 @@ protected:<br>
if (!ParseOptions (args, result))<br>
return false;<br>
<br>
- Error error (m_option_group.NotifyOptionParsingFinished());<br>
+ Error error (m_option_group.NotifyOptionParsingFinished(&exe_ctx));<br>
if (error.Fail())<br>
{<br>
result.AppendError (error.AsCString());<br>
@@ -1092,7 +1095,7 @@ public:<br>
"Define a custom command in terms of existing commands by matching regular expressions.",<br>
"command regex <cmd-name> [s/<regex>/<subst>/ ...]"),<br>
IOHandlerDelegateMultiline("", IOHandlerDelegate::Completion::LLDBCommand),<br>
- m_options(interpreter)<br>
+ m_options()<br>
{<br>
SetHelpLong(R"(<br>
)" "This command allows the user to create powerful regular expression commands \<br>
@@ -1359,15 +1362,16 @@ private:<br>
class CommandOptions : public Options<br>
{<br>
public:<br>
- CommandOptions (CommandInterpreter &interpreter) :<br>
- Options (interpreter)<br>
+ CommandOptions() :<br>
+ Options()<br>
{<br>
}<br>
<br>
~CommandOptions() override = default;<br>
<br>
Error<br>
- SetOptionValue (uint32_t option_idx, const char *option_arg) override<br>
+ SetOptionValue (uint32_t option_idx, const char *option_arg,<br>
+ ExecutionContext *execution_context) override<br>
{<br>
Error error;<br>
const int short_option = m_getopt_table[option_idx].val;<br>
@@ -1389,7 +1393,7 @@ private:<br>
}<br>
<br>
void<br>
- OptionParsingStarting () override<br>
+ OptionParsingStarting (ExecutionContext *execution_context) override<br>
{<br>
m_help.clear();<br>
m_syntax.clear();<br>
@@ -1676,7 +1680,7 @@ public:<br>
"command script import",<br>
"Import a scripting module in LLDB.",<br>
nullptr),<br>
- m_options(interpreter)<br>
+ m_options()<br>
{<br>
CommandArgumentEntry arg1;<br>
CommandArgumentData cmd_arg;<br>
@@ -1706,8 +1710,8 @@ public:<br>
{<br>
std::string completion_str (input.GetArgumentAtIndex(cursor_index));<br>
completion_str.erase (cursor_char_position);<br>
-<br>
- CommandCompletions::InvokeCommonCompletionCallbacks(m_interpreter,<br>
+<br>
+ CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),<br>
CommandCompletions::eDiskFileCompletion,<br>
completion_str.c_str(),<br>
match_start_point,<br>
@@ -1728,15 +1732,16 @@ protected:<br>
class CommandOptions : public Options<br>
{<br>
public:<br>
- CommandOptions (CommandInterpreter &interpreter) :<br>
- Options (interpreter)<br>
+ CommandOptions() :<br>
+ Options()<br>
{<br>
}<br>
<br>
~CommandOptions() override = default;<br>
<br>
Error<br>
- SetOptionValue (uint32_t option_idx, const char *option_arg) override<br>
+ SetOptionValue (uint32_t option_idx, const char *option_arg,<br>
+ ExecutionContext *execution_context) override<br>
{<br>
Error error;<br>
const int short_option = m_getopt_table[option_idx].val;<br>
@@ -1755,7 +1760,7 @@ protected:<br>
}<br>
<br>
void<br>
- OptionParsingStarting () override<br>
+ OptionParsingStarting(ExecutionContext *execution_context) override<br>
{<br>
m_allow_reload = true;<br>
}<br>
@@ -1850,7 +1855,7 @@ public:<br>
"Add a scripted function as an LLDB command.",<br>
nullptr),<br>
IOHandlerDelegateMultiline ("DONE"),<br>
- m_options (interpreter)<br>
+ m_options()<br>
{<br>
CommandArgumentEntry arg1;<br>
CommandArgumentData cmd_arg;<br>
@@ -1878,8 +1883,8 @@ protected:<br>
class CommandOptions : public Options<br>
{<br>
public:<br>
- CommandOptions (CommandInterpreter &interpreter) :<br>
- Options (interpreter),<br>
+ CommandOptions() :<br>
+ Options(),<br>
m_class_name(),<br>
m_funct_name(),<br>
m_short_help(),<br>
@@ -1890,7 +1895,8 @@ protected:<br>
~CommandOptions() override = default;<br>
<br>
Error<br>
- </blockquote></div>