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

Doug Evans
2011-12-04T01:02:24Z

On Sat, Dec 3, 2011 at 10:36 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> 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.
>
>
> On Sat, 29 Oct 2011 21:47:45 +0200, Jan Kratochvil wrote:
>
> On Fri, 28 Oct 2011 20:17:44 +0200, Pedro Alves wrote:
>> 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).
>
> I have tested it and you are right, I had some wrong dejagnu assumptions.
>
> Modifying target_info's use_gdb_stub is probably not much correct, therefore
> there is created global $use_gdb_stub instead.
>
> Global $use_gdb_stub is intentionally unset before gdb_start to cause errors
> trying to interpret the value before.  Some problem is interpreting
> [target_info exists use_gdb_stub] after gdb_start is incorrect but it does not
> cause any sanity-check error.
>
> No regressions on {x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu and with
> gdbserver.
>
>
> Thanks,
> Jan
>
>
> gdb/testsuite/
> 2011-10-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
>        * gdb.base/break-entry.exp: Move the target use_gdb_stub test before
>        starting GDB.
>        * gdb.base/default.exp: Replace target use_gdb_stub checks by global
>        $use_gdb_stub.
>        * gdb.base/display.exp: Likewise.
>        * gdb.base/ending-run.exp: Likewise.
>        * gdb.base/list.exp (test_listsize): Likewise.
>        * gdb.base/setshow.exp: Likewise.
>        * gdb.base/valgrind-db-attach.exp: Set global use_gdb_stub to 1.
>        * lib/gdb.exp (gdb_run_cmd, gdb_start_cmd): Replace target use_gdb_stub
>        check by global $use_gdb_stub.
>        (gdb_test_multiple): Forbid run, start or attach for !$use_gdb_stub.
>        (default_gdb_start): Set global use_gdb_stub from target use_gdb_stub.
>        (default_gdb_init): Unset global $use_gdb_stub.
>        (gdb_continue_to_end, rerun_to_main): Replace target use_gdb_stub check
>        by global $use_gdb_stub.
>        * lib/gdbserver-support.exp: Extend comments for set_board_info
>        gdb_protocol and gdb,socketport, new comment for set_board_info
>        use_gdb_stub.
>        (gdbserver_start_extended): Set global gdbserver_protocol and
>        gdbserver_gdbport.  Clear global use_gdb_stub.
>        * lib/mi-support.exp (default_mi_gdb_start): Set global use_gdb_stub
>        from target use_gdb_stub.
>        (mi_run_cmd): Replace target use_gdb_stub check by global $use_gdb_stub.

I'd like to get away from conflating anything related to gdb stubs and
valgrind / gdbserver.