summaryrefslogtreecommitdiff
path: root/lldb/tools
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-12-17 18:11:48 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-12-17 18:11:48 +0000
commit78cb0defe9ae05207ca6e043ddfb000ee86c6811 (patch)
treebbca37cac76c025f7693dd06ae9459f711eb428c /lldb/tools
parentc7dce0c41bad8fe07d88ca7ce6ee60d6d06193b5 (diff)
[Driver] Fix --repl argument.
The --repl option was incorrectly defined as "Separate" (option and value separated by a space). This resulted in the option not being picked up when no value was specified. This patch fixes the driver so that `--repl` is recognized again. I split the option into two: - A flag: `--repl` and `-r` which take no arguments. - A joined option: `--repl=<flags>` and `-r=<flags>` that forward its values to the repl. This should match the driver's old behavior.
Diffstat (limited to 'lldb/tools')
-rw-r--r--lldb/tools/driver/Driver.cpp11
-rw-r--r--lldb/tools/driver/Options.td16
2 files changed, 19 insertions, 8 deletions
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 8a86fe0bf44..295273271e1 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -373,13 +373,14 @@ SBError Driver::ProcessArgs(const opt::InputArgList &args, bool &exiting) {
}
}
- if (auto *arg = args.getLastArg(OPT_repl)) {
- auto arg_value = arg->getValue();
+ if (args.hasArg(OPT_repl)) {
m_option_data.m_repl = true;
- if (arg_value && arg_value[0])
+ }
+
+ if (auto *arg = args.getLastArg(OPT_repl_)) {
+ m_option_data.m_repl = true;
+ if (auto arg_value = arg->getValue())
m_option_data.m_repl_options = arg_value;
- else
- m_option_data.m_repl_options.clear();
}
// We need to process the options below together as their relative order
diff --git a/lldb/tools/driver/Options.td b/lldb/tools/driver/Options.td
index 4a2ddfeefa3..563c0b54fb9 100644
--- a/lldb/tools/driver/Options.td
+++ b/lldb/tools/driver/Options.td
@@ -46,7 +46,8 @@ def: Flag<["-"], "P">,
HelpText<"Alias for --python-path">,
Group<grp_scripting>;
-def script_language: Separate<["--", "-"], "script-language">, MetaVarName<"<language>">,
+def script_language: Separate<["--", "-"], "script-language">,
+ MetaVarName<"<language>">,
HelpText<"Tells the debugger to use the specified scripting language for user-defined scripts.">,
Group<grp_scripting>;
def: Separate<["-"], "l">,
@@ -57,13 +58,22 @@ def: Separate<["-"], "l">,
// Repl options.
def grp_repl : OptionGroup<"repl">, HelpText<"REPL">;
-def repl: Separate<["--", "-"], "repl">,
+def repl: Flag<["--", "-"], "repl">,
HelpText<"Runs lldb in REPL mode with a stub process.">,
Group<grp_repl>;
-def: Separate<["-"], "r">,
+def: Flag<["-"], "r">,
Alias<repl>,
HelpText<"Alias for --repl">,
Group<grp_repl>;
+def repl_: Joined<["--", "-"], "repl=">,
+ MetaVarName<"<flags>">,
+ HelpText<"Runs lldb in REPL mode with a stub process with the given flags.">,
+ Group<grp_repl>;
+def: Joined<["-"], "r=">,
+ MetaVarName<"<flags>">,
+ Alias<repl_>,
+ HelpText<"Alias for --repl=<flags>">,
+ Group<grp_repl>;
def repl_language: Separate<["--", "-"], "repl-language">,
MetaVarName<"<language>">,