From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id E6E2D389F032 for ; Tue, 15 Nov 2022 17:24:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E6E2D389F032 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=us.ibm.com Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AFGl0xJ031669; Tue, 15 Nov 2022 17:24:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=OlzIuDdwf/Nj33RuLoQSiYW8sJhkxYuJqL54ngfgwkY=; b=DdEUA8OFQNPKNghpcRFJ0UluANsc+i2rGEMILz4xu48bQucCxHHYE7uuqTs00B4T8ot8 hSrih+rH+Kw0jr5jNFRxPr2iLsKJtt8rRQpGZTGemgp7rtK2QQBICsBt/iBrEojUu9py 7yH869GNNad3XBf9OmOhhIZVTJpiQUuyICGdoEwbkc8eybw91E4pSGeBlxlnygir2fQB RCl1x9ol7sFI27rX71ljuC+VhLCjzYYXKWhomjxfEXNBpmrRXF8FYhCXAzbnpuKrjPXs Kw8Ndq6IDpv0lOo7YdP+FjW43IZUzZWDA6CMVxNenxk504/WpcIKjPXgSymvNEHxX8dz Pw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kvekggunm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Nov 2022 17:24:37 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2AFHGPpN030473; Tue, 15 Nov 2022 17:24:37 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kvekggune-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Nov 2022 17:24:37 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2AFHKVH2004695; Tue, 15 Nov 2022 17:24:36 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma01dal.us.ibm.com with ESMTP id 3kt349k0dc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Nov 2022 17:24:36 +0000 Received: from smtpav06.dal12v.mail.ibm.com ([9.208.128.130]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2AFHOXWV1966712 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Nov 2022 17:24:33 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D4FAA58061; Tue, 15 Nov 2022 17:24:34 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 524E058059; Tue, 15 Nov 2022 17:24:34 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.163.52.7]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Tue, 15 Nov 2022 17:24:34 +0000 (GMT) Message-ID: <2466b7efc91dd4964add9a0d7ce4cd47678f5800.camel@us.ibm.com> Subject: Re: [PATCH 2/2 ver 3] PowerPC, fix support for printing the function return value for non-trivial values. From: Carl Love To: Ulrich Weigand , "gdb-patches@sourceware.org" , "tdevries@suse.de" Cc: "kevinb@redhat.com" , "will_schmidt@vnet.ibm.com" , "blarsen@redhat.com" , cel@us.ibm.com Date: Tue, 15 Nov 2022 09:24:33 -0800 In-Reply-To: <6ed2cf1714e5b8dc386e66b634b540efdf828ed5.camel@de.ibm.com> References: <2db5ad69b32f4cda9c53b252ad37cd783f827c14.camel@de.ibm.com> <7f476265-c6a9-9fcf-ce13-ff550ea5e6f6@suse.de> <6ed2cf1714e5b8dc386e66b634b540efdf828ed5.camel@de.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Ql2GxiXPVuR1Pl5-HGCZKHYv1bYEH663 X-Proofpoint-ORIG-GUID: WL7L9iKWIChmHVHrpvA6P7xVVJZkyTyz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-15_08,2022-11-15_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 priorityscore=1501 mlxscore=0 clxscore=1015 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211150115 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tom, Ulrich: On Tue, 2022-11-15 at 10:16 +0000, Ulrich Weigand wrote: > Tom de Vries wrote: > > On 11/14/22 17:47, Ulrich Weigand via Gdb-patches wrote: > > > I believe all of Kevin's and Bruno's comments have been addressed > > > in this version. I've reviewed it myself as well, and it looks > > > good to me. > > > This is OK. > > On x86_64-linux, I run into a segfault: > > [...] > > (gdb) up > > #1 0x0000000000852d94 in finish_command (arg=0x0, from_tty=0) > > at /home/vries/gdb_versions/devel/src/gdb/infcmd.c:1887 > > 1887 = check_typedef (sm->function->type ()->target_type > > ()); > > (gdb) p sm->function > > $1 = (symbol *) 0x0 > > Ah, I missed that possibility, sorry. > > Carl, if sm->function is NULL, then the whole check needs > to be skipped, and sm->return_buf should be set to 0. > > Can you come up with a fix along those lines (or else, > just revert the patch for now)? Thanks! > I tested the last mainline code with the command on an X86-64 box. make check RUNTESTFLAGS='GDB=/home/carll/bin/gdb gdb.asm/asm-source.exp ' Which generated an error. I then ran the command, from Tom's email: gdb -q -batch -x outputs/gdb.asm/asm-source/gdb.in.1 from directory gdb/testsuite which generated a segmentation fault as expected. Once I applied the following patch, recompiled and retested, the make check seemed to run fine and the gdb -q batch test ran without generating a segmentation fault. The patch appears to fix the issue. Not sure why this didn't show up in my original X86 testing? I will go back and look some more to see if I can track down why I didn't see the issue. Sorry for the bug. Tom, can you take a look at the patch and try it out to make sure it fixes the issues on your system. Thanks. Carl Love ---------------------------------------------------------------- Bug fix in commit for printing the function return value for non-trivial values The recent commit: commit a0eda3df5b750ae32576a9be092b361281a41787 Author: Carl Love Date: Mon Nov 14 16:22:37 2022 -0500 PowerPC, fix support for printing the function return value for non-trivial values. Is generating a segmentation fault on x86_64-linux. segfault: ... PASS: gdb.asm/asm-source.exp: info source asmsrc1.s ERROR: GDB process no longer exists UNRESOLVED: gdb.asm/asm-source.exp: finish from foo3 ... Reproduced on command line: ... $ gdb -q -batch -x outputs/gdb.asm/asm-source/gdb.in.1 ... The problem seems to be that: ... Thread 1 "gdb" received signal SIGSEGV, Segmentation fault. 0x000000000043de7a in symbol::type (this=0x0) at .../gdb_versions/devel/src/gdb/symtab.h:1287 1287 return m_type; ... because: ... (gdb) up #1 0x0000000000852d94 in finish_command (arg=0x0, from_tty=0) at .../gdb_versions/devel/src/gdb/infcmd.c:1887 1887 = check_typedef (sm->function->type ()->target_type ()); (gdb) p sm->function $1 = (symbol *) 0x0 The code is not checking if sm->function is NULL. If sm->function is NULL the check for the return buffer should be skipped. --- gdb/infcmd.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/gdb/infcmd.c b/gdb/infcmd.c index b71dc10370b..2876f6d9c9d 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1880,23 +1880,28 @@ finish_command (const char *arg, int from_tty) /* Determine the return convention. If it is RETURN_VALUE_STRUCT_CONVENTION, attempt to determine the address of the return buffer. */ - enum return_value_convention return_value; - struct gdbarch *gdbarch = get_frame_arch (callee_frame); + if (sm->function != NULL) + { + enum return_value_convention return_value; + struct gdbarch *gdbarch = get_frame_arch (callee_frame); - struct type * val_type - = check_typedef (sm->function->type ()->target_type ()); + struct type * val_type + = check_typedef (sm->function->type ()->target_type ()); - return_value = gdbarch_return_value (gdbarch, - read_var_value (sm->function, NULL, - callee_frame), - val_type, NULL, NULL, NULL); + return_value = gdbarch_return_value (gdbarch, + read_var_value (sm->function, NULL, + callee_frame), + val_type, NULL, NULL, NULL); - if (return_value == RETURN_VALUE_STRUCT_CONVENTION - && val_type->code () != TYPE_CODE_VOID) - sm->return_buf = gdbarch_get_return_buf_addr (gdbarch, val_type, - callee_frame); + if (return_value == RETURN_VALUE_STRUCT_CONVENTION + && val_type->code () != TYPE_CODE_VOID) + sm->return_buf = gdbarch_get_return_buf_addr (gdbarch, val_type, + callee_frame); + else + sm->return_buf = 0; + } else - sm->return_buf = 0; + sm->return_buf = 0; /* Return buffer address is not available. */ /* Print info on the selected frame, including level number but not source. */ -- 2.31.1