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
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 94e4f96..e95c8ee 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -442,7 +442,9 @@
}
Error
-ProcessLaunchCommandOptions::SetOptionValue (uint32_t option_idx, const char *option_arg)
+ProcessLaunchCommandOptions::SetOptionValue(uint32_t option_idx,
+ const char *option_arg,
+ ExecutionContext *execution_context)
{
Error error;
const int short_option = m_getopt_table[option_idx].val;
@@ -503,8 +505,14 @@
break;
case 'a':
- if (!launch_info.GetArchitecture().SetTriple (option_arg, m_interpreter.GetPlatform(true).get()))
- launch_info.GetArchitecture().SetTriple (option_arg);
+ {
+ TargetSP target_sp = execution_context ?
+ execution_context->GetTargetSP() : TargetSP();
+ PlatformSP platform_sp = target_sp ?
+ target_sp->GetPlatform() : PlatformSP();
+ if (!launch_info.GetArchitecture().SetTriple (option_arg, platform_sp.get()))
+ launch_info.GetArchitecture().SetTriple (option_arg);
+ }
break;
case 'A': // Disable ASLR.