This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdbserver: don't pick a random thread if the current thread dies
- From: Pedro Alves <palves at redhat dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 24 Aug 2015 16:30:28 +0100
- Subject: Re: [PATCH] gdbserver: don't pick a random thread if the current thread dies
- Authentication-results: sourceware.org; auth=none
- References: <20150824145933 dot 1A02B1249E at oc7340732750 dot ibm dot com>
On 08/24/2015 03:59 PM, Ulrich Weigand wrote:
> Pedro Alves wrote:
>
>> * spu-low.c (spu_resume, spu_request_interrupt): Use the first
>> thread's lwp instead of the current thread's.
>
>> static void
>> spu_request_interrupt (void)
>> {
>> - syscall (SYS_tkill, ptid_get_lwp (current_ptid), SIGINT);
>> + struct thread_info *thr = get_first_thread ();
>> +
>> + syscall (SYS_tkill, ptid_get_lwp (thr), SIGINT);
>> }
>
> This doesn't compile due to:
>
> gdbserver/spu-low.c: In function 'spu_request_interrupt':
> gdbserver/spu-low.c:639: error: incompatible type for argument 1 of 'ptid_get_lwp'
>
> When adding the obvious fix ("ptid_of (thr)"), it does compile, but now
> gdbserver crashes as soon as GDB attaches to it:
I guess lwpid_of would be a little better even.
> Looks like current_thread is NULL at this point. Since this is generic
> code, I'm not quite sure if this is a SPU-specific problem or not ...
>
> Do you think this is related to your change?
Sounds likely. I can trigger the same on GNU/Linux if I force-disable
the multi-process extensions:
diff --git c/gdb/gdbserver/linux-low.c w/gdb/gdbserver/linux-low.c
index 2bc91c2..44c0feb 100644
--- c/gdb/gdbserver/linux-low.c
+++ w/gdb/gdbserver/linux-low.c
@@ -5785,7 +5785,7 @@ linux_start_non_stop (int nonstop)
static int
linux_supports_multi_process (void)
{
- return 1;
+ return 0;
}
/* Check if fork events are supported. */
Let me take a closer look.
Thanks,
Pedro Alves