diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/ChangeLog | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/dprintf.exp | 53 | ||||
-rw-r--r-- | gdb/testsuite/gdb.mi/mi-dprintf.exp | 45 | ||||
-rw-r--r-- | gdb/testsuite/lib/mi-support.exp | 1 |
4 files changed, 77 insertions, 34 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 88ba2a3..9b5ce14 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2014-03-24 Hui Zhu <hui@codesourcery.com> + Pedro Alves <palves@redhat.com> + + PR breakpoints/16101 + * gdb.base/dprintf.exp: Use unsupported rather than changing the + test pass/fail messages. Detect missing support for dprintf when + breakpoints are actually inserted. + * gdb.base/mi-dprintf.exp: Detect missing support for dprintf when + breakpoints are actually inserted. + * lib/mi-support.exp (mi_run_cmd_full): Return -1 if continue + fails. + 2014-03-24 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.base/gdb-sigterm.exp (do_test): Remove "set debug lin-lwp 1". diff --git a/gdb/testsuite/gdb.base/dprintf.exp b/gdb/testsuite/gdb.base/dprintf.exp index cb21d2e..a040580 100644 --- a/gdb/testsuite/gdb.base/dprintf.exp +++ b/gdb/testsuite/gdb.base/dprintf.exp @@ -96,15 +96,20 @@ if ![target_info exists gdb,noinferiorio] { "2nd dprintf, fprintf" } +# Now test the "agent" style. + set target_can_dprintf 1 -set msg "Set dprintf style to agent" +set msg "set dprintf style to agent" gdb_test_multiple "set dprintf-style agent" $msg { -re "warning: Target cannot run dprintf commands.*\r\n$gdb_prompt $" { + + # The target reports that it doesn't support target side + # commands at all. set target_can_dprintf 0 - pass "$msg - cannot do" + unsupported "$msg" } -re ".*$gdb_prompt $" { - pass "$msg - can do" + pass "$msg" } } @@ -113,20 +118,36 @@ if $target_can_dprintf { gdb_test "" "Breakpoint" - gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "1st dprintf, agent" - - gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "2nd dprintf, agent" + # Even if the the target reports that it does support target side + # commands, we can only tell that it supports them in combination + # with a particular breakpoint type (Z0, Z1, etc.) when we try to + # insert the breakpoint. When "set breakpoint always-inserted is + # off", that'll be on next continue. + set msg "1st dprintf, agent" + gdb_test_multiple "continue" $msg { + -re "Warning:.*Target doesn't support breakpoints that have target side commands.*\r\n$gdb_prompt $" { + set target_can_dprintf 0 + unsupported "$msg" + } + -re "Breakpoint \[0-9\]+, foo .*$gdb_prompt $" { + pass "$msg" + } + } - gdb_test_sequence "info breakpoints" "dprintf info 2" { - "\[\r\n\]Num Type Disp Enb Address +What" - "\[\r\n\]2 breakpoint" - "\[\r\n\]\tbreakpoint already hit 2 times" - "\[\r\n\]3 dprintf" - "\[\r\n\]\tbreakpoint already hit 2 times" - "\[\r\n\] agent-printf \"At foo entry\\\\n\"" - "\[\r\n\]4 dprintf" - "\[\r\n\]\tbreakpoint already hit 2 times" - "\[\r\n\] agent-printf \"arg=%d, g=%d\\\\n\", arg, g" + if $target_can_dprintf { + gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "2nd dprintf, agent" + + gdb_test_sequence "info breakpoints" "dprintf info 2" { + "\[\r\n\]Num Type Disp Enb Address +What" + "\[\r\n\]2 breakpoint" + "\[\r\n\]\tbreakpoint already hit 2 times" + "\[\r\n\]3 dprintf" + "\[\r\n\]\tbreakpoint already hit 2 times" + "\[\r\n\] agent-printf \"At foo entry\\\\n\"" + "\[\r\n\]4 dprintf" + "\[\r\n\]\tbreakpoint already hit 2 times" + "\[\r\n\] agent-printf \"arg=%d, g=%d\\\\n\", arg, g" + } } } diff --git a/gdb/testsuite/gdb.mi/mi-dprintf.exp b/gdb/testsuite/gdb.mi/mi-dprintf.exp index af334cf..983acce 100644 --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp @@ -140,30 +140,39 @@ gdb_expect { } if $target_can_dprintf { - mi_run_cmd + if {[mi_run_cmd] < 0} { + # This likely means we failed to use target side commands in + # combination with software breakpoints. IOW, the target + # likely doesn't support target-side software breakpoints. + set target_can_dprintf 0 + unsupported "send dprintf to target" + } - mi_expect_stop ".*" ".*" ".*" ".*" ".*" "" "mi expect stop" + if $target_can_dprintf { + mi_expect_stop ".*" ".*" ".*" ".*" ".*" "" "mi expect stop" - mi_send_resuming_command "exec-continue" "mi 1st dprintf continue, agent" - mi_expect_stop ".*" "foo" ".*" ".*" ".*" "" "mi 1st dprintf, agent" + mi_send_resuming_command "exec-continue" "mi 1st dprintf continue, agent" + mi_expect_stop ".*" "foo" ".*" ".*" ".*" "" "mi 1st dprintf, agent" - mi_send_resuming_command "exec-continue" "mi 2nd dprintf continue, agent" + mi_send_resuming_command "exec-continue" "mi 2nd dprintf continue, agent" - # The =breakpoint-modified text is a part of the "-exec-continue" output. - set msg "mi info dprintf second time" - gdb_expect { - -re "=breakpoint-modified," { - pass $msg - } - -re ".*$mi_gdb_prompt$" { - fail "$msg" - } - timeout { - fail "$msg" + # The =breakpoint-modified text is a part of the + # "-exec-continue" output. + set msg "mi info dprintf second time" + gdb_expect { + -re "=breakpoint-modified," { + pass $msg + } + -re ".*$mi_gdb_prompt$" { + fail "$msg" + } + timeout { + fail "$msg" + } } - } - mi_expect_stop ".*" "foo" ".*" ".*" ".*" "" "mi 2nd dprintf, agent" + mi_expect_stop ".*" "foo" ".*" ".*" ".*" "" "mi 2nd dprintf, agent" + } } mi_gdb_test "set dprintf-style foobar" ".*error.*" "mi set dprintf style to an unrecognized type" diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 213073a..7c234c0 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -843,6 +843,7 @@ proc mi_run_cmd_full {use_mi_command args} { send_gdb "${run_prefix}continue\n" gdb_expect 60 { -re "${run_match}\\^running\[\r\n\]+\\*running,thread-id=\"\[^\"\]+\"\r\n$mi_gdb_prompt" {} + -re "${run_match}\\^error.*$mi_gdb_prompt" {return -1} default {} } return 0 |