gdb/testsuite
authorYao Qi <yao@codesourcery.com>
Sat, 8 Dec 2012 11:58:01 +0000 (11:58 +0000)
committerYao Qi <yao@codesourcery.com>
Sat, 8 Dec 2012 11:58:01 +0000 (11:58 +0000)
2012-12-08  Yao Qi  <yao@codesourcery.com>
    Pedro Alves  <palves@redhat.com>

* gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Test
'=breakpoint-created' when GDB merges the tracepoints of both
 sides.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp

index 6e3731e4098d0add0355f480c0d2452d751d3179..4994fe18cf0c0c96175657dc795923b8464af3cd 100644 (file)
@@ -1,3 +1,10 @@
+2012-12-08  Yao Qi  <yao@codesourcery.com>
+           Pedro Alves  <palves@redhat.com>
+
+       * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Test
+       '=breakpoint-created' when GDB merges the tracepoints of both
+        sides.
+
 2012-12-07  Tom Tromey  <tromey@redhat.com>
 
        * gdb.base/break1.c (enum some_enum, union some_union): New.
index aa386bb49577f7b6eddc11035be388e90242e3b3..2913b121f999fbf6ab74361e60c4088d9bf93b90 100644 (file)
@@ -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 the
+    # remote stub.
     gdb_test "trace marker" "Tracepoint.*at.* file .*" \
-       "tracepointpoint on marker"
+       "tracepoint on marker"
+    gdb_test "trace main" "Tracepoint.*at.* file .*" \
+       "tracepoint on main"
     gdb_test_no_output "tstart" "start trace experiment"
 
     set test "disconnect"
@@ -102,18 +106,46 @@ 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 the remote stub again, and make sure GDB merges the
+    # tracepoints of both sides correctly.
     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 in GDB, which has already existed before
+           # connecting, should have been merged with a tracepoint on
+           # the target, so we shouldn't see a =breakpoint-created
+           # notification for it.
+           fail "$test: 1"
+           exp_continue
+       }
+       -re "=breakpoint-created,bkpt=\{number=\"2\",type=\"tracepoint\"" {
+           # Similar to above.
+           fail "$test: 2"
+           exp_continue
+       }
+       -re "=breakpoint-created,bkpt=\{number=\"3\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"main\".*${mi_gdb_prompt}" {
+           # A tracepoint on main was defined in the stub, not in GDB,
+           # so we should see a =breakpoint-created notification.
            pass $test
        }
        timeout {
            fail $test
        }
     }
+    # Check that tracepoint 1 is still pending.
+    mi_gdb_test "-break-info 1" \
+       {.*\^done,BreakpointTable=.*addr=\"<PENDING>\".*} \
+       "break-info 1"
 
     set gdbserver_reconnect_p 0
 }}