* [PATCH] Fix PR breakpoints/16494: gdb.base/dprintf.exp agent-printf failures with non-Z0-supporting gdbservers @ 2014-03-11 14:32 Hui Zhu 2014-03-21 13:11 ` Pedro Alves 0 siblings, 1 reply; 5+ messages in thread From: Hui Zhu @ 2014-03-11 14:32 UTC (permalink / raw) To: gdb-patches ml; +Cc: Pedro Alves After the patch that commited by Pedro, the GDB can throw error about gdbserver doesn't support agent commands. But the test still get this error because the it doesn't try handle the error when send dprintf to gdbserver. So I make this patch. It test OK and pass regression test in x86_64-linux and powerpc-linux. Thanks, Hui 2014-03-11 Hui Zhu <hui@codesourcery.com> PR breakpoints/16494 * gdb.base/dprintf.exp: Add second check to make sure current target support breakpoints that have target side commands. * gdb.base/mi-dprintf.exp: Ditto. * lib/mi-support.exp (mi_run_cmd_full): Add handle for error. --- a/gdb/testsuite/gdb.base/dprintf.exp +++ b/gdb/testsuite/gdb.base/dprintf.exp @@ -109,6 +109,24 @@ gdb_test_multiple "set dprintf-style age } if $target_can_dprintf { + # Second check to make sure current target support breakpoints that have target side commands + gdb_run_cmd + + gdb_test "" "Breakpoint" + + set msg "Send dprintf to target" + 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 + pass "$msg - cannot do" + } + -re ".*$gdb_prompt $" { + pass "$msg - can do" + } + } +} + +if $target_can_dprintf { gdb_run_cmd gdb_test "" "Breakpoint" @@ -120,7 +138,7 @@ if $target_can_dprintf { 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\]\tbreakpoint already hit 3 times" "\[\r\n\]3 dprintf" "\[\r\n\]\tbreakpoint already hit 2 times" "\[\r\n\] agent-printf \"At foo entry\\\\n\"" --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp @@ -140,6 +140,14 @@ gdb_expect { } if $target_can_dprintf { + # Second check to make sure current target support breakpoints that have target side commands + if {[mi_run_cmd] < 0} { + set target_can_dprintf 0 + unsupported "send dprintf to target" + } +} + +if $target_can_dprintf { mi_run_cmd mi_expect_stop ".*" ".*" ".*" ".*" ".*" "" "mi expect stop" --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -893,6 +893,7 @@ proc mi_run_cmd_full {use_mi_command arg 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.*" {return -1} default {} } return 0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix PR breakpoints/16494: gdb.base/dprintf.exp agent-printf failures with non-Z0-supporting gdbservers 2014-03-11 14:32 [PATCH] Fix PR breakpoints/16494: gdb.base/dprintf.exp agent-printf failures with non-Z0-supporting gdbservers Hui Zhu @ 2014-03-21 13:11 ` Pedro Alves 2014-03-23 11:36 ` Hui Zhu 0 siblings, 1 reply; 5+ messages in thread From: Pedro Alves @ 2014-03-21 13:11 UTC (permalink / raw) To: Hui Zhu; +Cc: gdb-patches ml On 03/11/2014 02:32 PM, Hui Zhu wrote: > --- a/gdb/testsuite/gdb.base/dprintf.exp > +++ b/gdb/testsuite/gdb.base/dprintf.exp > @@ -109,6 +109,24 @@ gdb_test_multiple "set dprintf-style age > } > > if $target_can_dprintf { > + # Second check to make sure current target support breakpoints that have target side commands Line too long. "make sure THE current target supportS". Period at end of sentence. > + gdb_run_cmd > + > + gdb_test "" "Breakpoint" > + > + set msg "Send dprintf to target" > + 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 > + pass "$msg - cannot do" > + } > + -re ".*$gdb_prompt $" { > + pass "$msg - can do" > + } > + } Why not simply merge this check with the existing code just below, that does pretty much the same thing? if $target_can_dprintf { gdb_run_cmd ... > if $target_can_dprintf { > + # Second check to make sure current target support breakpoints that have target side commands > + if {[mi_run_cmd] < 0} { > + set target_can_dprintf 0 > + unsupported "send dprintf to target" > + } > +} > + > +if $target_can_dprintf { > mi_run_cmd Likewise. -- Pedro Alves ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix PR breakpoints/16494: gdb.base/dprintf.exp agent-printf failures with non-Z0-supporting gdbservers 2014-03-21 13:11 ` Pedro Alves @ 2014-03-23 11:36 ` Hui Zhu 2014-03-24 19:39 ` Fix PR breakpoints/16101: gdb.base/dprintf.exp agent-printf, " Pedro Alves 0 siblings, 1 reply; 5+ messages in thread From: Hui Zhu @ 2014-03-23 11:36 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches ml On 03/21/14 21:11, Pedro Alves wrote: Thanks for your review. > On 03/11/2014 02:32 PM, Hui Zhu wrote: >> --- a/gdb/testsuite/gdb.base/dprintf.exp >> +++ b/gdb/testsuite/gdb.base/dprintf.exp >> @@ -109,6 +109,24 @@ gdb_test_multiple "set dprintf-style age >> } >> >> if $target_can_dprintf { >> + # Second check to make sure current target support breakpoints that have target side commands > > Line too long. "make sure THE current target supportS". Period at end of sentence. Update this part to: # Make sure the current target support target side commands. Update mi-dprintf.exp to: # Make sure the current target support target side commands. > >> + gdb_run_cmd >> + >> + gdb_test "" "Breakpoint" >> + >> + set msg "Send dprintf to target" >> + 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 >> + pass "$msg - cannot do" >> + } >> + -re ".*$gdb_prompt $" { >> + pass "$msg - can do" >> + } >> + } > > Why not simply merge this check with the existing code just > below, that does pretty much the same thing? > > if $target_can_dprintf { > gdb_run_cmd > ... > Update this part to: set msg "Send dprintf to target" 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 pass "$msg - cannot do" } -re "Breakpoint \[0-9\]+, foo .*" { pass "1st dprintf, agent" } } 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" } } Update mi-dprintf.exp to: if $target_can_dprintf { # Make sure the current target support target side commands. if {[mi_run_cmd] < 0} { set target_can_dprintf 0 unsupported "send dprintf to target" } 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 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" } } mi_expect_stop ".*" "foo" ".*" ".*" ".*" "" "mi 2nd dprintf, agent" } } > > >> if $target_can_dprintf { >> + # Second check to make sure current target support breakpoints that have target side commands >> + if {[mi_run_cmd] < 0} { >> + set target_can_dprintf 0 >> + unsupported "send dprintf to target" >> + } >> +} >> + >> +if $target_can_dprintf { >> mi_run_cmd > > Likewise. > Post new version. Please help me review it. Best. Hui 2014-03-23 Hui Zhu <hui@codesourcery.com> PR breakpoints/16494 * gdb.base/dprintf.exp: Add second check to make sure current target support breakpoints that have target side commands. * gdb.base/mi-dprintf.exp: Ditto. * lib/mi-support.exp (mi_run_cmd_full): Add handle for error. --- a/gdb/testsuite/gdb.base/dprintf.exp +++ b/gdb/testsuite/gdb.base/dprintf.exp @@ -109,24 +109,36 @@ gdb_test_multiple "set dprintf-style age } if $target_can_dprintf { + # Make sure the current target support target side commands. gdb_run_cmd gdb_test "" "Breakpoint" - gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "1st dprintf, agent" + set msg "Send dprintf to target" + 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 + pass "$msg - cannot do" + } + -re "Breakpoint \[0-9\]+, foo .*" { + pass "1st dprintf, agent" + } + } - gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "2nd dprintf, agent" + 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" + 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" + } } } --- a/gdb/testsuite/gdb.mi/mi-dprintf.exp +++ b/gdb/testsuite/gdb.mi/mi-dprintf.exp @@ -140,30 +140,36 @@ gdb_expect { } if $target_can_dprintf { - mi_run_cmd + # Make sure the current target support target side commands. + if {[mi_run_cmd] < 0} { + 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" --- 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 arg 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.*" {return -1} default {} } return 0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Fix PR breakpoints/16101: gdb.base/dprintf.exp agent-printf, failures with non-Z0-supporting gdbservers 2014-03-23 11:36 ` Hui Zhu @ 2014-03-24 19:39 ` Pedro Alves 2014-03-25 8:27 ` Hui Zhu 0 siblings, 1 reply; 5+ messages in thread From: Pedro Alves @ 2014-03-24 19:39 UTC (permalink / raw) To: Hui Zhu; +Cc: gdb-patches ml AFAICT, this is actually PR16101, not PR16494. Adjusting subject. On 03/23/2014 11:35 AM, Hui Zhu wrote: > On 03/21/14 21:11, Pedro Alves wrote: >>> if $target_can_dprintf { >>> + # Second check to make sure current target support breakpoints that have target side commands >> >> Line too long. "make sure THE current target supportS". Period at end of sentence. > > Update this part to: > # Make sure the current target support target side commands. > > Update mi-dprintf.exp to: > # Make sure the current target support target side commands. Missed the S in "supports". > 2014-03-23 Hui Zhu <hui@codesourcery.com> > > PR breakpoints/16494 PR16101 here. > - gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "1st dprintf, agent" > + set msg "Send dprintf to target" > + 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 > + pass "$msg - cannot do" > + } > + -re "Breakpoint \[0-9\]+, foo .*" { This should expect "$gdb_prompt $", otherwise you'll get racy FAILs. I got those when I tried this out. > + pass "1st dprintf, agent" I think it'd best to use "untested" instead of tweaking the pass/fail message. > --- 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 arg > 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.*" {return -1} Likewise, this should expect "$gdb_prompt $", otherwise you'll get racy FAILs. I've fixed these issues, extended the comments, extended the commit log, adjusted the ChangeLog entry, and pushed it in, as below. Thanks. --------------- From: Hui Zhu <hui@codesourcery.com> Subject: [PATCH] Fix PR breakpoints/16101: gdb.base/dprintf.exp agent-printf failures with non-Z0-supporting gdbservers After a previous patch that was committed by Pedro (0000e5cc), trying to set a dprintf with with a GDBserver that doesn't support agent commands at all now throws an error. But the dprintf tests still fail with some GDBserver targets because they doesn't try to handle the case of the server reporting support for breakpoint commands, but not be able to use those in combination with Z0 (because Z0 isn't actually supported, for example): FAIL: gdb.base/dprintf.exp: 1st dprintf, agent FAIL: gdb.base/dprintf.exp: 2nd dprintf, agent FAIL: gdb.base/dprintf.exp: dprintf info 2 (pattern 4) Similarly for the MI test. This patch makes the tests handle this scenario. Tested with native, and native gdbserver on x86_64 Fedora 17. Also tested with the native-gdbserver.exp board hacked with: set GDBFLAGS "${GDBFLAGS} -ex \"set remote breakpoint-commands off\"" (actually, "set remote breakpoint-commands off" is presently broken, so this was on top of a fix for that command.) which results in: (gdb) PASS: gdb.base/dprintf.exp: 2nd dprintf, gdb set dprintf-style agent warning: Target cannot run dprintf commands, falling back to GDB printf warning: Target cannot run dprintf commands, falling back to GDB printf (gdb) UNSUPPORTED: gdb.base/dprintf.exp: set dprintf style to agent gdb.sum: Running target native-gdbserver Running ../../../src/gdb/testsuite/gdb.base/dprintf.exp ... PASS: gdb.base/dprintf.exp: dprintf PASS: gdb.base/dprintf.exp: dprintf foo PASS: gdb.base/dprintf.exp: dprintf 29 PASS: gdb.base/dprintf.exp: dprintf foo,"At foo entry\n" PASS: gdb.base/dprintf.exp: ignore $bpnum 1 PASS: gdb.base/dprintf.exp: dprintf 26,"arg=%d, g=%d\n", arg, g PASS: gdb.base/dprintf.exp: dprintf info 1 PASS: gdb.base/dprintf.exp: break 27 PASS: gdb.base/dprintf.exp: 1st dprintf, gdb PASS: gdb.base/dprintf.exp: 2nd dprintf, gdb UNSUPPORTED: gdb.base/dprintf.exp: set dprintf style to agent PASS: gdb.base/dprintf.exp: Set dprintf style to an unrecognized type And also with the native-gdbserver.exp board hacked with: set GDBFLAGS "${GDBFLAGS} -ex \"set remote Z-packet off\"" which results in: (gdb) continue Continuing. Warning: Cannot insert breakpoint 3: Target doesn't support breakpoints that have target side commands. Cannot insert breakpoint 4: Target doesn't support breakpoints that have target side commands. (gdb) UNSUPPORTED: gdb.base/dprintf.exp: 1st dprintf, agent gdb.sum: Running target native-gdbserver Running ../../../src/gdb/testsuite/gdb.base/dprintf.exp ... PASS: gdb.base/dprintf.exp: dprintf PASS: gdb.base/dprintf.exp: dprintf foo PASS: gdb.base/dprintf.exp: dprintf 29 PASS: gdb.base/dprintf.exp: dprintf foo,"At foo entry\n" PASS: gdb.base/dprintf.exp: ignore $bpnum 1 PASS: gdb.base/dprintf.exp: dprintf 26,"arg=%d, g=%d\n", arg, g PASS: gdb.base/dprintf.exp: dprintf info 1 PASS: gdb.base/dprintf.exp: break 27 PASS: gdb.base/dprintf.exp: 1st dprintf, gdb PASS: gdb.base/dprintf.exp: 2nd dprintf, gdb PASS: gdb.base/dprintf.exp: set dprintf style to agent UNSUPPORTED: gdb.base/dprintf.exp: 1st dprintf, agent PASS: gdb.base/dprintf.exp: Set dprintf style to an unrecognized type (One of the new comments mentions breakpoint always-inserted mode. Actually testing with breakpoint always-inserted mode fails these dprintf tests, due to the way they are written. But that'll take a more substancial rewrite of the tests, so I'm leaving that for another day.) gdb/testsuite/ 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. --- gdb/testsuite/ChangeLog | 12 +++++++++ gdb/testsuite/gdb.base/dprintf.exp | 53 ++++++++++++++++++++++++++----------- gdb/testsuite/gdb.mi/mi-dprintf.exp | 45 ++++++++++++++++++------------- 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 -- 1.7.11.7 -- Pedro Alves ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Fix PR breakpoints/16101: gdb.base/dprintf.exp agent-printf, failures with non-Z0-supporting gdbservers 2014-03-24 19:39 ` Fix PR breakpoints/16101: gdb.base/dprintf.exp agent-printf, " Pedro Alves @ 2014-03-25 8:27 ` Hui Zhu 0 siblings, 0 replies; 5+ messages in thread From: Hui Zhu @ 2014-03-25 8:27 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches ml Hi Pedro, Thanks for your patch. On 03/25/14 03:39, Pedro Alves wrote: > AFAICT, this is actually PR16101, not PR16494. Adjusting subject. > > On 03/23/2014 11:35 AM, Hui Zhu wrote: >> On 03/21/14 21:11, Pedro Alves wrote: > > > Similarly for the MI test. > > This patch makes the tests handle this scenario. > > Tested with native, and native gdbserver on x86_64 Fedora 17. > > Also tested with the native-gdbserver.exp board hacked with: > > set GDBFLAGS "${GDBFLAGS} -ex \"set remote breakpoint-commands off\"" > > (actually, "set remote breakpoint-commands off" is presently broken, > so this was on top of a fix for that command.) Do you have plan to fix it? > > which results in: > (gdb) PASS: gdb.base/dprintf.exp: 2nd dprintf, gdb > set dprintf-style agent > warning: Target cannot run dprintf commands, falling back to GDB printf > warning: Target cannot run dprintf commands, falling back to GDB printf > (gdb) UNSUPPORTED: gdb.base/dprintf.exp: set dprintf style to agent > > gdb.sum: > (One of the new comments mentions breakpoint always-inserted mode. > Actually testing with breakpoint always-inserted mode fails these > dprintf tests, due to the way they are written. But that'll take a > more substancial rewrite of the tests, so I'm leaving that for another > day.) > I tried "set breakpoint always-inserted on", "set breakpoint always-inserted off" and "set breakpoint always-inserted auto". But I didn't get fail. Do you mind let me take a look on the log? Best, Hui ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-03-25 8:27 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-03-11 14:32 [PATCH] Fix PR breakpoints/16494: gdb.base/dprintf.exp agent-printf failures with non-Z0-supporting gdbservers Hui Zhu 2014-03-21 13:11 ` Pedro Alves 2014-03-23 11:36 ` Hui Zhu 2014-03-24 19:39 ` Fix PR breakpoints/16101: gdb.base/dprintf.exp agent-printf, " Pedro Alves 2014-03-25 8:27 ` Hui Zhu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).