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]

Re: [PATCH] Test on =breakpoint-created when reconnect


On 12/03/2012 10:25 AM, Yao Qi wrote:
> 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.

Excellent.  Thanks for doing this.

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

"in the remote stub"

>      gdb_test "trace marker" "Tracepoint.*at.* file .*" \
>  	"tracepointpoint on marker"
> +    gdb_test "trace main" "Tracepoint.*at.* file .*" \
> +	"tracepointpoint on main"

"tracepointpoint" ??  :-)

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

    # Connect to the remote stub again, and make sure GDB merges the
    # tracepoints off 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\"" {

The initial ".*" shouldn't be necessary.

> +	    # Tracepoint 1 was created, so no notification on it.

I don't understand this comment.  By "was created", did you mean that the
tracepoint already existed in gdb before connecting?  I suggest this then:

	    # Tracepoint 1 in GDB 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\"" {
> +	    # Tracepoint 2 was created, so no notification on it.

Likewise.

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

	    # A tracepoint on main was defined in the stub, but not in GDB, so we
            # should see a notification.

>  	    pass $test
>  	}
>  	timeout {
>  	    fail $test
>  	}
>      }
> +    # Check tracepoint 1 is still pending.

"Check that"

> +    mi_gdb_test "-break-info 1" \
> +	{.*\^done,BreakpointTable=.*addr=\"<PENDING>\".*} \
> +	"break-info 1"
>  
>      set gdbserver_reconnect_p 0
>  }}
> 

-- 
Pedro Alves


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