This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] 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>, gdb-patches at sourceware dot org
- Date: Fri, 3 Jun 2016 12:43:35 +0100
- Subject: Re: [PATCH] Fix failure to detach if threads exit while detaching on linux
- Authentication-results: sourceware.org; auth=none
- References: <1464876960-23372-1-git-send-email-antoine dot tremblay at ericsson dot com>
On 06/02/2016 03:16 PM, Antoine Tremblay wrote:
> gdb/ChangeLog:
>
> * inf-ptrace.c: include nat/linux-procfs.h.
> (inf_ptrace_detach): Report an error only if the thread is not gone.
Can't do this. inf-ptrace.c is a shared file used by non-Linux ports too.
> * gdb.threads/detach-gone-thread.c: New file.
> * gdb.threads/detach-gone-thread.ex: New test.
Typo: ".ex". Say "New file" for that one too.
> + _exit(0);
Space before parenthesis.
> +{
> + pthread_t threads[256];
> + int res;
> + int i;
> +
> + pthread_barrier_init (&barrier, NULL, 257);
> +
> + for (i = 0; i < 256; i++)
Please add:
#define NTHREADS 256
and thus write:
pthread_t threads[NTHREADS];
int res;
int i;
pthread_barrier_init (&barrier, NULL, NTHREADS + 1);
for (i = 0; i < NTHREADS; i++)
> +
> +if $use_gdb_stub {
Do this at the top, and call the new use_gdb_stub procedure instead:
if [use_gdb_stub] {
> + # This test is about testing detaching from a process,
> + # so it doesn't make sense to run it if the target is stub-like.
> + unsupported "This test is not supported for GDB stub targets."
But in any case, I'm not so sure about this. Stub targets can
detach too. What problem did you find that needed this?
Thanks,
Pedro Alves