From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 2655C385696A for ; Mon, 17 Apr 2023 13:08:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2655C385696A Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ibm.com Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33HCqn0h006093; Mon, 17 Apr 2023 13:08:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : date : message-id : references : in-reply-to : content-type : mime-version : subject; s=pp1; bh=MXa5gdu3/0Pv6SJI0A3zPf4Ys4mbcJydGMpzy2ON5RU=; b=ipuOWhLa/eM5Nwr3oRNIch4d6x/XOJF6N3Kl7YODKWmS0wY74QFr1mvHpldvyAVLcHRG o5XIVGFOif5xHMmoOVI9maelFsDgCaAEdXXcIYNjKCGM/dOovhPzi80dk3Mqa4r/mdkf 806pxtVVtvF9VmRkUvR7aWbQ5LM6CYFRTIo9BSheGL/v7ddUsyGrcM/yGU8pEv5Wfmpi P0ivDMnxsxGb2vvEDDcEDPHkKvn0hVN4fMRWxNARWeJmfQO8lQlOdryCILdp2zD6Blsj +Dy3sjkmNzE2u8HNWs/PWQ5XsRTEJo5I+Z/lXNXNViDgcytITFaRo+cvbV1CViT9xxO6 ZQ== Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2046.outbound.protection.outlook.com [104.47.56.46]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3q156djvwj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Apr 2023 13:08:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SSlU4d8lZ3mgghZq+G7oxxn2dD+Zi4Izhbmhx5tAfnq1FVrRNaxWk5RxFVKNYQgVwgtO1gUTle99RF5uTjDOK2cok2/P3DbSe5NFiaZXmNSDBhNu8y1WUknHSwOLPrSuAzK1/iT/Y1PcnWNgVGISQs8vGjpOojpyOnR/7GrxvNPtNn48qEA4CYhb0zy+X07ZKTz4jA20WlPAfIKZCwDpCs+2ra6XX9pDjlK7AS3xMb/nOnx96DBu7aj7IcTvfkbvAZBgFNxr9yX2iQfpTIYS+ZzwyFtyPyYe2+T2ure7rakBOpU5HasTCPREHT1WOYqyhXSNDKJxracpFcU5jv158w== 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=MXa5gdu3/0Pv6SJI0A3zPf4Ys4mbcJydGMpzy2ON5RU=; b=LLIvnSNgBAlYF6A9LuHCpl5c02kJLl18Xa7JdWa8wcx3aZZdg3wl8jxDUybc11BgtzLIo5jQp/UljOUGIpQMqUnaM+iqFdD4+SkKf9ar5W759WpoHHuVuj3UV0LLDzK1SUFM2zw79mRUBOrVcBNtYRR5YPV5hoTpiyq5Giw93jdiu5OX1eMYTJCe24E6f/6bRttdIhSVXBjqSvyOww8xiSts4nseb3FwnXlvse44reKsdngQtdCVkD9pfSZqiNlemEhe3gUG2J8o2iymTwKM9RuMK5sMwmDNHanN9hNiVbRxphO+LMM0w/HY94iyiKKOEl1KUrSw8sNs/U4wVz0Baw== 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 DM6PR15MB3768.namprd15.prod.outlook.com (2603:10b6:5:2b0::12) 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:08:38 +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:08:38 +0000 From: Aditya Kamath1 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: AQHZbqQQBfkl018eIkqZzSgzxcljOa8q4lytgASUKjU= Date: Mon, 17 Apr 2023 13:08:38 +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: <87sfd24j4w.fsf@tromey.com> 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_|DM6PR15MB3768:EE_ x-ms-office365-filtering-correlation-id: db69a878-b91b-49ff-2967-08db3f44dc13 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5ytkqiVb9tBQOSXaXR9YdhxbWjdE1TypsPVUxjENvgf7X/mn8nyoqEVLSY5wo+LwIRtVFP33qARS1wV/mPxwNqK4M49mKvPsLuVPX3iWNsOpTFVWl1si3qRRIhvpR4e78J9s24LS6jJb1klK7k/6QauzqBJ864MpCmZ/KUXmBsGFH3gy7q/AX+E+S4WtW5cH6YSG/buXLSFDQJ/fOXUvi4p+7LY+OhjHEVkLybtQSbr8swbFvrZF0/eovgVPi6/jJ90CAtNJmHSC4IDy7AVwpAdTc8ba94O7sC+MiNxf5h0r9njX6uO7kYM+JAFtZnHapuUncPmG6oqyV4BgJFyKp7RS2hsbis3rl4KkAs2gg6NjAyHFagUP3YCK4npkc8lpak7VPYPitfe9S7dH9YvTqwdhD3HUTOtS5ArGPF61NfEsTRdnUq5tAX8ar1GmGd7eOeR4vqNVRnHF/p+XFggs7juKHCZm4HjJkNH8vnEcskdcUIy0FMh0AM1+is61lwUt7/FKrxTHo3KH3GCbITxzopzZA90Xaz3xI2bXvK2rNsZR6KumGvgmwtC+l9/NByHCPu7SjAdbbbskASOdVAVsntTV4I2Ef2ZxPtY4iwI+4fcCVfMeGBU9fA3zozFPawqw 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)(39860400002)(346002)(396003)(366004)(136003)(376002)(451199021)(21615005)(38070700005)(52536014)(166002)(2906002)(5660300002)(8936002)(8676002)(41300700001)(122000001)(55016003)(86362001)(33656002)(38100700002)(478600001)(54906003)(110136005)(6506007)(53546011)(9686003)(186003)(71200400001)(966005)(7696005)(4326008)(91956017)(64756008)(66446008)(66476007)(66556008)(76116006)(66946007)(316002)(83380400001)(99936003)(2004002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?+iyGLdigddrote2Y1wBSdZf78V7Y8/aer7M1nReZ+2F4adNNzDyTgDsB?= =?Windows-1252?Q?fk8z+TVAkyOArz4rXvjrNdMyCX0Ll+jm80s+H7jhqOU/loATdfhKEjLS?= =?Windows-1252?Q?EOHGlyfV+SRMVoDZOIseEL4RIZpQg0T+fIr8n+aGnj9N00RQv3cqosYt?= =?Windows-1252?Q?TomILevVDoU22A2S3FXMZGwf4wXzBN4Qwgz0oZs4VXkLiA9NiYDYSKAr?= =?Windows-1252?Q?Q7w+o60t2nQtHoDKCoU64bPjxlEtaVq9yNHyGsbUv0Jw6ACxNY6znRm+?= =?Windows-1252?Q?TuJJeetqlfaVHWLImx29/Mhd5R+nJPtxk1KeUZj/jjIqa6LmCFDrs6Ip?= =?Windows-1252?Q?T5OHd9n+L2jGbRcJVf+0m7ppBD9P2xo+12pSU9ZvDNTPAmpcYCowh3xR?= =?Windows-1252?Q?eVfy5mb1ROHkwsHAm0yqTUVXNJhb2tplT1luD0VbKWbdCn1mKQfRHtBn?= =?Windows-1252?Q?uxeg4C8h/vTzhlc8MxOd6CzGCQqBnTGiA2843Z17XV1RgA/pB+mt/uDn?= =?Windows-1252?Q?lVCf1nUlt6SPrsm2843gDwvCcmaThkwTNROoE1JLEPfbP8BAgGWYWPxY?= =?Windows-1252?Q?tk8NZl18u/tRdVdgdLXuOem47K4OAQoifyvNGCLu7BkssEQ+Y9b5Mukg?= =?Windows-1252?Q?WNQZLkURIElQVPYdO5qmsTpDNYVEd3ZT55mrDaEX8ZuIbq2wnZ5Ew+RO?= =?Windows-1252?Q?7XWFBUreTmkwo8zSVmbY97OEyYfBHLi4Wq2Uy+LALgkDrxstTU2F+rBh?= =?Windows-1252?Q?27EF0CF8gNOWS91w3ECMbLqCBfLVc42YpuO5J0FQEF5HG22hqJf9oLI9?= =?Windows-1252?Q?H7pTH/SbOZJdotduRmEWlZy1c+KmDmYj22WSWMuksRHOtPQge2/PQOc2?= =?Windows-1252?Q?oRwhCbUnoBEXPzJlfY++95q06kkBMLWuNxJMU3EOJytKw7oOccVkBykE?= =?Windows-1252?Q?IhL/X+WIgoJGzHi7JvNDXLdHu0sCoKX48aC5nz2rXf0FIMHyS2lGIO/5?= =?Windows-1252?Q?rpdJqCHs3QF349H7QMXhfCM4OV7p3X9Gzs03Un9c29GoleTjx+8nFf2t?= =?Windows-1252?Q?HxVS7+3abCF/Nai72sRtpQL5nKbbDkH2+vMenMdt5zdHBtTXIBfuSxl2?= =?Windows-1252?Q?BWcb0eS5HlJqx990xYJDPebHULWh3GODYNbFFonlN1NVfrLHclatccma?= =?Windows-1252?Q?O2EBj+Vw+QuaKZmyeM/qbyG0j5LDziGATIzbdMqjOX1v1hOu1EZi+str?= =?Windows-1252?Q?o5oD4oknOr9zGQrpOYhaCchzOQMp9jesCxwgPZXRlvf1gYxTCzHIjRIw?= =?Windows-1252?Q?3FkFIs3sZNGjI6dUUJnPQtj51CBuQbjmYHpNeSgWCRECA0uGe4bfLaSA?= =?Windows-1252?Q?/XfJsEZYWY5GJGj8E/xJj1v0rXpF/hpr1JcTy+DTNztmalYwy+D5ThV5?= =?Windows-1252?Q?rAU5g/Sk/FNZ91/p8avuu7FO3Ab5viwSD5pOxa0wIWfiBYvvJEm4hQU6?= =?Windows-1252?Q?vwI0iusIN0MAw63it6zNZjUVtneA6wPoCXJm0F+EGWrwYR3uByVtFs5i?= =?Windows-1252?Q?ihRkThHQ/EWptCdV7NDKV3iLt9vekBGgboMYFKlyDS9ANfBFfzrCrTjI?= =?Windows-1252?Q?g9+F9GJ39eddtOJiSkce0AWtIaif2wzNAntVEO9xwlORC8LoXnNmfMzm?= =?Windows-1252?Q?rlCEQw3buLMIET3FC2vdTNnPAiDSjamaVg/gGu/k1qHtHHw5UsimGv91?= =?Windows-1252?Q?UAGCBVr8tkY0sk5AxtkGtIhkBOm/ZpNR0/erAF6JxmaY0CGS4YY9L0Gy?= =?Windows-1252?Q?eAAXlw=3D=3D?= Content-Type: multipart/mixed; boundary="_004_CH2PR15MB354419F887A949497D3FF070D69C9CH2PR15MB3544namp_" 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: db69a878-b91b-49ff-2967-08db3f44dc13 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Apr 2023 13:08:38.5371 (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: fobInHCXlDEVLcYkBbophjaxvwuJhGo7OC0WqqgUX7da8G4W3I35B0TyrT8SCRENbS0cBo+2GWnWx139RdCuHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR15MB3768 X-Proofpoint-GUID: guN5H4QvkaZihp8Pvwvm9tmyUlgchAHK X-Proofpoint-ORIG-GUID: guN5H4QvkaZihp8Pvwvm9tmyUlgchAHK 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_07,2023-04-17_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 spamscore=0 mlxscore=0 priorityscore=1501 adultscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304170113 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,KAM_SHORT,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: --_004_CH2PR15MB354419F887A949497D3FF070D69C9CH2PR15MB3544namp_ Content-Type: multipart/alternative; boundary="_000_CH2PR15MB354419F887A949497D3FF070D69C9CH2PR15MB3544namp_" --_000_CH2PR15MB354419F887A949497D3FF070D69C9CH2PR15MB3544namp_ 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. 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 --_000_CH2PR15MB354419F887A949497D3FF070D69C9CH2PR15MB3544namp_-- --_004_CH2PR15MB354419F887A949497D3FF070D69C9CH2PR15MB3544namp_ 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 12:49:08 GMT"; modification-date="Mon, 17 Apr 2023 12:49:08 GMT" Content-Transfer-Encoding: base64 RnJvbSBmNjk0NmZlMmE4NWVkMjkyNmE1ZGU4Y2ZjM2VhMzA1YTU2NjlkZWIw IE1vbiBTZXAgMTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBBZGl0eWEgVmlkeWFk aGFyIEthbWF0aCA8QWRpdHlhLkthbWF0aDFAaWJtLmNvbT4KRGF0ZTogTW9u LCAxNyBBcHIgMjAyMyAwNzozNjo0NiAtMDUwMApTdWJqZWN0OiBbUEFUQ0hd IEZpeCBQQyByZWFkIGluIHBzeW10YWIgYnV0IG5vdCBpbiBzeW10YWIgd2Fy bmluZyBmb3IgQUlYCgpJbiBBSVggb24gcnVubmluZyBuZXh0IGNvbW1hbmQg aW4gc2hhcmVkIGxpYnJhcnkgd2Ugc2VlIHBzeW10YWIgUEMgaXMKZm91bmQg YnV0IG5vdCBpbiBzeW10YWIgd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