aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.mi
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2017-10-31 21:30:24 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2017-10-31 21:34:24 -0400
commit3a87ae656c283e4f46ddf7d92c06ecb8992c2bf6 (patch)
tree1ab653b3f661835fb7e1be97739d58fb038ba44e /gdb/testsuite/gdb.mi
parent4d01dee4804d39c1671bc220caf32a327e7e4b10 (diff)
downloadgdb-3a87ae656c283e4f46ddf7d92c06ecb8992c2bf6.zip
gdb-3a87ae656c283e4f46ddf7d92c06ecb8992c2bf6.tar.gz
gdb-3a87ae656c283e4f46ddf7d92c06ecb8992c2bf6.tar.bz2
Use console uiout when executing breakpoint commands
As reported here https://sourceware.org/ml/gdb/2017-10/msg00020.html the output of certain commands, like backtrace, doesn't appear anywhere when it is run as a breakpoint command and when using MI. The reason is that the current_uiout is set to the mi_ui_out while these commands run, whereas we want the output as CLI output. Some commands like "print" work, because they use printf_filtered (gdb_stdout, ...) directly, bypassing the current ui_out. The fix I did is to force setting the cli_uiout as the current_uiout when calling execute_control_command. I am not sure if this is the right way to fix the problem, comments about the approach would be appreciated. I enhanced gdb.mi/mi-break.exp to test the backtrace command. Regtested on the buildbot. gdb/ChangeLog: * cli/cli-script.c (execute_control_command): Rename to ... (execute_control_command_1): ... this. (execute_control_command): New function. gdb/testsuite/ChangeLog: * gdb.mi/mi-break.exp (test_breakpoint_commands): Test backtrace as a breakpoint command.
Diffstat (limited to 'gdb/testsuite/gdb.mi')
-rw-r--r--gdb/testsuite/gdb.mi/mi-break.exp4
1 files changed, 2 insertions, 2 deletions
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 {