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: Pedro Alves <palves at redhat dot com>
- To: Antoine Tremblay <antoine dot tremblay at ericsson dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 3 Jun 2016 16:45:25 +0100
- 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>
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,
Pedro Alves