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] Test on =breakpoint-created when reconnect


Hi,
When working on notification on tracepoint downloaded/installed, I
find the test 'test_reconnect' in too simple.  It only test the
situation that "GDB has no tracepoint, and connects to remote stub
which has one tracepoint".  However, when GDB connects to remote stub,
and do tracepoint merging, the complicated situation is "GDB has
tracepoints A and B, while remote stub has tracepoints A and C.
Finally, we have A, B, and C.".  This is what patched 'test_reconnect'
does.

gdb/testsuite:

2012-12-03  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Test
	'=breakpoint-created' when getting tracepoints on two sides
	 in sync.
---
 gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp |   31 ++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
index aa386bb..9891c06 100644
--- a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
@@ -68,8 +68,12 @@ proc test_reconnect { } { with_test_prefix "reconnect" {
 	fail "Can't run to main"
 	return 0
     }
+    # Create tracepoints on marker and main, and leave them in remote
+    # stub.
     gdb_test "trace marker" "Tracepoint.*at.* file .*" \
 	"tracepointpoint on marker"
+    gdb_test "trace main" "Tracepoint.*at.* file .*" \
+	"tracepointpoint on main"
     gdb_test_no_output "tstart" "start trace experiment"
 
     set test "disconnect"
@@ -102,18 +106,43 @@ proc test_reconnect { } { with_test_prefix "reconnect" {
     global gdbserver_protocol
     global gdbserver_gdbport
 
+    # Create tracepoints on marker and pendfunc2.
+    mi_gdb_test "-break-insert -a -f pendfunc2" \
+	{.*\^done,bkpt=.*addr=\"<PENDING>\".*} \
+	"insert tracepoint on pendfunc2"
+    mi_gdb_test "-break-insert -a marker" {.*\^done,bkpt=.*\".*} \
+	"insert tracepoint on marker"
+
+    # Connect to remote stub again, and get tracepoints on two sides
+    # in sync.
     send_gdb "47-target-select $gdbserver_protocol $gdbserver_gdbport\n"
 
     global mi_gdb_prompt
     set test "tracepoint created"
     gdb_expect {
-	-re "=breakpoint-created,bkpt=\{number=\"1\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"marker\".*${mi_gdb_prompt}" {
+	-re ".*=breakpoint-created,bkpt=\{number=\"1\",type=\"tracepoint\"" {
+	    # Tracepoint 1 was created, so no notification on it.
+	    fail "$test: 1"
+	    exp_continue
+	}
+	-re ".*=breakpoint-created,bkpt=\{number=\"2\",type=\"tracepoint\"" {
+	    # Tracepoint 2 was created, so no notification on it.
+	    fail "$test: 2"
+	    exp_continue
+	}
+	-re ".*=breakpoint-created,bkpt=\{number=\"3\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"main\".*${mi_gdb_prompt}" {
+	    # Tracepoint on main is created because it is not defined
+	    # before and it is from remote stub.
 	    pass $test
 	}
 	timeout {
 	    fail $test
 	}
     }
+    # Check tracepoint 1 is still pending.
+    mi_gdb_test "-break-info 1" \
+	{.*\^done,BreakpointTable=.*addr=\"<PENDING>\".*} \
+	"break-info 1"
 
     set gdbserver_reconnect_p 0
 }}
-- 
1.7.7.6


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