gdb/mi: handle no condition argument case for -break-condition
[deliverable/binutils-gdb.git] / gdb / mi / mi-cmd-break.c
index 5439937f66bc8530f16b8b4160652a81339eda3c..c2d642d75b4059aa34821ceafb2fd95e22f68d1b 100644 (file)
@@ -423,20 +423,19 @@ mi_cmd_break_condition (const char *command, char **argv, int argc)
        }
     }
 
-  /* There must be at least two more args: a bpnum and a condition
-     expression.  */
-  if (oind + 1 >= argc)
-    error (_("-break-condition: Missing the <number> and/or <expr> "
-            "argument"));
+  /* There must be at least one more arg: a bpnum.  */
+  if (oind >= argc)
+    error (_("-break-condition: Missing the <number> argument"));
 
   int bpnum = atoi (argv[oind]);
 
   /* The rest form the condition expr.  */
-  std::string expr (argv[oind + 1]);
-  for (int i = oind + 2; i < argc; ++i)
+  std::string expr = "";
+  for (int i = oind + 1; i < argc; ++i)
     {
-      expr += " ";
       expr += argv[i];
+      if (i + 1 < argc)
+       expr += " ";
     }
 
   set_breakpoint_condition (bpnum, expr.c_str (), 0 /* from_tty */,
This page took 0.023599 seconds and 4 git commands to generate.