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.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139524 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectFrame.cpp b/source/Commands/CommandObjectFrame.cpp
index 58cb095..58a262a 100644
--- a/source/Commands/CommandObjectFrame.cpp
+++ b/source/Commands/CommandObjectFrame.cpp
@@ -414,6 +414,22 @@
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;