From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56877 invoked by alias); 24 Aug 2015 14:59:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 56866 invoked by uid 89); 24 Aug 2015 14:59:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_40,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: e06smtp12.uk.ibm.com Received: from e06smtp12.uk.ibm.com (HELO e06smtp12.uk.ibm.com) (195.75.94.108) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Mon, 24 Aug 2015 14:59:40 +0000 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 24 Aug 2015 15:59:34 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 24 Aug 2015 15:59:34 +0100 X-MailFrom: uweigand@de.ibm.com X-RcptTo: gdb-patches@sourceware.org Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id F28811B08061 for ; Mon, 24 Aug 2015 16:01:04 +0100 (BST) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t7OExXrN31129800 for ; Mon, 24 Aug 2015 14:59:33 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t7OExXKn023086 for ; Mon, 24 Aug 2015 08:59:33 -0600 Received: from oc7340732750.ibm.com (dyn-9-152-213-24.boeblingen.de.ibm.com [9.152.213.24]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t7OExXCO023077; Mon, 24 Aug 2015 08:59:33 -0600 Received: by oc7340732750.ibm.com (Postfix, from userid 500) id 1A02B1249E; Mon, 24 Aug 2015 16:59:33 +0200 (CEST) Subject: Re: [PATCH] gdbserver: don't pick a random thread if the current thread dies To: palves@redhat.com (Pedro Alves) Date: Mon, 24 Aug 2015 14:59:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <1438872279-7416-1-git-send-email-palves@redhat.com> from "Pedro Alves" at Aug 06, 2015 03:44:39 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20150824145933.1A02B1249E@oc7340732750.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15082414-0009-0000-0000-0000054CBA41 X-SW-Source: 2015-08/txt/msg00675.txt.bz2 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: Program received signal SIGSEGV, Segmentation fault. 0x10008274 in read_ptid (buf=0x1005045a "0", obuf=0x0) at /home/uweigand/fsf/binutils-gdb/gdb/gdbserver/remote-utils.c:578 578 pid = ptid_get_pid (current_ptid); (gdb) bt #0 0x10008274 in read_ptid (buf=0x1005045a "0", obuf=0x0) at /home/uweigand/fsf/binutils-gdb/gdb/gdbserver/remote-utils.c:578 #1 0x1001045c in process_serial_event (err=, client_data=) at /home/uweigand/fsf/binutils-gdb/gdb/gdbserver/server.c:3864 #2 handle_serial_event (err=, client_data=) at /home/uweigand/fsf/binutils-gdb/gdb/gdbserver/server.c:4206 #3 0x100176c0 in handle_file_event (event_file_desc=) at /home/uweigand/fsf/binutils-gdb/gdb/gdbserver/event-loop.c:429 #4 0x10017e90 in process_event () at /home/uweigand/fsf/binutils-gdb/gdb/gdbserver/event-loop.c:184 #5 start_event_loop () at /home/uweigand/fsf/binutils-gdb/gdb/gdbserver/event-loop.c:547 #6 0x1000ce3c in captured_main (argc=3, argv=0x1) at /home/uweigand/fsf/binutils-gdb/gdb/gdbserver/server.c:3559 #7 0x1000d370 in main (argc=3, argv=0xffbbf994) at /home/uweigand/fsf/binutils-gdb/gdb/gdbserver/server.c:3634 (gdb) list 573 /* No multi-process. Just a tid. */ 574 tid = hex_or_minus_one (p, &pp); 575 576 /* Since the stub is not sending a process id, then default to 577 what's in the current inferior. */ 578 pid = ptid_get_pid (current_ptid); 579 580 if (obuf) 581 *obuf = pp; 582 return ptid_build (pid, tid, 0); 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? Bye, Ulrich -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain Ulrich.Weigand@de.ibm.com