public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [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

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).