This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 3/4] Test dprintf breakpoint works correctly with other breakpoints


gdb/testsuite:

2013-02-28  Yao Qi  <yao@codesourcery.com>

	* gdb.base/dprintf.exp: Test dprintf breakpoints works correctly
	with other breakpoints setting on the same address.
---
 gdb/testsuite/gdb.base/dprintf.exp |   49 ++++++++++++++++++++++++++++++-----
 1 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/gdb.base/dprintf.exp b/gdb/testsuite/gdb.base/dprintf.exp
index ffbd3f2..22c740a 100644
--- a/gdb/testsuite/gdb.base/dprintf.exp
+++ b/gdb/testsuite/gdb.base/dprintf.exp
@@ -40,8 +40,11 @@ gdb_breakpoint "main"
 gdb_test "dprintf foo,\"At foo entry\\n\"" \
   "Dprintf .*"
 
+# Set two dprintf breakpoints at the same location.
 gdb_test "dprintf $dp_location1,\"arg=%d, g=%d\\n\", arg, g" \
-  "Dprintf .*"
+    "Dprintf .*"
+gdb_test "dprintf $dp_location1,\"g=%d, arg=%d\\n\", g, arg" \
+    "Dprintf .*"
 
 gdb_test_sequence "info breakpoints" "dprintf info 1" {
     "\[\r\n\]Num     Type           Disp Enb Address +What"
@@ -50,6 +53,8 @@ gdb_test_sequence "info breakpoints" "dprintf info 1" {
     "\[\r\n\]        printf \"At foo entry\\\\n\""
     "\[\r\n\]4       dprintf"
     "\[\r\n\]        printf \"arg=%d, g=%d\\\\n\", arg, g"
+    "\[\r\n\]5       dprintf"
+    "\[\r\n\]        printf \"g=%d, arg=%d\\\\n\", g, arg"
 }
 
 gdb_test "break $bp_location1" \
@@ -76,22 +81,52 @@ if ![target_info exists gdb,noinferiorio] {
 
     gdb_test "" "Breakpoint"
 
-    gdb_test "continue" "At foo entry.*arg=1234, g=1234.*" "1st dprintf, call"
+    # Test two dprintf breakpoints on the same location are executed.
+    gdb_test "continue" \
+	"At foo entry.*arg=1234, g=1234\\r\\n.*g=1234, arg=1234\\r\\n.*" \
+	"1st dprintf, call"
 
-    gdb_test "continue" "At foo entry.*arg=1235, g=2222.*" "2nd dprintf, call"
+    gdb_test "continue" \
+	"At foo entry.*arg=1235, g=2222\\r\\n.*g=2222, arg=1235\\r\\n.*" \
+	"2nd dprintf, call"
 
     gdb_test_no_output "set dprintf-function fprintf" "Set dprintf function"
     gdb_test_no_output "set dprintf-channel stderr" "Set dprintf channel"
 
+    # Set breakpoint on foo, and test dprintf set at the same address
+    # behaves correctly.
+    gdb_test "break foo" "Note: breakpoint ${decimal} also set at pc ${hex}.*"
+    gdb_test_no_output "set \$foo_breakpoint_number = \$bpnum"
+    # Hit the breakpoint on foo, and the command of dprintf
+    # breakpoint on foo is executed as well.
+    gdb_test "continue" \
+	"Continuing\.\\r\\nAt foo entry\\r.*Breakpoint .*" \
+	"continue"
+    gdb_test "delete \$foo_breakpoint_number"
+
     gdb_run_cmd
 
     gdb_test "" "Breakpoint"
 
-    gdb_test "continue" "At foo entry.*arg=1234, g=1234.*" \
+    gdb_test "continue" \
+	"At foo entry.*arg=1234, g=1234\\r\\n.*g=1234, arg=1234\\r\\n.*" \
 	"1st dprintf, fprintf"
 
-    gdb_test "continue" "At foo entry.*arg=1235, g=2222.*" \
+    gdb_test "continue" \
+	"At foo entry.*arg=1235, g=2222\\r\\n.*g=2222, arg=1235\\r\\n.*" \
 	"2nd dprintf, fprintf"
+
+    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 1 time"
+	"\[\r\n\]3       dprintf"
+	"\[\r\n\]\tbreakpoint already hit 2 times"
+	"\[\r\n\]        call \\(void\\\) fprintf \\(stderr,\"At foo entry\\\\n\"\\)"
+	"\[\r\n\]4       dprintf"
+	"\[\r\n\]\tbreakpoint already hit 2 times"
+	"\[\r\n\]        call \\(void\\) fprintf \\(stderr,\"arg=%d, g=%d\\\\n\", arg, g\\)"
+    }
 }
 
 set target_can_dprintf 1
@@ -116,8 +151,8 @@ 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"
+    gdb_test_sequence "info breakpoints" "dprintf info 3" {
+	"\[\r\n\]Num     Type           Disp Enb Address +What"
 	"\[\r\n\]2       breakpoint"
 	"\[\r\n\]\tbreakpoint already hit 2 times"
 	"\[\r\n\]3       dprintf"
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]