This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/3] Add test for fetching TLS from core file
- From: "Maciej W. Rozycki" <macro at mips dot com>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>
- Cc: Djordje Todorovic <djordje dot todorovic at rt-rk dot com>, Pedro Alves <palves at redhat dot com>, <binutils at sourceware dot org>, <gdb-patches at sourceware dot org>, <asowda at cisco dot com>, <petar dot jovanovic at rt-rk dot com>, <nemanja dot popov at rt-rk dot com>, <nikola dot prica at rt-rk dot com>
- Date: Tue, 24 Oct 2017 00:42:34 +0100
- Subject: Re: [PATCH 3/3] Add test for fetching TLS from core file
- Authentication-results: sourceware.org; auth=none
- References: <cfd1fbbf3af8ec0430da8b91a1a68e98@polymtl.ca>
On Thu, 19 Oct 2017, Simon Marchi wrote:
> > Also `while (1) sleep (10);' perhaps, so that you don't cause a race with
> > the whole process terminating (I think `pthread_join (&threads[0], NULL);'
> > would do too; I'm sure there are other ways as well to prevent from
> > running to exit(2)). Overall please don't assume any particular thread
> > scheduling characteristics of the underlying OS, and especially on SMP
> > systems effects may be sometimes surprising.
>
> Just make sure to avoid an infinite loop, in case the inferior is somehow left
> running after executing the test because of some bug somewhere.
You can't guarantee overall a test program won't hang, loop, etc. due to
a bug somewhere. The issue of lingering processes should IMHO be handled
by assigning software run on the target a new session and then killing the
process group on completion. I believe this is actually done already, as
this is how expect's `spawn' works and I think we also have it handled for
the remote case in the `gdbserver' test harness (but I'd love to get a
confirmation here).
How do you propose anyway, in the absence of an infinite wait/loop, to
ensure that the process does not terminate before the test harness has
done its processing?
Maciej