Re: ping: Re: [patch] Forbid "run" etc. for use_gdb_stub targets

Pedro Alves
2011-12-03T19:15:17Z

On Saturday 03 December 2011 18:36:13, Jan Kratochvil wrote:
> I am a bit reluctant to check it on my own as I already made there some
> mistakes before. I see there is more work going on with this code.

Sorry, and thanks. I completely forgot about this until I saw Doug's patch.

> --- a/gdb/testsuite/gdb.base/valgrind-db-attach.exp
> +++ b/gdb/testsuite/gdb.base/valgrind-db-attach.exp
> @@ -41,6 +41,9 @@ pass $test
> # Declare GDB now as running.
> set gdb_spawn_id -1
>
> +# This value applies to GDB spawned by valgrind --db-attach=yes.
> +set use_gdb_stub 1

Why?

> --- a/gdb/testsuite/lib/gdbserver-support.exp
> +++ b/gdb/testsuite/lib/gdbserver-support.exp
> @@ -22,6 +22,14 @@
> #
> # set_board_info gdb_protocol "remote"
> # Unles you have a gdbserver that uses a different protocol...
> +# After GDB starts you should check global $gdbserver_protocol instead as
> +# the testfile may force a specific different target protocol itself.
> +#
> +# set_board_info use_gdb_stub
> +# Flag the inferior is already started after connecting and run/attach
> +# are not supported. This is used for the "remote" protocol.
> +# After GDB starts you should check global $use_gdb_stub instead as the
> +# testfile may force a specific different target protocol itself.

This is the wrong place to document this. use_gdb_stub is not
really gdbserver-specific. Please document it in the common
framework, somewhere in gdb.exp?

> # Start and connect to a gdbserver in extended mode.
> proc gdbserver_start_extended { } {
> + global gdbserver_protocol
> + global gdbserver_gdbport
> + global use_gdb_stub
> +
> set res [gdbserver_start "--multi" ""]
> set gdbserver_protocol "extended-[lindex $res 0]"
> set gdbserver_gdbport [lindex $res 1]
>
> + # For both native mode and for stub-using gdbserver target board we run
> + # a new gdbserver in extended-remote mode, therefore without stub.
> + set use_gdb_stub 0

I suggest instead:

# Even if the board file is testing with target remote, our caller
# wants to test against gdbserver in extended-remote mode. Make sure to
# disable stub-like techniques.

> +
> return [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
> }

Otherwise looks good to me.

--
Pedro Alves