This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Ping: [PATCH] Fix PR breakpoints/16494: gdb.base/dprintf.exp agent-printf failures with non-Z0-supporting gdbservers
- From: Hui Zhu <hui_zhu at mentor dot com>
- To: gdb-patches ml <gdb-patches at sourceware dot org>
- Cc: Pedro Alves <palves at redhat dot com>
- Date: Fri, 21 Mar 2014 16:32:59 +0800
- Subject: Ping: [PATCH] Fix PR breakpoints/16494: gdb.base/dprintf.exp agent-printf failures with non-Z0-supporting gdbservers
- Authentication-results: sourceware.org; auth=none
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