From patchwork Wed Aug 24 16:50:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Love X-Patchwork-Id: 14916 Received: (qmail 35822 invoked by alias); 24 Aug 2016 16:50:50 -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 35787 invoked by uid 89); 24 Aug 2016 16:50:49 -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, RCVD_IN_DNSWL_LOW, RCVD_IN_SEMBACKSCATTER, SPF_PASS autolearn=ham version=3.3.2 spammy=__powerpc64__, love X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 24 Aug 2016 16:50:48 +0000 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u7OGmRhG065345 for ; Wed, 24 Aug 2016 12:50:46 -0400 Received: from e37.co.us.ibm.com (e37.co.us.ibm.com [32.97.110.158]) by mx0a-001b2d01.pphosted.com with ESMTP id 250pg8wwk2-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 24 Aug 2016 12:50:46 -0400 Received: from localhost by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 24 Aug 2016 10:50:46 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 24 Aug 2016 10:50:44 -0600 X-IBM-Helo: d03dlp03.boulder.ibm.com X-IBM-MailFrom: cel@us.ibm.com Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 53C1B19D8041 for ; Wed, 24 Aug 2016 10:50:16 -0600 (MDT) Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u7OGog9K15204748; Wed, 24 Aug 2016 09:50:43 -0700 Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 17C9D7803F; Wed, 24 Aug 2016 10:50:43 -0600 (MDT) Received: from [9.70.82.29] (unknown [9.70.82.29]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP id C39F778056; Wed, 24 Aug 2016 10:50:42 -0600 (MDT) Subject: [PATCH] Fix for power-pc gdb.server/non-existing-program.exp From: "Carl E. Love" To: Edjunior Barbosa Machado , Ulrich Weigand Cc: gdb-patches@sourceware.org Date: Wed, 24 Aug 2016 09:50:42 -0700 Mime-Version: 1.0 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16082416-0024-0000-0000-000014660848 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005637; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000183; SDB=6.00749104; UDB=6.00353628; IPR=6.00521767; BA=6.00004673; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012447; XFM=3.00000011; UTC=2016-08-24 16:50:45 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16082416-0025-0000-0000-000043D91CF2 Message-Id: <1472057442.4102.61.camel@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-08-24_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608240165 Fix for power-pc gdb.server/non-existing-program.exp The ptrace function reports an error when it is called on a process that has already terminated. This commit fixes the issue by checking in function ppc_arch_setup() and returning without fetching the registers for the inferior. Function ppc_arch_setup() is defined in: gdbserver/linux-ppc-low.c gdbserver/ChangeLog 2016-08-24 Carl Love * gdbserver/linux-ppc-low.c: check if process has exited already. --- gdb/gdbserver/linux-ppc-low.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c index 1d013f1..eedca57 100644 --- a/gdb/gdbserver/linux-ppc-low.c +++ b/gdb/gdbserver/linux-ppc-low.c @@ -620,6 +620,15 @@ ppc_arch_setup (void) #ifdef __powerpc64__ long msr; struct regcache *regcache; + int tid; + + tid = lwpid_of (current_thread); + if (getpgid(tid) <= 0) { + /* process doesn't exist, exit or subsequent call to ptrace will fail + on on-existent process */ + fflush(stdout); + return; + } /* On a 64-bit host, assume 64-bit inferior process with no AltiVec registers. Reset ppc_hwcap to ensure that the