diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2011-09-12 19:12:06 +0000 |
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2011-09-12 19:12:06 +0000 |
| commit | 3a9838c07b37744aa607fedef75aefe965c1f8a9 (patch) | |
| tree | 2c5d43dd980ca6e0bebc2a224e8af23e46b6428a | |
| parent | 7bfedd69c5aea90977b3826338d92812e294abff (diff) | |
| download | bcm5719-llvm-3a9838c07b37744aa607fedef75aefe965c1f8a9.tar.gz bcm5719-llvm-3a9838c07b37744aa607fedef75aefe965c1f8a9.zip | |
Fix a bug in OptionGroupWatchpoint.cpp where the '-w' option arg parsing result was not checked
to effect an early error return.
Plus add logic to 'frame variable' command object to check that when watchpoint option is on,
only one variable with exact name (no regex) is specified as the sole command arg.
llvm-svn: 139524
| -rw-r--r-- | lldb/source/Commands/CommandObjectFrame.cpp | 16 | ||||
| -rw-r--r-- | lldb/source/Interpreter/OptionGroupWatchpoint.cpp | 3 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index 58cb095eb04..58a262a4d59 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -414,6 +414,22 @@ public: if (variable_list) { + // If watching a variable, there are certain restrictions to be followed. + if (m_option_watchpoint.watch_variable) + { + if (command.GetArgumentCount() != 1) { + result.GetErrorStream().Printf("error: specify exactly one variable when using the '-w' option\n"); + result.SetStatus(eReturnStatusFailed); + return false; + } else if (m_option_variable.use_regex) { + result.GetErrorStream().Printf("error: specify your variable name exactly (no regex) when using the '-w' option\n"); + result.SetStatus(eReturnStatusFailed); + return false; + } + + // Things have checked out ok... + // m_option_watchpoint.watch_mode specifies the mode for watching. + } if (command.GetArgumentCount() > 0) { VariableList regex_var_list; diff --git a/lldb/source/Interpreter/OptionGroupWatchpoint.cpp b/lldb/source/Interpreter/OptionGroupWatchpoint.cpp index 3616ccb85fd..4f9f2c19a6a 100644 --- a/lldb/source/Interpreter/OptionGroupWatchpoint.cpp +++ b/lldb/source/Interpreter/OptionGroupWatchpoint.cpp @@ -55,9 +55,10 @@ OptionGroupWatchpoint::SetOptionValue (CommandInterpreter &interpreter, switch (short_option) { case 'w': { - watch_variable = false; OptionEnumValueElement *enum_values = g_option_table[option_idx].enum_values; watch_mode = (WatchMode) Args::StringToOptionEnum(option_arg, enum_values, 0, &watch_variable); + if (!watch_variable) + error.SetErrorStringWithFormat("Invalid option arg for '-w': '%s'.\n", option_arg); break; } default: |

