From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id TdY6B9BGPWTsdi4AWB0awg (envelope-from ) for ; Mon, 17 Apr 2023 09:17:04 -0400 Received: by simark.ca (Postfix, from userid 112) id 116551E221; Mon, 17 Apr 2023 09:17:04 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Q1zmgTPa; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id CCA551E0D3 for ; Mon, 17 Apr 2023 09:17:02 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9F82F3855592 for ; Mon, 17 Apr 2023 13:16:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F82F3855592 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681737419; bh=2rFpoRNg14gh40WxSSKF4CM8d3XKJ1oeq9GVd5ZD6VY=; h=To:CC:Date:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Q1zmgTPat+iAakPhCI0H/Scxl3Xl9nEYlheWIuN06Vu+JmNopQO0/T+0fallgMIOr heIGbAPQ8eGo1iCAelxSBAqrvDMlZPJ8jeux4A5pa22y0sl3j5g4ZDACe/cnCTcOSd OAlwTI3TNxoWGvuXHubc5b2nNUdKEW1PqIZk513U= Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 27B5538560B7 for ; Mon, 17 Apr 2023 13:16:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 27B5538560B7 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33HCqiWi006658; Mon, 17 Apr 2023 13:16:28 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3q12vkev97-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Apr 2023 13:16:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L/gRHwN3M72/44bPR7A6os3Uy6rTsyS9xJSvGJpvSCKzZEOI+68WHdytzsGd8XV6DUPOEkC+0Xq/zdHswi1/EzWVrBefSifP2O1eruBkGvvLdgqwv6jtkfRy4Y7pGe9QCVR9cupyKSV4xmJx5VB/yr6y3RpkyNbfunIQ3nYj2UPhthzSIUaKvnluEEYyK6xp7NUI2rGXmatAerJ8iKG3owlSGgqih5kAj3udtigepKdMWWY+u+M+caP9gzpTyndUC/pO1CUcCaQdxqhUICdx7G4tGx5bWQOfyoJDtTb3tiYofzIPkUeKWTvWs5eZtlzZ8VkTVklHdl4hkk5eQgZYLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2zkmAIIlloKOEkfNTtit8gUzJPY+GfG43vAZwrKcWKw=; b=i8AyzV2r1Rnn2tLgSRFiG73b5eQ9V0LnVvK3igXYyByMJ6aPAgeKK28bYEQJxr9OTWfZ1an9DA6474IrSutaO09effpMyj++VHpaQOJiKgfHjIgk7oRLhFcYUeRWzx/kTRu3Bw4fQ5t1R4k3L1bmSkV2/jUutt57KIC4o8W63rn21wIbmcnxvAp0d3KXFS+LcaAqaoBwTyz8upshhkckFMNzN2P0hK5Ml0fScK8KeIl0s+YQKDMBqChbeS4KJEKgaRziGo2+zdWF4cLxlhYzH0/HproIfEgm77AQd2nRfHQHyU8wRGmtBBVb9xUueN7jEOUcYi+5lDjScvqAtJdZqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ibm.com; dmarc=pass action=none header.from=ibm.com; dkim=pass header.d=ibm.com; arc=none Received: from CH2PR15MB3544.namprd15.prod.outlook.com (2603:10b6:610:5::26) by SJ2PR15MB5804.namprd15.prod.outlook.com (2603:10b6:a03:4fa::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Mon, 17 Apr 2023 13:16:24 +0000 Received: from CH2PR15MB3544.namprd15.prod.outlook.com ([fe80::fc4b:b8cb:1472:d50a]) by CH2PR15MB3544.namprd15.prod.outlook.com ([fe80::fc4b:b8cb:1472:d50a%6]) with mapi id 15.20.6298.045; Mon, 17 Apr 2023 13:16:23 +0000 To: Tom Tromey , Aditya Kamath1 via Gdb-patches CC: Tom Tromey , Ulrich Weigand , Sangamesh Mallayya , "simon.marchi@efficios.com" Thread-Topic: [EXTERNAL] Re: [PATCH] Fix call functions command bug in 64-bit programs for AIX and PC read in psymtab-symtab warning Thread-Index: AQHZbqQQBfkl018eIkqZzSgzxcljOa8q4lytgASUKjWAAAgiRg== Date: Mon, 17 Apr 2023 13:16:23 +0000 Message-ID: References: <049a54779f7280ddef6c2da12d0714023514dc9b.camel@de.ibm.com> <881bbbcc3646f5df9c2f334133907d3ca37149a6.camel@de.ibm.com> <48b9cc7b5cb4981f03fd459c4365242a11546c1e.camel@de.ibm.com> <87r0xsb4np.fsf@tromey.com> <87sfd24j4w.fsf@tromey.com> In-Reply-To: Accept-Language: en-IN, en-US Content-Language: en-IN X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CH2PR15MB3544:EE_|SJ2PR15MB5804:EE_ x-ms-office365-filtering-correlation-id: c12c9960-12f1-4d00-9614-08db3f45f108 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: JJqwZMoI0gLxUECh2irPxR1Zs3gdH6I5Yg1WUEPAuazl0918QftfdtVWCykdZc8bqgvydPx47YCTtKbw3CZyW7trHCBmH39JEI6/BDvDqM9HtdKGZv5SdNju1Cb1Shk0hzdTqNxlfk0ZEoQFg4QSdphv0XQUXGJcMRsitz/VZi7Fw+VfMIM1JqD67c2N1GVEOd4d4LTNSXYy1ILm9T+YQgqu3p7Be0Yq9hLYP/VYGFCaQC+ZOn2zr3Bjllx2b6xnCAhD8DYu4KlyD2/zJdnWYGliQA26h8SH/h/pJTsq61lDDLF/W8QusC7FekTVWTtc2/Ngvm206gv+fxBF7yLcXUDjLkgCYzdF+ARsw32Gpea4WyaifXwQksFPzNv9maQlp+lX58tTlmmfYwaDIIkU8XoU5tYwZlyN0cI57KTa+9zlkwPZboZ0NnFVsGV3PEDlzcSFtT5BWh5AOtEUJebxapw/YdhHGmK3W5kXjeXvZzLV9EHpCdsDLgGIc31NH04egglEt6Kw3Mcx1KmEyABayHle2NZhEvCYf5Kw6tQEe8Co6H7LXsCsmd7wTiVjvN3BQ8zY/T19CG2AXOelfs0XHrimk5IK6JT+O4ombvSyKy959PEcbxbjovpmFFN0H4hj x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR15MB3544.namprd15.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(346002)(376002)(396003)(136003)(39860400002)(451199021)(9686003)(53546011)(6506007)(122000001)(2940100002)(41300700001)(186003)(316002)(110136005)(33656002)(7696005)(478600001)(71200400001)(54906003)(966005)(66946007)(66556008)(66476007)(66446008)(64756008)(76116006)(91956017)(86362001)(55016003)(99936003)(4326008)(21615005)(5660300002)(52536014)(38100700002)(8676002)(8936002)(166002)(38070700005)(2906002)(30864003)(83380400001)(2004002)(579004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?TNK86PYB40bHjAupdtjcoCaJcoJ22W8/FH4poewgZMHbqEX1jSGqYBxA?= =?Windows-1252?Q?wcB4e/wk92359RHOYtv7ZH6EkS8G3JAjehcn4Ex4MnyE0mW9n4K87GD1?= =?Windows-1252?Q?KqSLHcDSUJUw6exLxo7s68H1j3bCetTHKSFVLG88Ua2aSt0Tal3CmihC?= =?Windows-1252?Q?exU5yd6mSeSpqPLTnAs2ohazsI66cVgZJqmB6XDZlV0q7VdFnyMTnMNy?= =?Windows-1252?Q?47gSssz5hCqf4Oi2QNNsLY4jHUtBM6Bju1J+QXtA0oFO37VAnsr/sXI5?= =?Windows-1252?Q?HWGloR+/MxGCXHVvgnNWbVuSvW5be84xUd4l5ln7QFXI4+fznBZRYcQq?= =?Windows-1252?Q?hPjTfbFst9psWFLz61Q7sKU67Do/dptoYwY1zRuTvFTUBjqVDZETt+Xm?= =?Windows-1252?Q?ZZaoyEJ6GAC0VjQcFuLgiSe2WSAou2qZV1yG1Aeuhd5bD51FernfYr67?= =?Windows-1252?Q?ZWBnQQ5kgyBgKRsy8Q9raCRdvPyiKs9EYQnTDRWZ+hYTyHZym5DzALxx?= =?Windows-1252?Q?PceYZQZmF9Js3Z333f0W4F6JdYg4tLeQlXRtJNi1MmlH46wftxPy6Ygp?= =?Windows-1252?Q?t4LI7r3BaylMldhOPMWufBDcaJG0Ea9TqwR6tYRGlHvMWTwhYj3KmkW4?= =?Windows-1252?Q?v4YJLruZyJLuBcNAeHLfPyWbIGzFEUz3ezxNCJRJjfnwzYHrWOKc1NsD?= =?Windows-1252?Q?kcNbLgFCJXNcAVAdnQJW+IHJ+nLAicywW/bwtbghFDKwWrBNQbz0wQ3y?= =?Windows-1252?Q?OPmfavqn4k28r+szY83UHj5Xjh7Vo8EqegBbob0OElap0Kh5MXe1N8jI?= =?Windows-1252?Q?8IvDoblAH25eCA9Fa28ipKmMfDhgfQTtGDV9DuNhpy2ViUWp5izEnlTC?= =?Windows-1252?Q?gPIxaaL5JNWvwgU+AgsTwYKbFsKTSAOpfySf7YHBWEPEC3ziqvpj/3jj?= =?Windows-1252?Q?bnmEu0+z7Ik9G5ZQAXIfUahMotpp1xR+01MnwLcRVbAXGrblBRROc8e3?= =?Windows-1252?Q?t7HN622XGUKSFlp8mJ8xjZkNSlCdZgTOa+QG89gz1/KR43lpmk3S5zlD?= =?Windows-1252?Q?rACa89++2WvmaDxUHGfln6knn3EtidzVlucLy5adx21MBBrKBx0/ACBL?= =?Windows-1252?Q?DEg98EsKHpIFkDzUVgtWH8+cuhv27ev+JC0lJo8TuxZf3gtlQJv7cULQ?= =?Windows-1252?Q?aLgZVlkCsHFxGll1GqAO0ge6sYh3Ejtqdxsngyl/X0ezTtHbfrFsKxgu?= =?Windows-1252?Q?SpeH01i+kMZT8k9oiVx3xF9zyfLh+85FA8eWFB41GdhaVawanV+qGxaP?= =?Windows-1252?Q?1XexW48yeae21P8f14MazkghXL82VGOvql35htY1s6kClQga6ZiCrq+O?= =?Windows-1252?Q?SC3woc9xZ/Rgvyr6v2FRE7sOaqjGTpDOpYlFMTJ43gIN5P079M/mAMFA?= =?Windows-1252?Q?ExDJeSS0vxF8Os2LKEJ3MVp7qmmQGQiDQN6qTcusVJ+W8Y0nYJAMFLTc?= =?Windows-1252?Q?1sPL02xn3DF+B2uz9J5oyebBdi1jfbqVLhvubCgZrVzzJkz8JA/fctqB?= =?Windows-1252?Q?wxx5rL4in7zpi1HgQvHASadlk3X8L1O5hyvfOYdUfaWuyf6fDTBE2a3s?= =?Windows-1252?Q?AE9+T0IT/W4l9hePnk5Pdj/fn0lwAqHcQ0u1pAE4VstD7MBjJ5F/W6a4?= =?Windows-1252?Q?21zcExqAnAWSwpVatV80UEoSaX1oJj3vPKujLablBCxrednEWSAzimKr?= =?Windows-1252?Q?3SuN82ihVb1qNQDT+bCiqDFIh6N46wLDP9mnqnbdSsAQsGKkcN/lN6xr?= =?Windows-1252?Q?G0EGrg=3D=3D?= Content-Type: multipart/mixed; boundary="_004_CH2PR15MB3544693E6EC29138B9B0105CD69C9CH2PR15MB3544namp_" X-OriginatorOrg: ibm.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH2PR15MB3544.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c12c9960-12f1-4d00-9614-08db3f45f108 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Apr 2023 13:16:23.1868 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: fcf67057-50c9-4ad4-98f3-ffca64add9e9 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: AYh5V8x94IAaNIeppFsByU2MuxXKP4VTfg98/4WzDbCZmVFjRnOmrB/oefdiQ//icdjeX7fjQRxg8ZZyZ+L20w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR15MB5804 X-Proofpoint-GUID: fVq1CkScot9sV277FHzMjkJtzQLcaJIc X-Proofpoint-ORIG-GUID: fVq1CkScot9sV277FHzMjkJtzQLcaJIc X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 Subject: RE: [PATCH] Fix call functions command bug in 64-bit programs for AIX and PC read in psymtab-symtab warning X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-17_08,2023-04-17_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 phishscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304170113 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Aditya Kamath1 via Gdb-patches Reply-To: Aditya Kamath1 Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" --_004_CH2PR15MB3544693E6EC29138B9B0105CD69C9CH2PR15MB3544namp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi Tom, Ulrich and community, Greetings. Please find attached a temporary patch. See { 0001-Fix-PC-read-i= n-psymtab-but-not-in-symtab-warning-for.patch}. Thank you Tom and Ulrich fo= r your guidance so far. Sorry for the previous email. I did not answer Tom=92s query on Stabs. Rese= nding the email again with the answer for the same. Kindly note this is just a temporary patch. I want a review to this. >The warning you are seeing means that the partial and full symbol >readers disagree. This is a bug somewhere. >Maybe the fix is to ensure a symbol is made in the full reader. It's >also possible that the fix is to not make a partial symbol. >Finding the issue isn't always very easy, but basically what you want to >do is inspect the point at which the relevant partial symbol is made; >then expand the CU; and finally see why the full reader doesn't make a >corresponding symbol. >TBH all of this stuff is a design flaw. In the DWARF reader I hope to >unify the paths so that this kind of mismatch is impossible. You are correct here Tom. I agree with you. Thank you for this. So investigating further, I realised this psymtab::add_psymbol is the place= where this partial symbol is made. But before that in xcoffread.c we creat= e it {In the lines as shown in the patch in xcoffread.c}. What I realised is the address that is being passed as GLOBALS looks bogus = in the xcoffread.c file. I did not find it in object dump. The core address= for which the psymtab entries made are 0 ,1a0, 0 and 8 for the below code.= . These are not correct core addresses at all. I was surprised as to where = it came from at first place. bash-5.1$ cat ~/gdb_tests/simple_test.c #include int global_variable =3D 2; int main(){ int local_variable =3D 1; printf ("Simple print statement \n"); printf ("Hello Bengaluru \n"); return 0; } Seeing the comments around the same place in xcoffread.c file at the hunk l= ines of this patch , it looks like someone already knew these addresses are= incorrect in the past. And even in my investigation I figured out that the= se psymbols are incorrect. Hence when function shared library addresses are= looked up in psymtab GDB finds the nearest best false pysmtab symbol and r= eturns it. Which it should not do. >Maybe the fix is to ensure a symbol is made in the full reader. It's >also possible that the fix is to not make a partial symbol. As per your guidance, I tried commenting out the psymtab entries here and r= an all the GDB base testsuite test cases. The numbers remain unchanged. Pas= ses =3D 29059 and Failures =3D 2227 So I guess it is better we remove this. I would like to know yours and Ulri= ch=92s or any community members comments on it. But yeah, the root cause is= the this. And you can see below those warnings now disappear as ps or psym= tab symbol will be NULL when GDB tries to find printf () address which is a= lready there is symtab. See disassemble and info symbol output also.. Output of GDB in AIX after this patch:- ./gdb ~/gdb_tests/simple_test GNU gdb (GDB) 14.0.50.20230327-git Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "powerpc64-ibm-aix7.2.0.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/aditya/gdb_tests/simple_test... (gdb) b main Breakpoint 1 at 0x1000052c: file /home/aditya/gdb_tests/simple_test.c, line= 4. (gdb) r Starting program: /home/aditya/gdb_tests/simple_test Breakpoint 1, main () at /home/aditya/gdb_tests/simple_test.c:4 4 int local_variable =3D 1; (gdb) n 5 printf ("Simple print statement \n"); (gdb) Simple print statement 6 printf ("Hello Bengaluru \n"); (gdb) Hello Bengaluru 7 return 0; (gdb) 8 } ---------------------------------------- (gdb) Breakpoint 1, main () at /home/aditya/gdb_tests/simple_test.c:4 4 int local_variable =3D 1; (gdb) disassemble Dump of assembler code for function main: 0x10000518 <+0>: mflr r0 0x1000051c <+4>: stw r0,8(r1) 0x10000520 <+8>: stw r31,-4(r1) 0x10000524 <+12>: stwu r1,-96(r1) 0x10000528 <+16>: mr r31,r1 =3D> 0x1000052c <+20>: li r9,1 0x10000530 <+24>: stw r9,56(r31) 0x10000534 <+28>: lwz r3,64(r2) 0x10000538 <+32>: bl 0x100005a8 0x1000053c <+36>: lwz r2,20(r1) 0x10000540 <+40>: lwz r3,72(r2) 0x10000544 <+44>: bl 0x100005a8 0x10000548 <+48>: lwz r2,20(r1) 0x1000054c <+52>: li r9,0 0x10000550 <+56>: mr r3,r9 0x10000554 <+60>: addi r1,r31,96 0x10000558 <+64>: lwz r0,8(r1) 0x1000055c <+68>: mtlr r0 0x10000560 <+72>: lwz r31,-4(r1) 0x10000564 <+76>: blr 0x10000568 <+80>: .long 0x0 0x1000056c <+84>: .long 0x2061 0x10000570 <+88>: lwz r0,1(r1) 0x10000574 <+92>: .long 0x50 0x10000578 <+96>: .long 0x46d61 0x1000057c <+100>: xori r14,r11,7936 End of assembler dump. (gdb) info symbol 0x100005a8 puts in section .text of /home/aditya/gdb_tests/simple_test (gdb) info address printf Symbol "printf" is at 0xd0133760 in a file compiled without debugging. (gdb) So in linux when I turn on debug symfile and while it is about to execute p= rintf I see qf->find_pc_sect_compunit_symtab (simple_test, 0x7fff84091768, 0x7ffff7d7a9= 6b, 0x0, 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL qf->find_pc_sect_compunit_symtab (ld64.so.2, 0x7fff84091768, 0x7ffff7d7a96b= , 0x0, 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL qf->find_pc_sect_compunit_symtab (system-supplied DSO at 0x7ffff7f80000, 0x= 7fff84091768, 0x7ffff7d7a96b, 0x0, 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL qf->find_pc_sect_compunit_symtab (libc.so.6, 0x7fff84091768, 0x7ffff7d7a96b= , 0x0, 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL So I am thinking that find_pc_sect_compunit_symtab () must return NULL. In = AIX as well it is returning NULL after applying current patch. qf->find_pc_sect_compunit_symtab (libc.a(shr.o), 0x1104a3c00, 0x100005a8, 0= x0, 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL qf->find_pc_sect_compunit_symtab (simple_test, 0x1104a3c00, 0x100005a8, 0x0= , 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL qf->find_pc_sect_compunit_symtab (libcrypt.a(shr.o), 0x1104a3c00, 0x100005a= 8, 0x0, 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL qf->find_pc_sect_compunit_symtab (libc.a(shr.o), 0x1104a3c00, 0x100005a8, 0= x0, 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL qf->find_pc_sect_compunit_symtab (simple_test, 0x1104a3b70, 0x1000053c, 0x0= , 0) qf->find_pc_sect_compunit_symtab (...) =3D /home/aditya/gdb_tests/simple_te= st.c So I think at least we are in the right direction. Let me know what you thi= nk of this and I will proceed according to the guidance received. Awaiting a reply. >Actually I'm curious how important stabs are to your organization. I >would like to deprecate stabs in gdb 14 and remove them entirely in gdb >15. However, they are still required for AIX, I suppose we'd keep the >code around as long as you need. So I have taken this up with my seniors.. They are still required.. Kindly = do not depreciate.. As soon as any decision is made to not use stabs and I = receive an information on the same, I will communicate it to the GDB commu= nity, you and Ulrich that we can depreciate.. But we need stabs as of now.. Have a nice day ahead. Thanks and regards, Aditya. From: Aditya Kamath1 Date: Monday, 17 April 2023 at 6:38 PM To: Tom Tromey , Aditya Kamath1 via Gdb-patches Cc: Tom Tromey , Ulrich Weigand = , Sangamesh Mallayya , simon.marchi@efficios.co= m Subject: Re: [EXTERNAL] Re: [PATCH] Fix call functions command bug in 64-bi= t programs for AIX and PC read in psymtab-symtab warning Hi Tom, Ulrich and community, Greetings. Please find attached a temporary patch. See { 0001-Fix-PC-read-i= n-psymtab-but-not-in-symtab-warning-for.patch}. Thank you Tom and Ulrich fo= r your guidance so far. Kindly note this is just a temporary patch. I want a review to this. >The warning you are seeing means that the partial and full symbol >readers disagree. This is a bug somewhere. >Maybe the fix is to ensure a symbol is made in the full reader. It's >also possible that the fix is to not make a partial symbol. >Finding the issue isn't always very easy, but basically what you want to >do is inspect the point at which the relevant partial symbol is made; >then expand the CU; and finally see why the full reader doesn't make a >corresponding symbol. >TBH all of this stuff is a design flaw. In the DWARF reader I hope to >unify the paths so that this kind of mismatch is impossible. You are correct here Tom. I agree with you. Thank you for this. So investigating further, I realised this psymtab::add_psymbol is the place= where this partial symbol is made. But before that in xcoffread.c we creat= e it {In the lines as shown in the patch in xcoffread.c}. What I realised is the address that is being passed as GLOBALS looks bogus = in the xcoffread.c file. I did not find it in object dump. The core address= for which the psymtab entries made are 0 ,1a0, 0 and 8 for the below code.= . These are not correct core addresses at all. I was surprised as to where = it came from at first place. bash-5.1$ cat ~/gdb_tests/simple_test.c #include int global_variable =3D 2; int main(){ int local_variable =3D 1; printf ("Simple print statement \n"); printf ("Hello Bengaluru \n"); return 0; } Seeing the comments around the same place in xcoffread.c file at the hunk l= ines of this patch , it looks like someone already knew these addresses are= incorrect in the past. And even in my investigation I figured out that the= se psymbols are incorrect. Hence when function shared library addresses are= looked up in psymtab GDB finds the nearest best false pysmtab symbol and r= eturns it. Which it should not do. >Maybe the fix is to ensure a symbol is made in the full reader. It's >also possible that the fix is to not make a partial symbol. As per your guidance, I tried commenting out the psymtab entries here and r= an all the GDB base testsuite test cases. The numbers remain unchanged. Pas= ses =3D 29059 and Failures =3D 2227 So I guess it is better we remove this. I would like to know yours and Ulri= ch=92s or any community members comments on it. But yeah, the root cause is= the this. And you can see below those warnings now disappear as ps or psym= tab symbol will be NULL when GDB tries to find printf () address which is a= lready there is symtab. See disassemble and info symbol output also.. Output of GDB in AIX after this patch:- ./gdb ~/gdb_tests/simple_test GNU gdb (GDB) 14.0.50.20230327-git Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "powerpc64-ibm-aix7.2.0.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/aditya/gdb_tests/simple_test... (gdb) b main Breakpoint 1 at 0x1000052c: file /home/aditya/gdb_tests/simple_test.c, line= 4. (gdb) r Starting program: /home/aditya/gdb_tests/simple_test Breakpoint 1, main () at /home/aditya/gdb_tests/simple_test.c:4 4 int local_variable =3D 1; (gdb) n 5 printf ("Simple print statement \n"); (gdb) Simple print statement 6 printf ("Hello Bengaluru \n"); (gdb) Hello Bengaluru 7 return 0; (gdb) 8 } ---------------------------------------- (gdb) Breakpoint 1, main () at /home/aditya/gdb_tests/simple_test.c:4 4 int local_variable =3D 1; (gdb) disassemble Dump of assembler code for function main: 0x10000518 <+0>: mflr r0 0x1000051c <+4>: stw r0,8(r1) 0x10000520 <+8>: stw r31,-4(r1) 0x10000524 <+12>: stwu r1,-96(r1) 0x10000528 <+16>: mr r31,r1 =3D> 0x1000052c <+20>: li r9,1 0x10000530 <+24>: stw r9,56(r31) 0x10000534 <+28>: lwz r3,64(r2) 0x10000538 <+32>: bl 0x100005a8 0x1000053c <+36>: lwz r2,20(r1) 0x10000540 <+40>: lwz r3,72(r2) 0x10000544 <+44>: bl 0x100005a8 0x10000548 <+48>: lwz r2,20(r1) 0x1000054c <+52>: li r9,0 0x10000550 <+56>: mr r3,r9 0x10000554 <+60>: addi r1,r31,96 0x10000558 <+64>: lwz r0,8(r1) 0x1000055c <+68>: mtlr r0 0x10000560 <+72>: lwz r31,-4(r1) 0x10000564 <+76>: blr 0x10000568 <+80>: .long 0x0 0x1000056c <+84>: .long 0x2061 0x10000570 <+88>: lwz r0,1(r1) 0x10000574 <+92>: .long 0x50 0x10000578 <+96>: .long 0x46d61 0x1000057c <+100>: xori r14,r11,7936 End of assembler dump. (gdb) info symbol 0x100005a8 puts in section .text of /home/aditya/gdb_tests/simple_test (gdb) info address printf Symbol "printf" is at 0xd0133760 in a file compiled without debugging. (gdb) So in linux when I turn on debug symfile and while it is about to execute p= rintf I see qf->find_pc_sect_compunit_symtab (simple_test, 0x7fff84091768, 0x7ffff7d7a9= 6b, 0x0, 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL qf->find_pc_sect_compunit_symtab (ld64.so.2, 0x7fff84091768, 0x7ffff7d7a96b= , 0x0, 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL qf->find_pc_sect_compunit_symtab (system-supplied DSO at 0x7ffff7f80000, 0x= 7fff84091768, 0x7ffff7d7a96b, 0x0, 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL qf->find_pc_sect_compunit_symtab (libc.so.6, 0x7fff84091768, 0x7ffff7d7a96b= , 0x0, 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL So I am thinking that find_pc_sect_compunit_symtab () must return NULL. In = AIX as well it is returning NULL after applying current patch. qf->find_pc_sect_compunit_symtab (libc.a(shr.o), 0x1104a3c00, 0x100005a8, 0= x0, 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL qf->find_pc_sect_compunit_symtab (simple_test, 0x1104a3c00, 0x100005a8, 0x0= , 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL qf->find_pc_sect_compunit_symtab (libcrypt.a(shr.o), 0x1104a3c00, 0x100005a= 8, 0x0, 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL qf->find_pc_sect_compunit_symtab (libc.a(shr.o), 0x1104a3c00, 0x100005a8, 0= x0, 1) qf->find_pc_sect_compunit_symtab (...) =3D NULL qf->find_pc_sect_compunit_symtab (simple_test, 0x1104a3b70, 0x1000053c, 0x0= , 0) qf->find_pc_sect_compunit_symtab (...) =3D /home/aditya/gdb_tests/simple_te= st.c So I think at least we are in the right direction. Let me know what you thi= nk of this and I will proceed according to the guidance received. Awaiting a reply. Have a nice day ahead. Thanks and regards, Aditya. From: Tom Tromey Date: Friday, 14 April 2023 at 8:15 PM To: Aditya Kamath1 via Gdb-patches Cc: Tom Tromey , Ulrich Weigand = , Aditya Kamath1 , Sangamesh Mallayya , simon.marchi@efficios.com Subject: [EXTERNAL] Re: [PATCH] Fix call functions command bug in 64-bit pr= ograms for AIX and PC read in psymtab-symtab warning >>>>> Aditya Kamath1 via Gdb-patches writes: >> warning: (Internal error: pc 0x100005a8 in read in psymtab, but not in s= ymtab.) Hi. Thanks for the reply. > But the libc shared library that gives the printf () was compiled > using stabs. So now we have symtab created for symbols used by our > code and psymtab created for the shared library functions. Ok. This answers one of my questions. The stabs reader is on life support. If you want to track down and fix this bug, it's up to you. Actually I'm curious how important stabs are to your organization. I would like to deprecate stabs in gdb 14 and remove them entirely in gdb 15. However, they are still required for AIX, I suppose we'd keep the code around as long as you need. > The problem is the shared library functions in AIX do not have an > entry in the symtab. They have in psymtab. > Coming to solving this, I did try a few things in the last one > week. Let me tell you all what I did and where I failed. I tried to > add the symtab entry in the xcoffread.c file via record_minimal_symbol > () but then realised that after initial scan GDB code was not coming > here during execution. So it failed. I tried searching around > solib-aix.c file if I can get a hint to fix this but did not find any. gdb reads 3 kinds of symbols. "Minimal" symbols are essentially "linker symbols" -- in this case they aren't super relevant. That's why your investigation here didn't yield anything. Partial symbols are made by an initial scan of the debug info. (The DWARF reader doesn't use these any more but has its own analogous idea.) When more information is needed about a partial symbol, full symbols are read for the compilation unit. The warning you are seeing means that the partial and full symbol readers disagree. This is a bug somewhere. Maybe the fix is to ensure a symbol is made in the full reader. It's also possible that the fix is to not make a partial symbol. Finding the issue isn't always very easy, but basically what you want to do is inspect the point at which the relevant partial symbol is made; then expand the CU; and finally see why the full reader doesn't make a corresponding symbol. TBH all of this stuff is a design flaw. In the DWARF reader I hope to unify the paths so that this kind of mismatch is impossible. Tom --_004_CH2PR15MB3544693E6EC29138B9B0105CD69C9CH2PR15MB3544namp_ Content-Type: application/octet-stream; name="0001-Fix-PC-read-in-psymtab-but-not-in-symtab-warning-for.patch" Content-Description: 0001-Fix-PC-read-in-psymtab-but-not-in-symtab-warning-for.patch Content-Disposition: attachment; filename="0001-Fix-PC-read-in-psymtab-but-not-in-symtab-warning-for.patch"; size=1881; creation-date="Mon, 17 Apr 2023 13:15:37 GMT"; modification-date="Mon, 17 Apr 2023 13:15:37 GMT" Content-Transfer-Encoding: base64 RnJvbSBmNjk0NmZlMmE4NWVkMjkyNmE1ZGU4Y2ZjM2VhMzA1YTU2NjlkZWIwIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBBZGl0eWEgVmlkeWFkaGFyIEthbWF0aCA8QWRpdHlhLkthbWF0 aDFAaWJtLmNvbT4KRGF0ZTogTW9uLCAxNyBBcHIgMjAyMyAwNzozNjo0NiAtMDUwMApTdWJqZWN0 OiBbUEFUQ0hdIEZpeCBQQyByZWFkIGluIHBzeW10YWIgYnV0IG5vdCBpbiBzeW10YWIgd2Fybmlu ZyBmb3IgQUlYCgpJbiBBSVggb24gcnVubmluZyBuZXh0IGNvbW1hbmQgaW4gc2hhcmVkIGxpYnJh cnkgd2Ugc2VlIHBzeW10YWIgUEMgaXMKZm91bmQgYnV0IG5vdCBpbiBzeW10YWIgd2FybmluZ3Mu CgpUaGlzIGlzIGJlY2F1c2Ugb2Ygc29tZSBmYWxzZSBwc3ltdGFiIGVudHJpZXMuCgpJbiB0aGlz IHBhdGNoIEkgaGF2ZSByZW1vdmVkIHRoZSBzYW1lIGFuZCB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