This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] Fix failure to detach if threads exit while detaching on linux
- From: Antoine Tremblay <antoine dot tremblay at ericsson dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Antoine Tremblay <antoine dot tremblay at ericsson dot com>, <gdb-patches at sourceware dot org>
- Date: Fri, 3 Jun 2016 11:58:59 -0400
- Subject: Re: [PATCH v2] Fix failure to detach if threads exit while detaching on linux
- Authentication-results: sourceware.org; auth=none
- References: <bf6cd7bf-4f1a-b5c6-b396-e5ae42ed9c70 at redhat dot com> <1464965361-25399-1-git-send-email-antoine dot tremblay at ericsson dot com> <f6d86604-6cf9-3ba4-bec7-958b19e82400 at redhat dot com> <wwokshwujnjz dot fsf at ericsson dot com> <49f3eb1e-d03d-e434-a831-e40f18f7823c at redhat dot com>
Pedro Alves writes:
> On 06/03/2016 04:32 PM, Antoine Tremblay wrote:
>>>> >> + #Don't try to exit gdbserver see above comment.
>>>> >> + set gdbserver_reconnect_p 1
>>> >
>>> > I don't understand this one. It shouldn't be needed.
>>> >
>> This one is needed since on the teardown of the .exp test gdb_exit is
>> called and calls monitor_exit which fails with a timeout this avoids
>> this and the original gdb_exit is called.
>
> Then that strikes me as the wrong thing to do. We should instead
> expect that gdbserver exits cleanly, and then clear server_spawn_id.
>
> E.g.:
>
> proc test_server_exit {} {
> global server_spawn_id
> if ![info exists server_spawn_id] {
> return
> }
>
> set test "server exits"
> gdb_expect {
> -i $server_spawn_id
> eof {
> pass $test
> wait -i $server_spawn_id
> unset server_spawn_id
> }
> timeout {
> fail "$test (timeout)"
> }
> }
> }
> }
>
> and then:
>
> -re "Detaching from .*, process $decimal\r\nEnding remote debugging\.\r\n$gdb_prompt $" {
> # This is what you get with "target remote".
> pass $test
> # If testing with gdbserver, make sure it manages to exit.
> test_server_exit
> }
>
Thanks does seems much better !
However, testing it it triggers the test_server_exit timeout case, I'm
guessing because eof already happened and we're waiting for nothing ?
I'm tempted just to unset the var... but ideas are welcome..
Regards,
Antoine