From patchwork Mon Aug 24 15:30:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 8406 Received: (qmail 61234 invoked by alias); 24 Aug 2015 15:30:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 61142 invoked by uid 89); 24 Aug 2015 15:30:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 24 Aug 2015 15:30:31 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id F19918F2E4; Mon, 24 Aug 2015 15:30:29 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7OFUSZY012889; Mon, 24 Aug 2015 11:30:29 -0400 Message-ID: <55DB3894.7000105@redhat.com> Date: Mon, 24 Aug 2015 16:30:28 +0100 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Ulrich Weigand CC: gdb-patches@sourceware.org Subject: Re: [PATCH] gdbserver: don't pick a random thread if the current thread dies References: <20150824145933.1A02B1249E@oc7340732750.ibm.com> In-Reply-To: <20150824145933.1A02B1249E@oc7340732750.ibm.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: Let me take a closer look. Thanks, Pedro Alves 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. */