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 D452B385840C for ; Tue, 12 Apr 2022 08:38:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D452B385840C ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m4n2VUlp+u9xaBAIxJaUggedvuRlHoFdjxzUsNYy609dqdyhhLyD4C/AW1rAQybVVikgjjLuvDlOImbayG5TxaSbBm+hCRRWadDjQfwt/rDSzrSq6jKWQxjfvaLWldGOVT4WZrNsdxHr/I9JnFu0z76BKTunTfcL2ocwITomfqBFG6KG/txE6Enu8fmkAvh703J9hzKLf1Ytcn60nfXe1wICPu4Yc1kGOdyKbVvsDY1sjqKNoTL0Jfhd6EmWvH6gBEnrBkpo4VbxqqXN5jGlZbVOB+enUsapvjT3VyOt1SgNYMgR35r0C1fHkxo7NtmnadqwsGiXQj0pjsG/RJJWMQ== 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=Zfe6g+0WiTqASpal7vS3K3rOYj5+SPcFml3OGNAhmig=; b=cozekpdYxpm1SxZ/X9NceS+60T5FIlydEI3xCwJaHnjy/+nx9js/+NIthCEUb7L/V8iaQ70Zu+qHRKV1kVSdSZ+efluQUBukARHpyyXyhLunH3msw8p/llLtoh8Njvd4aQCX3bR5VKsFL864zF16fvCeeCblSr4qQUAYZZvSEggk5GbUWU2Bw5S+IiyPEkcbRmghqWaqqzvPtxqM4Kl3rTcyB4W/QYr6zhEHBOSY01obnTBbN2fPc4dpz0XwkAmDCHtDpRKmmk6FGgt0V9dmFS3glKUtucpohzE0qQxwCNvctWKvRjP2gaBdGM9qdOxlWFQ62MrdANcUwL7iBTZ4xw== 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 DM4PR12MB5796.namprd12.prod.outlook.com (2603:10b6:8:63::16) by PH7PR12MB5854.namprd12.prod.outlook.com (2603:10b6:510:1d5::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Tue, 12 Apr 2022 08:38:20 +0000 Received: from DM4PR12MB5796.namprd12.prod.outlook.com ([fe80::c1c5:fe5b:5a50:ba4d]) by DM4PR12MB5796.namprd12.prod.outlook.com ([fe80::c1c5:fe5b:5a50:ba4d%8]) with mapi id 15.20.5144.022; Tue, 12 Apr 2022 08:38:19 +0000 From: "Natarajan, Kavitha" To: Bruno Larsen , "Natarajan, Kavitha via Gdb-patches" CC: "George, Jini Susan" , "Parasuraman, Hariharan" Subject: RE: [PATCH] Debug support for global alias variable Thread-Topic: [PATCH] Debug support for global alias variable Thread-Index: Adgvx/KC9Ls2FcnvTJeRu5jcNWYisQPvqNcAAMR4mPAAN0esgAApFU6QAAWQfSABMF/PAAFPj4SA Date: Tue, 12 Apr 2022 08:38:19 +0000 Message-ID: References: <66ca57f9-c3b8-4aeb-f07c-c3c254dfdea6@redhat.com> <9e6ccf35-6045-2db6-b37b-bb8e73967bda@redhat.com> In-Reply-To: <9e6ccf35-6045-2db6-b37b-bb8e73967bda@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_ActionId=d32ca872-ae8f-4ac5-a849-66fdf3994f1a; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_ContentBits=0; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Enabled=true; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Method=Standard; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Name=AMD Official Use Only-AIP 2.0; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SetDate=2022-04-12T05:41:12Z; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 27f8c63c-6385-4cd3-9ca8-08da1c5fcc36 x-ms-traffictypediagnostic: PH7PR12MB5854:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: AUBpFfWi1YMMwcYa9qlYAZ6bkNNYITG9g+QBH0xj57yyL6NfQqr6Y2QHlYv3DQIVjhK5v73KDrmh+phDG39N60d42tXXfZM3Nlt3fR5/1IwCweWPRWGOfIT8rMYpA+GbN3ZRaAHmgVLPHBlYPLVzJPI+CcirvhjM4GQGBFFzd6QIqlNT+OMElIKbzMxAR6z58nMGbOZqpYDP+tdvrhRDeyBi6zZJu+J/E2biBCVgUyz0Tsxz2sNl3kxkyI2hwCid7hPkAn1Zwa+MV/QZ6oWnc6HZYYG0C5Na1Z8P2WdA3/osoJrY9qnz9pbt52YnNG72gobZ7SAaSQ4Y/gOaXWvjPtRwnms63Z7JFCpMzKwmICr6LClaHEHMLIXhU1LVtRN72u5omLbm3v4D1Us62Q/siWLkb2jw7JRrHeIl36YEvcvpC+leOge91LGKUy+AO39QVOPrQrE1FtN6O+Oe5tqnE7AW+xtmxmuN83CmsSNPYiXcEt/cYSpGZFXaoelIn8xTXrDBqmXYueJ0rS0oto5R4jbbo/2XZaO+yeAf7dRlmuWW/UNePz+pH9+H4jrHdfaioXaAkohVvZDQWrY49VCRKA+h3y+hG9Jnz1UVIkKKtq/sIio1EZuio4tni85ryNrHy1+J1RtqZzE3GGkDY42mAAbtNUv30voaxh5kbzRCNePxEHQK21Hj9cGgjPgTNHFuFsGrjmcFsA2BfEaqVLo76SYT5g9NhO6yyb+ahVVoSUZOLvGTyFuhFB+Ni2pVlHz/1AVfIdpbfDwoP6enRZrB7Rg6KxY6psBTXLNBoA5/nfxJT5jU/mzBWGcb8H2lDCA7+ocbts/jRTYm8Etmp3bktQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5796.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(7696005)(53546011)(6506007)(2906002)(5660300002)(33656002)(86362001)(38100700002)(54906003)(316002)(76116006)(8676002)(66946007)(4326008)(66556008)(38070700005)(66476007)(71200400001)(110136005)(64756008)(66446008)(122000001)(966005)(30864003)(8936002)(52536014)(83380400001)(26005)(186003)(55016003)(9686003)(508600001)(84970400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?2TN6ppKnslF7iIbUqctOV8LBR5yGxDAo4xXmlyfa+NbC5pat4JBGiDfAbGru?= =?us-ascii?Q?2hW7ff+LSBwyGNEdyKKJfZNbO5IEskzZtlEvkn7Ps+6TB08xYUDMfjAOoVit?= =?us-ascii?Q?/hJbr4geEzLU6fydnlo1xM8vdmoAhky/k4O7xfrXL3dvLxEFySN7aeMhIS4Q?= =?us-ascii?Q?FrP2p609G19KZ12UZdNtLgonx1K5j0yiiV0wXp8Qzn6SVTpGxvU4jHICM9rs?= =?us-ascii?Q?enLQr6JjVXYFAz5/PUzan3kThpqPcwHsok4UPw9IJ1rwU8n6Rb4TmtqbjrM3?= =?us-ascii?Q?fyzQ9M32xGPsEkepvUHK//TyDfQFMoxtYT5tVIYebz9LpJOu9pKsJ0jXU8NF?= =?us-ascii?Q?zVnwRcdYx2YAZGhliUt8/5guom4OwdExyDeHTjN1pfMnOINC3zVhUsc4byjG?= =?us-ascii?Q?kOPhQPhJ9sdHP33TQTL1aC/tpax9sNQkLEXt0t9TntRZzmfP8FBsPhDGVjgt?= =?us-ascii?Q?0oekUqyI7Nj2fQGnP2iKkw5c4U7UlNP/GMuTf7RNV+UY9gPBXq+WKXbkWYnH?= =?us-ascii?Q?/TCWv8h9wl+AmtPhxYJ0ahohVM0s6nPmVA3WfXXeN06Sqwr1zz6581qVrTOj?= =?us-ascii?Q?cy5tFX+sB3SgFvAnXgBFmYy9tiG+D/668ZxKvdHGgYXIqXOlpjFbBQjNmYhK?= =?us-ascii?Q?hhLn6ZfJapvuMwzpR+AjX8lzChiCZGBoMCF35k17WRtUuSrKGDWB2gGQHVbJ?= =?us-ascii?Q?j43goXhfVJyISrbfNiOn5QEWH8ktw+dXb+vpYnynfnqK7vaFjP+MFTNDgatK?= =?us-ascii?Q?eQn3Ll8i/2sOzywvlhGlIMPlgVSN6cY6SkfN6ziwpbqw/T2bXCeAOIxxJ8ut?= =?us-ascii?Q?g+q5K1j4SExe12HV86VZYTlLxEKi7avw6O4zCyLtMP7I7r+klglmwGladw+w?= =?us-ascii?Q?rkh98gH9Gq4f5Kbp4SEn/RyFb5yMh6xEXPaAZhTrGrQsppcp+PsDVsLNMb/c?= =?us-ascii?Q?bCcn/NV7fFA4f9RNkmaJcBybjLnWtkP5t/Y7GuXSM/l+FnGdAE/brctRGKfv?= =?us-ascii?Q?9R5oE6IVWO/4BnJ3hn/pnfy3VpnkWREVLSn0MuTODrQ4JMOcO9hRNEgBa8GT?= =?us-ascii?Q?PVBU7/uMusbQmZCiSUoc4r0+KogAk101quGxq/vjav7Jtey+yN8q+IS/78GT?= =?us-ascii?Q?OffnjOS+1BbsRc9eYg1/Iy8KOa73xj39zZet0SSSgfqj4mQuT5GHc9voqOon?= =?us-ascii?Q?ZuYAHdeiG5KsYFYwAC/k4m+tFrLpyq88IqYDpa0A5nnyCGgDo+QkzXLG/FmK?= =?us-ascii?Q?2MdEJG3H/erMvQuabT+dm0/h6quvLm4/shAw8/MdODbHebB1tl5x8ghabNqI?= =?us-ascii?Q?dOvKJTq2Gpl4RLzLv9884/+jEm+ZEP82F/mpBC+51GcOPAXYHPIWlVPqUwbm?= =?us-ascii?Q?p77OjSfHbAibhq4d1eN6qvW5Yto4KgEQJ4e/8dtAIrRcjr1cS/tBp9v/wPLv?= =?us-ascii?Q?qdZPD3QkYL/nYwlP+lPhKjP4gVjguHhW/9pK21Vds3xFiNPCTqrwfquTZLTv?= =?us-ascii?Q?i0poGj/WZmVMouSlkCAJ48C750SBIau3Dmwa3iHsgNIfxqlW++5GTyKe9rbj?= =?us-ascii?Q?vUSiXV7PCKR/PC/ilm23oeVs8cAYMzXxqCnFi1vZU4ZfhbufNhhrO355Aqwk?= =?us-ascii?Q?a8vSxN5RgEdrwBWXFYavTrCM0jklTm6oKsrmpfyMnOQAGJNm+7VLMmbVFEaE?= =?us-ascii?Q?FgbAv7eGUzsCW8a9/LCLQF8+9uFWAii5qo3xHMnrkHPzECdthZNqs/DNowkv?= =?us-ascii?Q?jBn/Saxiog=3D=3D?= 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: DM4PR12MB5796.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27f8c63c-6385-4cd3-9ca8-08da1c5fcc36 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2022 08:38:19.8386 (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: MD1UoIdUL0gda1LN6pY3+h2Sjcz9/Z+4f/7mCVbTUzTpGArXoxj6hiKxfXvwA+V5qMnWKAX1dDPXwH6BJdw3eQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5854 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Tue, 12 Apr 2022 08:38:26 -0000 [AMD Official Use Only] The clang patch that generate the dwarf debug info for global alias variabl= e is committed to https://github.com/llvm/llvm-project =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D commit b1ea0191a42074341847d767609f66a26b6d5a41 Author: Kavitha Natarajan Date: Mon Mar 7 12:45:52 2022 +0530 [clang][DebugInfo] Support debug info for alias variable clang to emit DWARF information for global alias variable as DW_TAG_imported_declaration. This change also handles nested (recursive) imported declarations. Reviewed by: dblaikie, aprantl Differential Revision: https://reviews.llvm.org/D120989 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The clang trunk should be generating DIE for alias variable as DW_ AT_impor= ted_declaration. Awaiting approval for gdb patch. Thanks, Kavitha > -----Original Message----- > From: Bruno Larsen > Sent: Tuesday, April 5, 2022 7:03 PM > To: Natarajan, Kavitha ; Natarajan, Kavitha > via Gdb-patches > Cc: George, Jini Susan ; Parasuraman, > Hariharan > Subject: Re: [PATCH] Debug support for global alias variable > > [CAUTION: External Email] > > On 3/30/22 09:25, Natarajan, Kavitha wrote: > > [AMD Official Use Only] > > > > Sorry, I missed to send the new patch. Please find it below: > > Sorry for the delay on the response. > > I only noticed one small nit in a comment. Like I said before, can't appr= ove for > pushing, but it LGTM. > > > > > --------------------------------------------------------------------- > > When clang emits the dwarf information of global alias variable as > > DW_TAG_imported_declaration, gdb does not handle it. GDB reads this > > tag as C++/fortran imported declaration (type alias, namespace alias > > and fortran module). Added support to handle this tag as alias > > variable. > > > > This change fixes the failure in gdb.base/symbol-alias.exp testcase. > > This testcase is also updated to test nested (recursive) alias. > > --- > > gdb/dwarf2/read.c | 75 +++++++++++++++++-------= - > > gdb/testsuite/gdb.base/symbol-alias.exp | 63 ++++++++++++++++++++- > > gdb/testsuite/gdb.base/symbol-alias2.c | 16 ++++++ > > 3 files changed, 128 insertions(+), 26 deletions(-) > > > > diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index > > f9c942d91d3..12d66378f79 100644 > > --- a/gdb/dwarf2/read.c > > +++ b/gdb/dwarf2/read.c > > @@ -1132,6 +1132,10 @@ static void add_partial_subprogram (struct > partial_die_info *pdi, > > CORE_ADDR *lowpc, CORE_ADDR *highp= c, > > int need_pc, struct dwarf2_cu > > *cu); > > > > +static void var_decode_location (struct attribute *attr, > > + struct symbol *sym, > > + struct dwarf2_cu *cu); > > + > > static unsigned int peek_abbrev_code (bfd *, const gdb_byte *); > > > > static struct partial_die_info *load_partial_dies @@ -1332,7 +1336,7 > > @@ static struct using_direct **using_directives (struct dwarf2_cu > > *cu); > > > > static void read_import_statement (struct die_info *die, struct > > dwarf2_cu *); > > > > -static int read_namespace_alias (struct die_info *die, struct > > dwarf2_cu *cu); > > +static bool read_alias (struct die_info *die, struct dwarf2_cu *cu); > > > > static struct type *read_module_type (struct die_info *die, > > struct dwarf2_cu *cu); @@ > > -9741,10 +9745,14 @@ process_die (struct die_info *die, struct dwarf2_c= u > *cu) > > read_module (die, cu); > > break; > > case DW_TAG_imported_declaration: > > + /* If the imported declaration is for global variable alias, > > + this flag is set to false in read_alias function. */ > > cu->processing_has_namespace_info =3D true; > > - if (read_namespace_alias (die, cu)) > > + if (((cu->per_cu->lang =3D=3D language_c) > > + || (cu->per_cu->lang =3D=3D language_cplus)) > > + && read_alias (die, cu)) > > break; > > - /* The declaration is not a global namespace alias. */ > > + /* The declaration is not a global namespace or variable alias. > > + */ > > /* Fall through. */ > > case DW_TAG_imported_module: > > cu->processing_has_namespace_info =3D true; @@ -10212,18 > > +10220,21 @@ dwarf2_physname (const char *name, struct die_info *die, > struct dwarf2_cu *cu) > > return retval; > > } > > > > -/* Inspect DIE in CU for a namespace alias. If one exists, record > > - a new symbol for it. > > +#define MAX_NESTED_IMPORTED_DECLARATIONS 100 > > > > - Returns 1 if a namespace alias was recorded, 0 otherwise. */ > > +/* Inspect DIE in CU for a namespace alias or a variable > > + with alias attribute. If one exists, record a new symbol > > + for it. > > > > -static int > > -read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu) > > + Returns "true" if an alias was recorded, "false" otherwise. */ > > + > > +static bool > > +read_alias (struct die_info *die, struct dwarf2_cu *cu) > > { > > struct attribute *attr; > > > > - /* If the die does not have a name, this is not a namespace > > - alias. */ > > + /* If the die does not have a name, this is not a namespace alias > > + or variable alias. */ > > attr =3D dwarf2_attr (die, DW_AT_name, cu); > > if (attr !=3D NULL) > > { > > @@ -10232,13 +10243,12 @@ read_namespace_alias (struct die_info *die, > struct dwarf2_cu *cu) > > struct dwarf2_cu *imported_cu =3D cu; > > > > /* If the compiler has nested DW_AT_imported_declaration DIEs, > > - keep inspecting DIEs until we hit the underlying import. */ > > -#define MAX_NESTED_IMPORTED_DECLARATIONS 100 > > + keep inspecting DIEs until we hit the underlying import. */ > > This comment still has 8 spaces instead of a tab. You must have missed it= on > your pass. > > > for (num =3D 0; num < MAX_NESTED_IMPORTED_DECLARATIONS; > ++num) > > { > > attr =3D dwarf2_attr (d, DW_AT_import, cu); > > if (attr =3D=3D NULL) > > - break; > > + return false; > > > > d =3D follow_die_ref (d, attr, &imported_cu); > > if (d->tag !=3D DW_TAG_imported_declaration) @@ -10249,26 > > +10259,43 @@ read_namespace_alias (struct die_info *die, struct > dwarf2_cu *cu) > > { > > complaint (_("DIE at %s has too many recursively imported " > > "declarations"), sect_offset_str (d->sect_off))= ; > > - return 0; > > + return false; > > } > > > > if (attr !=3D NULL) > > { > > struct type *type; > > - sect_offset sect_off =3D attr->get_ref_die_offset (); > > - > > - type =3D get_die_type_at_offset (sect_off, cu->per_cu, cu- > >per_objfile); > > - if (type !=3D NULL && type->code () =3D=3D TYPE_CODE_NAMESPAC= E) > > + if (d->tag =3D=3D DW_TAG_variable) > > { > > - /* This declaration is a global namespace alias. Add > > - a symbol for it whose type is the aliased namespace. = */ > > - new_symbol (die, type, cu); > > - return 1; > > + /* This declaration is a global variable alias. Add > > + a symbol for it whose type is same as aliased variable= . */ > > + type =3D die_type (d, imported_cu); > > + struct symbol *sym =3D new_symbol (die, type, cu); > > + attr =3D dwarf2_attr (d, DW_AT_location, imported_cu); > > + sym->set_aclass_index (LOC_UNRESOLVED); > > + if (attr !=3D nullptr) > > + { > > + var_decode_location (attr, sym, cu); > > + } > > + /* Reset the flag as it is not a namespace alias. */ > > + cu->processing_has_namespace_info =3D false; > > + return true; > > + } > > + else > > + { > > + sect_offset sect_off =3D attr->get_ref_die_offset (); > > + type =3D get_die_type_at_offset (sect_off, cu->per_cu, cu= - > >per_objfile); > > + if (type !=3D NULL && type->code () =3D=3D TYPE_CODE_NAME= SPACE) > > + { > > + /* This declaration is a global namespace alias. Add > > + a symbol for it whose type is the aliased namespac= e. */ > > + new_symbol (die, type, cu); > > + return true; > > + } > > } > > } > > } > > - > > - return 0; > > + return false; > > } > > > > /* Return the using directives repository (global or local?) to use > > in the diff --git a/gdb/testsuite/gdb.base/symbol-alias.exp > > b/gdb/testsuite/gdb.base/symbol-alias.exp > > index 2b53cc31053..a9487b25f4d 100644 > > --- a/gdb/testsuite/gdb.base/symbol-alias.exp > > +++ b/gdb/testsuite/gdb.base/symbol-alias.exp > > @@ -15,6 +15,9 @@ > > # along with this program. If not, see > w.gnu.org%2Flicenses%2F&data=3D04%7C01%7Ckavitha.natarajan%40am > d.com%7Cee7adda17f644c3ff44c08da1708d555%7C3dd8961fe4884e608e11a8 > 2d994e183d%7C0%7C0%7C637847623963520029%7CUnknown%7CTWFpbGZs > b3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn > 0%3D%7C3000&sdata=3DBiRp7rTFWbGY0AMXSmyy02d5uZwi4P52GJEjiRkb > g0E%3D&reserved=3D0>. > > > > standard_testfile symbol-alias.c symbol-alias2.c > > +set using_clang [test_compiler_info clang-*] set old_clang [expr > > +[test_compiler_info {clang-1[0-3]-*-*}] \ > > + || [test_compiler_info {clang-[1-9]-*}]] > > > > if { [prepare_for_testing "failed to prepare" ${testfile} [list $srcf= ile > $srcfile2]] } { > > return -1 > > @@ -31,6 +34,62 @@ foreach f {"func" "func_alias"} { > > } > > > > # Variables. > > -foreach v {"g_var_s" "g_var_s_alias"} { > > - gdb_test "p $v" "=3D {field1 =3D 1, field2 =3D 2}" > > +gdb_test "p g_var_s" "=3D {field1 =3D 1, field2 =3D 2}" > > +foreach v {"g_var_s_alias" "g_var_s_alias2"} { > > + gdb_test_multiple "p $v" "p $v" { > > + -re " =3D {field1 =3D 1, field2 =3D 2}.*$gdb_prompt $" { > > + pass "print alias of variable $v" > > + } > > + -re ".*has unknown type; cast it to its declared type.*$gdb_pr= ompt $" > { > > + if { $old_clang } { > > + xfail "print alias variable $v" > > + } else { > > + fail "print alias variable $v" > > + } > > + } > > + } > > +} > > + > > +# Static Variable. > > +gdb_test "p g_var" " =3D 1" > > +gdb_test_multiple "p g_var_alias" "p g_var_alias" { > > + -re " =3D 1.*$gdb_prompt $" { > > + pass "print alias of static variable" > > + } > > + -re ".*has unknown type; cast it to its declared type.*$gdb_promp= t $" { > > + if { $old_clang } { > > + xfail "print alias of static variable" > > + } else { > > + fail "print alias of static variable" > > + } > > + } > > +} > > + > > +# Deferred Variable. > > +gdb_test "p g_def_var" " =3D 2" > > +gdb_test_multiple "p g_def_var_alias" "p g_def_var_alias" { > > + -re " =3D 2.*$gdb_prompt $" { > > + pass "print alias of deferred variable" > > + } > > + -re ".*has unknown type; cast it to its declared type.*$gdb_promp= t $" { > > + if { $using_clang } { > > + xfail "print alias of deferred variable" > > + } else { > > + fail "print alias of deferred variable" > > + } > > + } > > +} > > + > > +# Alias of deferred Variable alias. > > +gdb_test_multiple "p g_def_var2_alias2" "p g_def_var2_alias2" { > > + -re " =3D 3.*$gdb_prompt $" { > > + pass "print alias of alias of deferred variable" > > + } > > + -re ".*has unknown type; cast it to its declared type.*$gdb_promp= t $" { > > + if { $old_clang } { > > + xfail "print alias of alias of deferred variable" > > + } else { > > + fail "print alias of alias of deferred variable" > > + } > > + } > > } > > diff --git a/gdb/testsuite/gdb.base/symbol-alias2.c > > b/gdb/testsuite/gdb.base/symbol-alias2.c > > index 34f4e121e25..41d4b6a53e5 100644 > > --- a/gdb/testsuite/gdb.base/symbol-alias2.c > > +++ b/gdb/testsuite/gdb.base/symbol-alias2.c > > @@ -23,6 +23,8 @@ struct S > > > > struct S g_var_s =3D { 1, 2 }; > > > > +static int g_var =3D 1; > > + > > #ifdef __cplusplus > > /* So that the alias attribute below work without having to figure ou= t > > this function's mangled name. */ @@ -38,3 +40,17 @@ func (void) > > struct S *func_alias (void) __attribute__ ((alias ("func"))); > > > > extern struct S g_var_s_alias __attribute__ ((alias ("g_var_s"))); > > + > > +extern struct S g_var_s_alias2 __attribute__ ((alias > > +("g_var_s_alias"))); > > + > > +extern int g_var_alias __attribute__ ((alias ("g_var"))); > > + > > +extern int g_def_var_alias __attribute__ ((alias ("g_def_var"))); > > + > > +int g_def_var =3D 2; > > + > > +extern int g_def_var2_alias __attribute__ ((alias ("g_def_var2"))); > > + > > +int g_def_var2 =3D 3; > > + > > +extern int g_def_var2_alias2 __attribute__ ((alias > > +("g_def_var2_alias"))); > > -- > > > > Regards, > > Kavitha > > > -- > Cheers! > Bruno Larsen