From 5d4e2b767e44cee2c4c2ecff7e37c35376b94826 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Fri, 30 Oct 2009 17:34:53 +0000 Subject: [PATCH] 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. --- gdb/ChangeLog | 8 ++++++++ gdb/mi/mi-cmd-break.c | 2 +- gdb/mi/mi-main.c | 2 ++ gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/gdb.mi/mi-break.exp | 15 +++++++++++++++ 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5b02b0e724c..345afc6242d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2009-10-30 Vladimir Prus + + 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 PR gdb/10783 diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index 9ab8f2df775..7b782bdc67c 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -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); } diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index bfad98ffbe4..2332752b574 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -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 ())) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index d17b4ce1e61..70731946cb2 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-10-30 Vladimir Prus + + * 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 gdb.reverse/consecutive-precsave.exp: Change expect pattern diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp index 8d06c0e63df..76c58c7fe17 100644 --- a/gdb/testsuite/gdb.mi/mi-break.exp +++ b/gdb/testsuite/gdb.mi/mi-break.exp @@ -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 -- 2.30.2