Re: [patch] Forbid "run" etc. for use_gdb_stub targets [Re: [patch] gdb.python/py-events.exp: Disable multi-inferior for gdbserver]

Pedro Alves
2011-10-28T18:18:08Z

On Friday 28 October 2011 18:40:14, Jan Kratochvil wrote:
> On Thu, 27 Oct 2011 20:09:36 +0200, Pedro Alves wrote:
> > Not sure what you mean. Is is that use_gdb_stub will be wrong?
> > Maybe we can override it?
>
> Done overriding both ways, to have use_gdb_stub always right.
>
> Do you agree with it this way?

Yes, but see below.

> It was a leftover, thanks; anyway dropped this conditional now when
> use_gdb_stub should be always correct now.

Ah, much better.

> +
> # TCL/EXPECT WART ALERT
> # Expect does something very strange when it receives a single braced
> # argument. It splits it along word separators and performs substitutions.
> --- a/gdb/testsuite/lib/gdbserver-support.exp
> +++ b/gdb/testsuite/lib/gdbserver-support.exp
> @@ -206,6 +206,7 @@ proc gdbserver_start { options arguments } {
> if [target_info exists gdb_protocol] {
> set protocol [target_info gdb_protocol]
> } else {
> + set_currtarget_info use_gdb_stub 1
> set protocol "remote"
> }

Isn't this too late though? We do the [target_info exists use_gdb_stub]
check at the top of the test files, before gdbserver_start has had a chance
of running. So I'm guessing that in the first test that runs right
after the gdb.server/ tests complete, use_gdb_stub will be wrong at the top of
the test, but it'll get fixed by that test, so the following ones are right.
If that test file happen to have a use_gdb_stub check, it'll lose.
We may need to do this closer to gdb_init/default_gdb_init (or an override).

>
> @@ -337,9 +338,13 @@ proc gdbserver_reconnect { } {
>
> # Start and connect to a gdbserver in extended mode.
> proc gdbserver_start_extended { } {
> + global gdbserver_protocol
> + global gdbserver_gdbport
> +
> set res [gdbserver_start "--multi" ""]
> set gdbserver_protocol "extended-[lindex $res 0]"
> set gdbserver_gdbport [lindex $res 1]
> + unset_currtarget_info use_gdb_stub
>
> return [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
> }
>

--
Pedro Alves