From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14105 invoked by alias); 27 Sep 2009 20:57:07 -0000 Received: (qmail 14097 invoked by uid 22791); 27 Sep 2009 20:57:07 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mtagate3.de.ibm.com (HELO mtagate3.de.ibm.com) (195.212.17.163) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 27 Sep 2009 20:57:03 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate3.de.ibm.com (8.13.1/8.13.1) with ESMTP id n8RKv0S6028290 for ; Sun, 27 Sep 2009 20:57:00 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n8RKv0lw3362902 for ; Sun, 27 Sep 2009 22:57:00 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n8RKv0sH011928 for ; Sun, 27 Sep 2009 22:57:00 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id n8RKuxMM011923 for ; Sun, 27 Sep 2009 22:56:59 +0200 Message-Id: <200909272056.n8RKuxMM011923@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Sun, 27 Sep 2009 22:56:59 +0200 Subject: [commit, gdbserver] Fix SPU gdbserver regression To: gdb-patches@sourceware.org Date: Sun, 27 Sep 2009 20:57:00 -0000 From: "Ulrich Weigand" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2009-09/txt/msg00851.txt.bz2 Hello, several gdbserver test cases were failing on spu-elf. This turned out to be caused by the multi-process gdbserver changes. In particular, gdbserver now always keeps a list a threads, even for a single-threaded inferior. spu-low.c fails to clear this thread list in the spu_kill and spu_detach routines, causing GDB to report that the inferior was still running even when killed. While debugging this, I noticed that gdbserver leaves the inferior as zombie after spu_kill, because it never waits on it. The patch below fixes this issue as well. Tested on spu-elf, fixes all gdbserver test case failures. Committed to mainline. Bye, Ulrich ChangeLog: * spu-low.c (spu_kill): Wait for inferior to terminate. Call clear_inferiors. (spu_detach): Call clear_inferiors. Index: gdb/gdbserver/spu-low.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/spu-low.c,v retrieving revision 1.25 diff -c -p -r1.25 spu-low.c *** gdb/gdbserver/spu-low.c 22 Jun 2009 19:33:41 -0000 1.25 --- gdb/gdbserver/spu-low.c 25 Sep 2009 14:43:07 -0000 *************** spu_attach (unsigned long pid) *** 321,331 **** --- 321,340 ---- static int spu_kill (int pid) { + int status, ret; struct process_info *process = find_process_pid (pid); if (process == NULL) return -1; ptrace (PTRACE_KILL, pid, 0, 0); + + do { + ret = waitpid (pid, &status, 0); + if (WIFEXITED (status) || WIFSIGNALED (status)) + break; + } while (ret != -1 || errno != ECHILD); + + clear_inferiors (); remove_process (process); return 0; } *************** spu_detach (int pid) *** 339,344 **** --- 348,355 ---- return -1; ptrace (PTRACE_DETACH, pid, 0, 0); + + clear_inferiors (); remove_process (process); return 0; } -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com