aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/cli/cli-script.c22
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.mi/mi-break.exp4
4 files changed, 31 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index eec03e4..a1621e3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2017-10-31 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * cli/cli-script.c (execute_control_command): Rename to ...
+ (execute_control_command_1): ... this.
+ (execute_control_command): New function.
+
2017-10-31 Simon Marchi <simon.marchi@ericsson.com>
* tracepoint.c (tfind_command): Remove const_cast.
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 0a93e8b..bbdfa40 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -463,8 +463,10 @@ print_command_trace (const char *cmd)
printf_filtered ("%s\n", cmd);
}
-enum command_control_type
-execute_control_command (struct command_line *cmd)
+/* Helper for execute_control_command. */
+
+static enum command_control_type
+execute_control_command_1 (struct command_line *cmd)
{
struct command_line *current;
struct value *val;
@@ -541,7 +543,7 @@ execute_control_command (struct command_line *cmd)
{
scoped_restore save_nesting
= make_scoped_restore (&command_nest_depth, command_nest_depth + 1);
- ret = execute_control_command (current);
+ ret = execute_control_command_1 (current);
/* If we got an error, or a "break" command, then stop
looping. */
@@ -600,7 +602,7 @@ execute_control_command (struct command_line *cmd)
{
scoped_restore save_nesting
= make_scoped_restore (&command_nest_depth, command_nest_depth + 1);
- ret = execute_control_command (current);
+ ret = execute_control_command_1 (current);
/* If we got an error, get out. */
if (ret != simple_control)
@@ -644,6 +646,18 @@ execute_control_command (struct command_line *cmd)
return ret;
}
+enum command_control_type
+execute_control_command (struct command_line *cmd)
+{
+ /* Make sure we use the console uiout. It's possible that we are executing
+ breakpoint commands while running the MI interpreter. */
+ interp *console = interp_lookup (current_ui, INTERP_CONSOLE);
+ scoped_restore save_uiout
+ = make_scoped_restore (&current_uiout, interp_ui_out (console));
+
+ return execute_control_command_1 (cmd);
+}
+
/* Like execute_control_command, but first set
suppress_next_print_command_trace. */
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 9d0f813..8c2fd90 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-10-31 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * gdb.mi/mi-break.exp (test_breakpoint_commands): Test backtrace
+ as a breakpoint command.
+
2017-10-28 Maksim Dzabraev <dzabraew@gmail.com>
PR python/21213
diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
index 38670c2..41a48a1 100644
--- a/gdb/testsuite/gdb.mi/mi-break.exp
+++ b/gdb/testsuite/gdb.mi/mi-break.exp
@@ -277,7 +277,7 @@ proc test_breakpoint_commands {} {
-number 9 -disp keep -func callee2 -file ".*basics.c" \
-line $line_callee2_body
- mi_gdb_test "-break-commands 9 \"set \$i=0\" \"while \$i<10\" \"print \$i\" \"set \$i=\$i+1\" \"end\" \"continue\" " \
+ mi_gdb_test "-break-commands 9 \"bt\" \"set \$i=0\" \"while \$i<10\" \"print \$i\" \"set \$i=\$i+1\" \"end\" \"continue\" " \
"\\^done" \
"breakpoint commands: set commands"
@@ -291,7 +291,7 @@ proc test_breakpoint_commands {} {
set test "intermediate stop and continue, bp commands"
gdb_expect {
-i $gdb_main_spawn_id
- -re ".*\\\$1 = 0.*\\\$10 = 9" {
+ -re ".*callee2.*callee1.*main.*\\\$1 = 0.*\\\$10 = 9" {
pass $test
}
timeout {