From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2043.outbound.protection.outlook.com [40.107.92.43]) by sourceware.org (Postfix) with ESMTPS id B8E903858C53 for ; Sun, 17 Jul 2022 12:58:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B8E903858C53 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hyAsKs8STjH8YvisUer5vhvv8ZIPA5VZZO5YALKya/2gdeSaT3/EHf77zC1dW3bvdXZyAl4S8l+lmhrWhh3b58BJaijdt/FpKngV/gBjGj5AYrKlVN8ye+JsVpqHa3t4xi2HcseJmdWDLyTdKTkuhrZD18dgM/LtDx77tRvg7Zl/VimrpvEFmvEnk2a+TMvBY2MHjFpexQ+mZlmebTSQE5+e5/1hpu6oO/DaQeNy7uGGm/YNeFQGDo7xiONw4ez4a89TtDFKgcoGc/KL+rM6/OtPuLKlPJLeLSvnJzniDmVnzvi0JHdW23X6LkWp9+J3ym+yCY0tbaVWPsyhR0/LBw== 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=bgxwCJCo2L4BclISpZS3DMfshBLqCpxX5vTEoUPbrn4=; b=crog1FvomAAeSOki59pwg1og2QFIXuBGBO5mkVwut06lntVWKoXVZoeNvFfaeNUu/KbkjhEbe4iYT06rnhT+Ge3lCa1wPfYf6qTUF/DUZ+cvtqtHofYoK2kbWzB3SUU0EEJt0ZcLbMXlQcqx+X2TK9AJ9Qtz5JcLLv5/gZjknpXb8KGC2aF3HIWXrCQfTPHUxjWqAGx+0zXCvW96GAiZkkotxlJXus7eGKKbFu/TGVKhfrBdQEQ8lOeQFCq2r39eQZ3TDHXoIKlgRlGe5aXcTUXmrWQjnKQDFOMRvINs0RjMy7Q8zS2rLLkmG7qwR4l+GSPqdnm0Ya3Ddg0egRVShw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none Received: from BY5PR12MB4965.namprd12.prod.outlook.com (2603:10b6:a03:1c4::16) by CY4PR12MB1830.namprd12.prod.outlook.com (2603:10b6:903:127::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.19; Sun, 17 Jul 2022 12:57:59 +0000 Received: from BY5PR12MB4965.namprd12.prod.outlook.com ([fe80::e1bf:db35:5906:5bed]) by BY5PR12MB4965.namprd12.prod.outlook.com ([fe80::e1bf:db35:5906:5bed%9]) with mapi id 15.20.5438.023; Sun, 17 Jul 2022 12:57:58 +0000 From: "George, Jini Susan" To: "Kempke, Nils-Christian" , "gdb-patches@sourceware.org" Subject: RE: [PATCH 1/3] gdb: add support for DW_AT_trampoline in DWARF reader Thread-Topic: [PATCH 1/3] gdb: add support for DW_AT_trampoline in DWARF reader Thread-Index: AQHYkftTANT9yFEwKk205k3J2GTj1a16xbwQgAF2QYCABjMAoA== Date: Sun, 17 Jul 2022 12:57:57 +0000 Message-ID: References: <20220707121538.1317473-2-nils-christian.kempke@intel.com> In-Reply-To: Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_ActionId=abb83dda-69d1-4673-96af-8660439988c6; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_ContentBits=0; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Enabled=true; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Method=Privileged; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Name=Public-AIP 2.0; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_SetDate=2022-07-13T07:30:18Z; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 864ea668-77ad-482f-ba6f-08da67f3f925 x-ms-traffictypediagnostic: CY4PR12MB1830:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: aC37+Gg/Pghkm7KQimDN/zmflJ+Y3cQzeSzEDUbioVQH3IYKcD5LCsRFlCIPwfcpZW+mBanNsFknAkuNPbfwOLT8+qKSxWIlt9fcL4nI39ANdkbBNWsDnTQNqA8daTeWWxL8Njfqguuz8aeCMbc4rG5snLFkmFmzv4/HBRO3i7XSV6lO/mRX4nDjQQLl+uwUW5QOdX3a3bnq9QUgHdeQDSp+FTw6l1J5dtH3PUBcthOLkiit4YRujI2odehVvw2QufXNz47DS69M3s1cszYr2BrrnIBiqklN9rp44NmJ0Vq36JRUMZ8xrawpTpaZ2DBs3cSaQEvSZqnszv2OR1HejH4eYuzx+RGHTgpHiAhZP0axmDMqs2KRqSvORMXW6TO4+/CMFFft4WlEriYWm/aUIMNKGlzYGENVmriYPmf5HNi/1+kddW9JRlmVy4L/3AGGrr+crklqbnlxIC6g/omfzNcEYBdjh/0mX3ODAB9e+M8XRVyHmpfS4brDNr6FN5NFLX9CtsryqH/bwMTdjF0kzImpV2gaKXwnxm63Xz9FLtciA1R0KVqO25Zh3so/kONxqQUIs7jU5bhlLBczZsCofRI52CNtjx1c9+rn37XCfMejeKJb8dfGqKn6lOPqKFWKjyXs1rAc9wO0Bh6LzjNkmvYPOPA/2O/kzxwhUAP/E/jrFmLTe6dU7fd6Oql/C2rei8XZS1bmK0APNiqjFfpgDcrmiQp2i1kykvI7yOxqJuB/Hl71df9BpkQcPB715OyisqbxB8dbsrEasV1SJybIBUSjur2+lT4ff6qM+49fwcvwMsDoOmOi2dGuuKM43Sp9ZGVhxvr1xRqKc4/GGRhJuA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR12MB4965.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(396003)(136003)(366004)(39860400002)(376002)(346002)(316002)(76116006)(66946007)(55016003)(186003)(86362001)(66556008)(64756008)(66446008)(38070700005)(66476007)(45080400002)(38100700002)(122000001)(110136005)(26005)(8936002)(9686003)(52536014)(41300700001)(2906002)(5660300002)(6506007)(33656002)(7696005)(83380400001)(8676002)(71200400001)(478600001)(30864003)(579004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?/d2DAPBpG/cXCq1Fw58jDjKBTNxSl+SZ7i0bXcUiDghI8+pZdd5sUhGsIBeX?= =?us-ascii?Q?iF1Gtns7gD9wgmGnOHabyQa3dBcPY7RwJStdPnLlRX+gg5/7TlRzf8Qu39/R?= =?us-ascii?Q?40yJXM4gGSNgoMY5VWO8l7thua2tl3urNfvvzsw7bQEBdGvvkDI9J19ZAPAW?= =?us-ascii?Q?YPOsMeYXw+8O5xDKiHhwtCD+/vkAp+PzL2od85GDcR/7U+4kDIamQGZ1jQic?= =?us-ascii?Q?a9M0cYeNOBz9neebIvIBDmxNCG4//lTwuYhPUvZHveaapIteiEJC79w8px3v?= =?us-ascii?Q?w2qSRyNM2okgFBvZ1oQHiz4EifMCODPDcvgMczkzNeG6Wt/NW+hQ1V5u9/zI?= =?us-ascii?Q?QyY0DSAZAHPjiejoXy0P/NVOrXT+PCsaS6YkMdP8W3p3lxsfmn8Tz2VQTQdS?= =?us-ascii?Q?ESTPLuE88jdW5all0X0RJV5mTHSrvjKypeVh9AyHr6SGn/x+YVeTkfI5mVGX?= =?us-ascii?Q?mVApDgfMJ2P+GfoHkFyqVpNBJREQSspjiN5fU+XE82SkTf8G6Bs//PzysVuz?= =?us-ascii?Q?O5OJ251axbQ+bgru/f+3Ii7Nc+FODxv5zNeO7eq6Y0fAHjlW7sNdiboJzH9i?= =?us-ascii?Q?4OVmApA20hs2eLhCa7R8DHJZOP0sSYBRcoo9jujdHh+OoPEP5wuKVjAclYY5?= =?us-ascii?Q?eMybV9fcG4Gr7s/lvIKE3dN4uETUL8TCyg7nG1pZt8q2Vcd4cGjM6VbhxM1z?= =?us-ascii?Q?44uHs+aVwj+spX7NfDh5i4/81ycB7r4g5XnTR+BL1IYdiuHGZROd3NFrtHtK?= =?us-ascii?Q?QvCuDF+HLV5TJSXvlqdjt9LuxP7f+PXEEVXRUNlJhcWEInh8Dunkb59V95I7?= =?us-ascii?Q?iEckhIhBxg+rXIl+KclLWVsASliLp8zmR3uI5SXYZYRgZC5HwrNGF365Bk6Y?= =?us-ascii?Q?RlV4l5N8wT9EPsTg0FScLbG9UTSMJSU1FlxWx9IZoPryiCJ7nUZGTr91iMWz?= =?us-ascii?Q?6l32r63PkreXBuRFvhdyR1QyfbquMZdpBxJhygMuqzXUy3aMAlCr0zLTgql1?= =?us-ascii?Q?6kwnaCSJHvy7xk7cPEI1hjmFAuHWiz3Tw8vZym1of79AsHfMlItI5ZS2jAnJ?= =?us-ascii?Q?W+tTJYrwWLyjARejq+o85tNecKUylta3yjWcH71+ZGeDAhiHXmVhNIC6HJU8?= =?us-ascii?Q?7JsdqwuN2BLd4c1A71DM3tYp0trkF+G7a9aqwU5OktjFftUeMJJAK4u325MY?= =?us-ascii?Q?mit2mJB0H2c/LntTyKzK80aTNJLfG4BQDej2fh1I5HJdrBEl8ZU5w91lxe8L?= =?us-ascii?Q?6lv3AlDJEkNE06NTRDo/E0Ga5yx4qgoMvo9QhiRBN0lzsdqwd/1/mvj0we8a?= =?us-ascii?Q?jRSgs+UbTFyDhFKPsVcrqEc9ZWJ0FkJEVEeCN+fLTbMbSgqAUzdG3aQnDjAb?= =?us-ascii?Q?H215htFNyQn/bLW8d0H3QcZQhFFbPXOjg5GEO1LZi7w4G1gf2pNS4WIz3Ujl?= =?us-ascii?Q?FO/hnTXzK/Xh9W4QseLuFvtrZHeSeRFUEoaC031/1R+Kz1z5NzW9wwg03m20?= =?us-ascii?Q?STWPZWkf83MkZ/Dj4U7exNILcvn6HY/KT4plhQA4GR8sIPTWvARtLAMKpCNb?= =?us-ascii?Q?GlAMAtO4X52pug36IRfwc8Ny2dC9g+cTYWQLo8f0?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4965.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 864ea668-77ad-482f-ba6f-08da67f3f925 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Jul 2022 12:57:58.0903 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 8BywELurz35urm5IxZI5qtJdldxGO8GbJKWPRBOGX5ynH58o0ukBnkoXcTqW1ozPL7ziu9FQAz+8L+gj0SIx+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1830 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, 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 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: , X-List-Received-Date: Sun, 17 Jul 2022 12:58:07 -0000 [Public] Hi Nils, My answers are inlined below. >>-----Original Message----- >>> -----Original Message----- >>> From: George, Jini Susan >>> * Is there any common ground we can find with the way solib (linker >>> PLT) trampolines are handled ? I am OK if we can't, but I think it >>> might be better to check and rule it out. >> >>I don't quite understand what you mean here but am also not super familia= r with >>the solib handling part of GDB. The attached patches treat any function = that >>was marked as DW_AT_Trampoline in DWARF by the compiler. As far as I kno= w >>not a single compiler (except ifx) emits this attribute up until now. If= a compiler >>were to generate DWARF for the solib trampolines and if it were to add th= e >>attribute, we could also treat solib trampolines with this approach. >>But generally, the DW_AT_trampoline is independent of any other GDB >>trampoline handling. >>Not sure whether this answers your question. Maybe you can elaborate a b= it >>more? >From what I can make out, the solib trampolines (marked in the minimal symb= ol table as ms_type =3D mst_solib_trampoline) are identified in gdb from th= e elf symbol table based on their type. (The identification of these trampo= lines are different, and I would not think there would be any common ground= here wrt the identification). But there could be some common ground wrt th= e handling. For example, while stepping through the code, we don't step int= o the solib trampolines, which typically are named as , but we end up stepping into the resolved target function. It would be gr= eat if that could be checked out. If it looks like there is nothing in comm= on, that's fine, but it would be great if we make that decision after check= ing it out. >>> * Also, do we want to resolve and display the target of the trampoline >>> code (if possible) in the disassembled code also ? >>> >> >>So you mean, when I am about to step into a wrapper/step through a wrappe= r I >>would display the target at the respective call statement with some note = like >> >>(gdb) disassemble >>... >>0x080483fa <+0>: push %ebp >>0x080483fb <+1>: mov %esp,%ebp >>0x080483fd <+3>: sub $0x8,%esp >>=3D> 0x08048400 <+6>: movl $0x2,0x4(%esp) >>0x08048408 <+14>: movl $0x1,(%esp) >>0x0804840f <+21>: call 0x80483ed (trampoline to: 0x12345 ) >> >>? >>So a change in the pretty_printer for assembly I assume (or somewhere dee= per). >> >>This would mean, GDB would have to check every time a call appears >>somewhere in the disassembly whether or not the target is a trampoline, a= nd, if >>so, GDB would need to resolve this. >> >>Generally, I think this might be a nice feature. I'll have a look whethe= r it can be >>done without too much effort, but if it turns out to be considerably diff= icult I'd >>rather like to leave this for a different patch. >>If this is already done in the other trampoline cases (solibs and signals= ) it might >>be needed for the completion of this patch though. I think you can disregard this comment of mine unless the effort involved i= s trivial. Wrt the solib trampolines, the target function names are embedde= d in the names of the trampolines (as @plt, and the g= db disassembler would not have to do anything special to get that displayed= . >>> * Also, do we want to refer to these trampolines differently so that >>> these can be distinguished from the linker PLT trampolines and the >>> signal trampolines ? >>> >> >>I hoped that the patches made the difference clear enough. Or can you pi= npoint >>something that seems unclear? How would you instead refer to them, I am = a bit >>lost here, to be honest. They are, after all, according to their DWARF/d= ebug >>info trampolines. Referring to them differently would in my opinion mayb= e >>obscure things? But maybe you had something in mind. I was only referring to some term which could be used to refer to these tra= mpolines (like how we already have 'solib trampolines' and 'signal trampoli= nes'). But if none of the terms (compiler trampolines, debug info trampolin= es) seem to fit right, you can disregard this comment. >>> * In read.c, in read_subroutine_type(), where the DW_AT_trampoline >>> attribute is of form reference, we seem to be storing the value >>> corresponding to the DW_AT_name attribute, whereas in many cases (C++ >>> and other languages), it might make sense to store the mangled name >>> typically obtained from the DW_AT_linkage_name attribute. Given this >>> it might be good to have a C++ test case for this with trampoline >>> target functions inside namespaces also. Maybe with the same target >>> function name under multiple namespaces. Also, the comment in >>> gdbtypes.h (Line >>> 1883) mentions mangled name, which does not seem to match ? >> >>Yes, I think initially the comment was intended to only describe the >>DW_AT_trampoline when its FORM is string. That string could have been bo= th, >>mangled and demangled. But I get your point. I am not sure whether stor= ing >>the linkage name or the 'normal' name is correct here. I think these are= two >>different issues: which name should be stored and should it be demangled = or >>not. But I'll check this again. I guess I'll have to check symbol looku= p again for >>this and see what makes most sense. lookup_minimal_symbol() does a 2 pass search over both the mangled and the = demangled names. If we end up comparing the demangled names, the name looku= p might be incorrect since we will not be comparing fully qualified names. >>> * In gdbtypes.h: >>> >>> 1817 >>> 1818 unsigned int is_trampoline : 1; >>> >>> Might be better to position this field as the 3rd field for better >>> structure packing ? >> >>The structure was poorly packed in the first place I think. We have the >>ENUM_BITFIELD in the beginning which can be either an enum or an unsigned >>int. I am not sure whether the size of an enum is defined somewhere but = I'd >>assume it is compiler dependent and usually the size of an int? >>This is followed by another unsigned int and then by two pointers. >> >>If we aimed at proper structure packing I'd assume the pointers (which wo= uld >>usually be 8 bytes to all come first, then the (unsigned) int's with thei= r (usually) >>4 bytes, followed finally by the enum? >> >>I considered this when implementing it but it seemed like an unrelated ch= ange to >>me. Assuming int is 4 bytes and we align to 8 bytes moving is_trampoline= to the >>3rd position would also not do anything, would it? We'd be at >> >>4 byte >>4 byte >>4 byte >>8 byte >>8 byte >>8 byte >> >>Instead of >> >>4 byte >>4 byte >>8 byte >>8 byte >>4 byte >>8 byte I think you missed taking the bitfields (is_noreturn and is_trampoline) int= o consideration. If these get placed together, they would be fitted into on= e int since both these are just 1 bit each. >> >>I think switching is_trampoline and self_trampoline_target would make the= most >>sense here? (without touching the other members). >> >>> * infrun.c: Line 7156: It might be better to have the '10' >>> representing the number of chained trampoline traversals allowed as a m= acro. >>> >> >>I also thought about this when implementing it. I back then decided agai= nst it >>but sure, I'll add that. Thanks, Jini. >> >>> A few nits below: >>> * infrun.c : Nits: >>> Line 7154: spelling: certian >>> Line 9941: spelling : fucntion >>> >>> *symtab.h: Nit: line 2247: spelling: wether >> >>Thanks! >>I'll change this in v2! >> >>> >>> Thanks, >>> Jini. >>> >>> >>-----Original Message----- >>> >>From: Gdb-patches >> >>bounces+jigeorge=3Damd.com@sourceware.org> On Behalf Of Nils- >>> Christian >>> >>Kempke via Gdb-patches >>> >>Sent: Thursday, July 7, 2022 5:46 PM >>> >>To: gdb-patches@sourceware.org >>> >>Subject: [PATCH 1/3] gdb: add support for DW_AT_trampoline in DWARF >>> reader >>> >> >>> >>[CAUTION: External Email] >>> >> >>> >>DW_AT_trampoline can be used to describe compiler generated >>> >>functions >>> that >>> >>serve some intermediary purpose on making a call to another >>> >>function. A compiler can emit this tag in order to help a debugger >>> >>hide the trampolines >>> from >>> >>a user. >>> >> >>> >>The attribute is only applicable to DW_TAG_subroutine and >>> >>DW_TAG_inlined_subroutines tags. It contains information about the >>> >>trampoline target either as a reference to its DIE, as its address >>> >>or its >>> name. >>> >>DW_AT_trampoline can also be a flag indicating that the DIE is a >>> >>trampoline >>> or >>> >>not but not specifying the target if it is unknown. >>> >> >>> >>This patch adds support to GDB for reading the DW_AT_trampoline >>> attribute. It >>> >>stores the attribute and its value in the type_specific part of a GDB= type. >>> This >>> >>patch is done in preparation of the following patches which will add >>> >>a mechanism to hide DW_AT_trampoline subroutines from the user. >>> >> >>> >>gdb/ChangeLog: >>> >>2022-05-22 Nils-Christian Kempke >>> >> >>> >> * dwarf2/read.c (read_subroutine_type): Read in DW_AT_trampol= ine. >>> >> * gdbtypes.c (print_trampoline_target_info): New helper metho= d. >>> >> (recursive_dump_type): Add trampoline info. >>> >> (copy_type_recursive): Copy trampoline info. >>> >> * gdbtypes.h (func_type): Add trampoline specific fields. >>> >> (trampoline_target_kind): New enum. >>> >> (trampoline_target): New struct for storing DW_AT_trampoline'= s >>> >> value. >>> >> (TYPE_IS_TRAMPOLINE): New define. >>> >> (TYPE_TRAMPOLINE_TARGET): New define. >>> >> >>> >>Signed-off-by: Nils-Christian Kempke >>> >> >>> >>--- >>> >> gdb/dwarf2/read.c | 43 ++++++++++++++++++++++++++ >>> >> gdb/gdbtypes.c | 31 +++++++++++++++++++ >>> >> gdb/gdbtypes.h | 79 >>> >>+++++++++++++++++++++++++++++++++++++++++++++++ >>> >> 3 files changed, 153 insertions(+) >>> >> >>> >>diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index >>> >>23fe5679cbd..7f80c31d051 100644 >>> >>--- a/gdb/dwarf2/read.c >>> >>+++ b/gdb/dwarf2/read.c >>> >>@@ -16491,6 +16491,49 @@ read_subroutine_type (struct die_info *die, >>> struct >>> >>dwarf2_cu *cu) >>> >> if (prototyped_function_p (die, cu)) >>> >> ftype->set_is_prototyped (true); >>> >> >>> >>+ /* If this is a trampoline function store it and its target here. >>> >>+ */ attr =3D dwarf2_attr (die, DW_AT_trampoline, cu); if (attr !=3D= nullptr) >>> >>+ { >>> >>+ CORE_ADDR baseaddr =3D objfile->text_section_offset (); >>> >>+ >>> >>+ TYPE_IS_TRAMPOLINE (ftype) =3D true; >>> >>+ TYPE_TRAMPOLINE_TARGET (ftype) >>> >>+ =3D (trampoline_target *) TYPE_ZALLOC (ftype, >>> >>+ sizeof >>> >>+ (trampoline_target)); >>> >>+ >>> >>+ /* A DW_AT_trampoline can be either an address, a flag, a >>> >>+ reference >>> or a >>> >>+ string. */ >>> >>+ if (attr->form_is_string ()) >>> >>+ TYPE_TRAMPOLINE_TARGET (ftype)->set_target_physname >>> >>+ (attr->as_string ()); >>> >>+ else if (attr->form_is_ref ()) >>> >>+ { >>> >>+ die_info *target_die; >>> >>+ dwarf2_cu *target_cu =3D cu; >>> >>+ >>> >>+ target_die =3D follow_die_ref (die, attr, &target_cu); >>> >>+ const char* target_name =3D dwarf2_name (target_die, target= _cu); >>> >>+ if (target_name =3D=3D nullptr) >>> >>+ { >>> >>+ complaint (_("DW_AT_trampoline target DIE has no name f= or" >>> >>+ "referencing DIE %s [in module %s]"), >>> >>+ sect_offset_str (die->sect_off), >>> >>+ objfile_name (objfile)); >>> >>+ } >>> >>+ TYPE_TRAMPOLINE_TARGET (ftype)->set_target_physname >>> >>(target_name); >>> >>+ } >>> >>+ else if (attr->form_is_unsigned ()) >>> >>+ TYPE_TRAMPOLINE_TARGET (ftype)->set_target_flag (attr- >>> >as_boolean ()); >>> >>+ else >>> >>+ { >>> >>+ CORE_ADDR target_addr =3D attr->as_address (); >>> >>+ target_addr =3D gdbarch_adjust_dwarf2_addr (objfile->arch (= ), >>> >>+ target_addr + bas= eaddr); >>> >>+ TYPE_TRAMPOLINE_TARGET (ftype)->set_target_physaddr >>> (target_addr); >>> >>+ } >>> >>+ } >>> >>+ >>> >> /* Store the calling convention in the type if it's available in >>> >> the subroutine die. Otherwise set the calling convention to >>> >> the default value DW_CC_normal. */ diff --git >>> >>a/gdb/gdbtypes.c b/gdb/gdbtypes.c index c8f98554859..66e04882d48 >>> >>100644 >>> >>--- a/gdb/gdbtypes.c >>> >>+++ b/gdb/gdbtypes.c >>> >>@@ -5205,6 +5205,31 @@ print_fixed_point_type_info (struct type >>> *type, int >>> >>spaces) >>> >> type->fixed_point_scaling_factor ().str ().c_str ()); >>> >>} >>> >> >>> >>+/* Print the contents of the TYPE's self_trampoline_target, >>> >>+assuming that >>> its >>> >>+ type-specific kind is TYPE_SPECIFIC_FUNC and is_trampoline is not= 0. >>> >>+*/ static void print_trampoline_target_info (struct type *type, int >>> >>+spaces) { >>> >>+ switch (TYPE_TRAMPOLINE_TARGET (type)->target_kind ()) >>> >>+ { >>> >>+ case TRAMPOLINE_TARGET_PHYSADDR: >>> >>+ gdb_printf ("%*starget physaddr: 0x%lx\n", spaces + 2, "", >>> >>+ TYPE_TRAMPOLINE_TARGET (type)->target_physaddr ()); >>> >>+ break; >>> >>+ case TRAMPOLINE_TARGET_PHYSNAME: >>> >>+ gdb_printf ("%*starget physname: %s\n", spaces + 2, "", >>> >>+ TYPE_TRAMPOLINE_TARGET (type)->target_physname ()); >>> >>+ break; >>> >>+ case TRAMPOLINE_TARGET_FLAG: >>> >>+ gdb_printf ("%*starget flag: %d\n", spaces + 2, "", >>> >>+ TYPE_TRAMPOLINE_TARGET (type)->target_flag ()); >>> >>+ break; >>> >>+ default: >>> >>+ gdb_assert_not_reached ("unhandled trampoline target kind"); >>> >>+ break; >>> >>+ } >>> >>+} >>> >>+ >>> >> static struct obstack dont_print_type_obstack; >>> >> >>> >> /* Print the dynamic_prop PROP. */ @@ -5531,6 +5556,10 @@ >>> >>recursive_dump_type (struct type *type, int >>> spaces) >>> >> gdb_printf ("%*scalling_convention %d\n", spaces, "", >>> >> TYPE_CALLING_CONVENTION (type)); >>> >> /* tail_call_list is not printed. */ >>> >>+ gdb_printf ("%*sis_trampoline %d\n", spaces, "", >>> >>+ TYPE_IS_TRAMPOLINE (type)); >>> >>+ if (TYPE_IS_TRAMPOLINE (type)) >>> >>+ print_trampoline_target_info (type, spaces); >>> >> break; >>> >> >>> >> case TYPE_SPECIFIC_SELF_TYPE: >>> >>@@ -5762,6 +5791,8 @@ copy_type_recursive (struct objfile *objfile, >>> >> TYPE_CALLING_CONVENTION (new_type) =3D >>> TYPE_CALLING_CONVENTION >>> >>(type); >>> >> TYPE_NO_RETURN (new_type) =3D TYPE_NO_RETURN (type); >>> >> TYPE_TAIL_CALL_LIST (new_type) =3D NULL; >>> >>+ TYPE_IS_TRAMPOLINE (new_type) =3D TYPE_IS_TRAMPOLINE (type); >>> >>+ TYPE_TRAMPOLINE_TARGET (new_type) =3D >>> TYPE_TRAMPOLINE_TARGET >>> >>+ (type); >>> >> break; >>> >> case TYPE_SPECIFIC_FLOATFORMAT: >>> >> TYPE_FLOATFORMAT (new_type) =3D TYPE_FLOATFORMAT (type); diff >>> >> -- >>> git >>> >>a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 7437e1db8ab..846de1289ad >>> 100644 >>> >>--- a/gdb/gdbtypes.h >>> >>+++ b/gdb/gdbtypes.h >>> >>@@ -1811,6 +1811,83 @@ struct func_type >>> >> contains the method. */ >>> >> >>> >> struct type *self_type; >>> >>+ >>> >>+ /* * For functions marked with the DW_AT_trampoline. These are >>> >>+ compiler generated wrappers that should be hidden from the us= er. >>> >>+ */ >>> >>+ >>> >>+ unsigned int is_trampoline : 1; >>> >>+ >>> >>+ struct trampoline_target *self_trampoline_target; }; >>> >>+ >>> >>+/* The kind of location held by this call site target. */ enum >>> >>+trampoline_target_kind >>> >>+ { >>> >>+ /* An address. */ >>> >>+ TRAMPOLINE_TARGET_PHYSADDR, >>> >>+ /* A (mangled) name. */ >>> >>+ TRAMPOLINE_TARGET_PHYSNAME, >>> >>+ /* An flag (target is unknown). */ >>> >>+ TRAMPOLINE_TARGET_FLAG, >>> >>+ }; >>> >>+ >>> >>+struct trampoline_target >>> >>+ { >>> >>+ trampoline_target_kind target_kind () const >>> >>+ { >>> >>+ return m_target_kind; >>> >>+ } >>> >>+ >>> >>+ void set_target_physaddr (CORE_ADDR physaddr) >>> >>+ { >>> >>+ m_target_kind =3D TRAMPOLINE_TARGET_PHYSADDR; >>> >>+ m_trampoline_target.physaddr =3D physaddr; >>> >>+ } >>> >>+ >>> >>+ CORE_ADDR target_physaddr () const >>> >>+ { >>> >>+ gdb_assert (m_target_kind =3D=3D TRAMPOLINE_TARGET_PHYSADDR); >>> >>+ return m_trampoline_target.physaddr; >>> >>+ } >>> >>+ >>> >>+ void set_target_physname (const char *physname) >>> >>+ { >>> >>+ m_target_kind =3D TRAMPOLINE_TARGET_PHYSNAME; >>> >>+ m_trampoline_target.physname =3D physname; >>> >>+ } >>> >>+ >>> >>+ const char *target_physname () const >>> >>+ { >>> >>+ gdb_assert (m_target_kind =3D=3D TRAMPOLINE_TARGET_PHYSNAME); >>> >>+ return m_trampoline_target.physname; >>> >>+ } >>> >>+ >>> >>+ void set_target_flag (bool flag) >>> >>+ { >>> >>+ m_target_kind =3D TRAMPOLINE_TARGET_FLAG; >>> >>+ m_trampoline_target.flag =3D flag; >>> >>+ } >>> >>+ >>> >>+ bool target_flag () const >>> >>+ { >>> >>+ gdb_assert (m_target_kind =3D=3D TRAMPOLINE_TARGET_FLAG); >>> >>+ return m_trampoline_target.flag; >>> >>+ } >>> >>+ >>> >>+ private: >>> >>+ >>> >>+ union >>> >>+ { >>> >>+ /* Address. */ >>> >>+ CORE_ADDR physaddr; >>> >>+ /* Mangled name. */ >>> >>+ const char *physname; >>> >>+ /* Flag. */ >>> >>+ bool flag; >>> >>+ } m_trampoline_target; >>> >>+ >>> >>+ /* * Discriminant for union m_trampoline_target. */ >>> >>+ ENUM_BITFIELD (trampoline_target_kind) m_target_kind : 2; >>> >> }; >>> >> >>> >> /* struct call_site_parameter can be referenced in callees by >>> >> several >>> ways. */ >>> >>@@ -2172,6 +2249,8 @@ extern void set_type_vptr_basetype (struct >>> type *, >>> >>struct type *); #define TYPE_CALLING_CONVENTION(thistype) >>> >>TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff- >>> >calling_convention >>> >> #define TYPE_NO_RETURN(thistype) TYPE_MAIN_TYPE(thistype)- >>> >>>type_specific.func_stuff->is_noreturn >>> >> #define TYPE_TAIL_CALL_LIST(thistype) TYPE_MAIN_TYPE(thistype)- >>> >>>type_specific.func_stuff->tail_call_list >>> >>+#define TYPE_IS_TRAMPOLINE(thistype) >>> >>+TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->is_trampoline >>> >>+#define TYPE_TRAMPOLINE_TARGET(thistype) >>> >>+TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff- >>> >self_trampoline_tar >>> >>+get >>> >> #define TYPE_BASECLASS(thistype,index) ((thistype)->field >>> >> (index).type >>> ()) >>> >>#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)- >>> >>>n_baseclasses >>> >> #define TYPE_BASECLASS_NAME(thistype,index) (thistype->field >>> (index).name ()) >>> >>-- >>> >>2.25.1 >>> >> >>> >>Intel Deutschland GmbH >>> >>Registered Address: Am Campeon 10, 85579 Neubiberg, Germany >>> >>Tel: +49 89 99 8853-0, >>> >>https://nam11.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fw >>> ww.int >>> >>el.de%2F&data=3D05%7C01%7CJiniSusan.George%40amd.com%7C9c3f >>> 28b5 >>> >>>>98cf49f888f908da601272a0%7C3dd8961fe4884e608e11a82d994e183d%7C0 >>> %7 >>> >>C0%7C637927929632561872%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC >>> 4wLj >>> >>AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C >>> %7C >>> >>%7C&sdata=3DMBaQ7XpSZ4XFO963dnxF%2Fy1PD0gcx6k%2FjdaifxoSUa >>> Y%3D >>> >>&reserved=3D0 >>> >>>> ww.in >>> >>tel.de%2F&data=3D05%7C01%7CJiniSusan.George%40amd.com%7C9c3 >>> f28b5 >>> >>>>98cf49f888f908da601272a0%7C3dd8961fe4884e608e11a82d994e183d%7C0 >>> %7 >>> >>C0%7C637927929632561872%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC >>> 4wLj >>> >>AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C >>> %7C >>> >>%7C&sdata=3DMBaQ7XpSZ4XFO963dnxF%2Fy1PD0gcx6k%2FjdaifxoSUa >>> Y%3D >>> >>&reserved=3D0> >>> >>Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon >>> >>Silva Chairperson of the Supervisory Board: Nicole Lau Registered Off= ice: >>> Munich >>> >>Commercial Register: Amtsgericht Muenchen HRB 186928 >> >>Intel Deutschland GmbH >>Registered Address: Am Campeon 10, 85579 Neubiberg, Germany >>Tel: +49 89 99 8853-0, >>https://nam11.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fwww.in= t >>el.de%2F&data=3D05%7C01%7CJiniSusan.George%40amd.com%7Cd62c3e20 >>92aa47098d9908da64c720a7%7C3dd8961fe4884e608e11a82d994e183d%7C0% >>7C0%7C637933103654397897%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wL >>jAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C >>%7C&sdata=3DSqOet8GRTDgMHyLH9TKkvnaiK1N0AO1NQG09Pln8iJQ%3D&a >>mp;reserved=3D0 >>>tel.de%2F&data=3D05%7C01%7CJiniSusan.George%40amd.com%7Cd62c3e2 >>092aa47098d9908da64c720a7%7C3dd8961fe4884e608e11a82d994e183d%7C0 >>%7C0%7C637933103654397897%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4 >>wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C >>%7C%7C&sdata=3DSqOet8GRTDgMHyLH9TKkvnaiK1N0AO1NQG09Pln8iJQ%3 >>D&reserved=3D0> >>Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva >>Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munic= h >>Commercial Register: Amtsgericht Muenchen HRB 186928