Fix breakpoint commands in MI.
authorVladimir Prus <vladimir@codesourcery.com>
Fri, 30 Oct 2009 17:34:53 +0000 (17:34 +0000)
committerVladimir Prus <vladimir@codesourcery.com>
Fri, 30 Oct 2009 17:34:53 +0000 (17:34 +0000)
* mi/mi-main.c (mi_execute_command): Run bpstat_do_actions.
* mi/mi-cmd-break.c (mi_cmd_break_commands): Pass 1 to
read_command_line_1 to actually parse composite commands.

gdb/ChangeLog
gdb/mi/mi-cmd-break.c
gdb/mi/mi-main.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.mi/mi-break.exp

index 5b02b0e724cae2997677aa6b77aacd758f88f705..345afc6242df4839a7bf8e95e2fe907ba6be4c29 100644 (file)
@@ -1,3 +1,11 @@
+2009-10-30  Vladimir Prus  <vladimir@codesourcery.com>
+
+       Fix breakpoint commands in MI.
+
+       * mi/mi-main.c (mi_execute_command): Run bpstat_do_actions.
+       * mi/mi-cmd-break.c (mi_cmd_break_commands): Pass 1 to
+       read_command_line_1 to actually parse composite commands.
+
 2009-10-29  Sandra Loosemore  <sandra@codesourcery.com>
 
        PR gdb/10783
index 9ab8f2df775ab3ba08ceef4fe584ea8168b78374..7b782bdc67c4125d78a7eabc63686048f2e89325 100644 (file)
@@ -298,7 +298,7 @@ mi_cmd_break_commands (char *command, char **argv, int argc)
   mi_command_line_array_ptr = 1;
   mi_command_line_array_cnt = argc;
 
-  break_command = read_command_lines_1 (mi_read_next_line, 0);
+  break_command = read_command_lines_1 (mi_read_next_line, 1);
   breakpoint_set_commands (b, break_command);
 }
 
index bfad98ffbe4f74a4593381d7cf9aeb85a44696a6..2332752b5744aee6d00f07e94a54bbe2bdc4d733 100644 (file)
@@ -1306,6 +1306,8 @@ mi_execute_command (char *cmd, int from_tty)
          mi_out_rewind (uiout);
        }
 
+      bpstat_do_actions ();
+
       if (/* The notifications are only output when the top-level
             interpreter (specified on the command line) is MI.  */      
          ui_out_is_mi_like_p (interp_ui_out (top_level_interpreter ()))
index d17b4ce1e618d1f3f17b1c16d01a9c2739e5ae1d..70731946cb29ce58eb9046a9f89c6cdee8d8e5ac 100644 (file)
@@ -1,3 +1,9 @@
+2009-10-30  Vladimir Prus  <vladimir@codesourcery.com>
+
+       * gdb.mi/mi-break.exp (test_breakpoint_commands): Test
+       that composite commands are parsed OK. And also test
+       that breakpoint commands do work.
+
 2009-10-23  Michael Snyder  <msnyder@vmware.com>
 
        gdb.reverse/consecutive-precsave.exp: Change expect pattern
index 8d06c0e63dfcb1d884111839fd88180a6d8bba8a..76c58c7fe175dd140930bdd223fd4d541b1e46cd 100644 (file)
@@ -219,6 +219,21 @@ proc test_breakpoint_commands {} {
 
     mi_list_breakpoints [list [list 7 "keep" "callee2" "basics.c" "$line_callee2_body" $hex]] \
         "breakpoint commands: check that commands are cleared"
+
+    mi_run_to_main
+
+    mi_create_breakpoint "basics.c:callee2" 9 keep callee2 ".*basics.c" $line_callee2_body $hex \
+             "breakpoint commands: insert breakpoint at basics.c:callee2, again"
+
+    mi_gdb_test "-break-commands 9 \"set \$i=0\" \"while \$i<10\" \"print \$i\" \"set \$i=\$i+1\" \"end\" \"continue\" " \
+        "\\^done" \
+        "breakpoint commands: set commands"
+
+    mi_gdb_test "-exec-continue" \
+        ".*\\\$1 = 0.*\\\$10 = 9.*\\*running.*\\*stopped,reason=\"exited-normally\".*" \
+        "test hitting breakpoint with commands"    
+
+
 }
 
 test_tbreak_creation_and_listing