From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2046.outbound.protection.outlook.com [40.107.220.46]) by sourceware.org (Postfix) with ESMTPS id 7E0A53858C27 for ; Tue, 5 Apr 2022 14:02:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7E0A53858C27 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FAdogRNE0F9azxk4DqSd7+05n3frXg7AU3ThelXO2nGXnGJW+eljJJuHj5pFbkkvlrMLBrxiJeJt4dkMrh91shQfIdEK5oNTtcHeNIi05fDxZ+KY5nOcJqexlBBjO1sGi6hz0YJNqYdU6Z6LhIo8Ggbgx92hiKu/xwkdsbmhkdQ94X3eonS23aaPRKImxfiVyzfkzmlcMRDHS140CUw2Cs0UC5npFd/5rhUt/aBPNuW91aN4HhFgEx7O176GKj4ps90o3yCs+7GH/5HcyIDxadWcSkdksz4Lz3NFNrzTEXwo5GlY6HO4CK9b/ndZZ/zX4fDLvOplHV/TnT7DlJnRYQ== 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=D2EAHBNd7kN9Oswya4ZU+hqyuegwzFQ/6DBVijCCwgg=; b=Hy9IxB1QWifgfOH0Mm29L/8MwN5zmtkoCdykNyIsaKjF7uUjM7aZ4lWSNekbj+uHcNDn0TH4WSH8SoBtkDYUQ/vxECeoHxl55jfXeGF35fonC5XsSrbGfuCXY02LyXygaSjOZsy+Z4KzBqWrPbB8pCHyrHBdux9UKUrFe0e4H8WTd4P9ZPUbEanTit1C1DCmaQF7QPXD0cubIHjyXCmw5PZ+zXpe/keUGQuYLSc1oRoeO7zirWmFlZFX1OpIV5qiNUSzoEz1wnQhwEh1+qshN6W/hkppUxEcNHbS09PdVP6bwPym4dgFBIWU3AAssywpHxqN9EqO4w51Xl0uJ/RWLw== 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 BYAPR12MB3208.namprd12.prod.outlook.com (2603:10b6:a03:13b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31; Tue, 5 Apr 2022 14:02:54 +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.5123.030; Tue, 5 Apr 2022 14:02:54 +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/PAAAAR9Iw Date: Tue, 5 Apr 2022 14:02:54 +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-Mentions: blarsen@redhat.com X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_ActionId=639fa1f4-125d-461b-a66b-ad8d1a292d1e; 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-05T13:41:05Z; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9072aa54-2a5b-4471-d951-08da170cfb15 x-ms-traffictypediagnostic: BYAPR12MB3208: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: yNqHWqqseUftGXO4F2EnMghjmB5gbb7afuyubRC9iW8cwIeF13Lzt//opvrUSmpRHI5ACHc10mXBKNcNt7o0G4AW1EU6kgq75ms7AvWdAi2hVcSfWOAjDciCqAO3RutHs1ubazLcdyDYwYYYXXasq0m/o39z5mFKMXgFKyxomZaOlqIeEDR8OpWB3MS8AJpvuWE6BYb5W/RQx8OrnEXMfv3cVcC8w674uH+1HHLgCjNTmfPi/wGwbbYcidGHDxvUb7AK0PI22vDjaJKBPDDxQJfZ5ovOLziRhw/FhIO2EAvCJmGU8xpf1+G12SZlsC3XDsx0TSbhKvyBgkYS1M7WSy8v4WYDvnNTdPPy4GBH+BpOf4PUBukJPmzwXAfCtkE+0tU9db8K8YsdJffFYmaBVp0LysZENt4ABHFM7GEjje74OixfyECtSUixa04uHReqCLUjb5fEnCnHWS+MJDZCq9zcRYenM047AW4LBfsnDNxOS5Rj1PHpy5FdBYsTE2FOjtRuBvCLR7A07fHDdYJRhVNHnuDCvxq2pdIjUeCfinZgUCDbSxq1lv8hYSnirniEd1CmD7GqkG3qcfUQVZwkhtRON5zo3DRlB120fv4y1h8gCuTEWI6Gc8wgSDB1w1ECtW3qE8yHiesNxmbJtSr7pjnuDz/lZeTuC8RAy0oe+wvgIhvNIbw0Mmc5DFcn6Qnqqo16CetLekdbu9N5iVC0Gg0nallixjVo638yDSCVfoGVRYeyZfGa4nFdV+DpZvN+xfdRWFqhlxwdzMDCLOjiaMeiC3HcRRrAoUe8Siby+FkT0x+BwwfXuE31YBoVxaPj0i7OUuMpxCWwPhP9ObL6JSuBagjDNXSQL7QNVjqWqz4= 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)(84970400001)(2906002)(9686003)(76116006)(508600001)(66476007)(64756008)(66446008)(66946007)(66556008)(86362001)(5660300002)(52536014)(186003)(33656002)(53546011)(7696005)(4326008)(6506007)(8676002)(26005)(30864003)(83380400001)(8936002)(110136005)(54906003)(122000001)(38070700005)(71200400001)(38100700002)(316002)(55016003)(443494004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?u8ZfoBPeMNhH64KJZIOqUZc2Ht0m8tBWgL7QA0IffzIE8hf2LOF5ZAD3NJvb?= =?us-ascii?Q?EvqrJ3iMwgelqEmfHvclQRn5wrLc77o3doqQE5qUQoMYNg9IKC3+LFthTSED?= =?us-ascii?Q?SawNPM6YD8sRvglFcVAmYBrtxmqnLLYUR3JWmxmnpwBnzYyKNpofcjxu5SQu?= =?us-ascii?Q?JXgorkAAVW66+nPd5VLHXoxWQleD6Ff8sqbNhqoQR4xBu2MdQ+AWyEUbbmV8?= =?us-ascii?Q?TA+t8N4DnYPkfJB/OdJG1QpjdfUN4zSPfMUisFO3SDdihRIIRem4RuISoZAU?= =?us-ascii?Q?/Ia4v9A7GpAIpXtaN56qDrofbMemU15Of01+ONwbzZTQwUSE/X93ismCVmSx?= =?us-ascii?Q?GFoQelPigOgy0r/jC5gMKDAwWGrn/uBhuT7YypHbavkiRISQs5393EgGj7nn?= =?us-ascii?Q?ztpWviIa8gJT+x3Ul+33C4i6bdHO7BBwM7+yHIM6eMGGFKRB+JEfkUqJqWng?= =?us-ascii?Q?nk7J/0fQcEmmEujilItTBsCV7gwWPOATWWTdTNvmk6yHb/q71c1ywKLDb6Ec?= =?us-ascii?Q?8szx/z5UOAwgsk/EFi8MK4wA2MAPh6J2TfYU7O+DHAYsZp1MqXIj7grfQyYT?= =?us-ascii?Q?kLV5yncz48dYPINPjAuf3YcLbHNLwuQwHnavj3f3Pxb4ksGfjyyRroSdlkal?= =?us-ascii?Q?HjT4oZeATkvhge7RRI54ORO/Ezvcsd7k99NMijdJRb1Fnm1zFpxN0CW8HkDq?= =?us-ascii?Q?zeDhoKyYx01TusG5kssZY8wir8HnCj6DiUiNGDEHTMvlLvt9n1KUKTyp23F5?= =?us-ascii?Q?a6GJi3/7mK2QEPQi5Ha2wCR3rD8ViO8J9Tni4wIw3FTJgrrnyEh5bCl8O/xV?= =?us-ascii?Q?hkUEa2bNfaDnhAipnzQO1zPXuHa69N5QPvoNHrWO1qnA7UhlQ66GS8SVO9tx?= =?us-ascii?Q?3Jni4WIKezrNodL+jWrAMGPaSS9kSrLOb/kMcZ/uA8PZFGzTRTp27tp5bGN9?= =?us-ascii?Q?fMYUA9DAzaPXqBLiZD11WUD/HBfAPLHHMeVUqfmK+Glq3P3tks5Cyle2kdEn?= =?us-ascii?Q?MhXK9MFV43L/ZCbPCQDLZX/Amq/czWjTjRhhFlUsDuMEK/HN0ZzaIIWqCyx4?= =?us-ascii?Q?qumqV9zUYj44BYx700P2aJEFNL7hfKElj+/EPMxXl2MeyNPQkkSHazoPBR+U?= =?us-ascii?Q?pSQRch3NARWJMMQZSqOGhjRBXxLaLoC2fCCSGxUglo8K+UGYkBzYu2D1+ish?= =?us-ascii?Q?WXaLV9wbTWKqyqYsbNt3I/0e9Iw0c/w+AZ8FxumK8Q2dbBDMU7KeOM9raIP9?= =?us-ascii?Q?l9GT4CQ6M+iw7QXttUG72JnDWolJ6tRIDnwzgXR0zT0p3HRPZGvlyqEG33Kg?= =?us-ascii?Q?KzdwiJNq5Y1BnMy6hvITb/nSF/TM9NMU4akanU7wdtfR+z+NyoPAp7HM7HzU?= =?us-ascii?Q?LrzQnP5fWYQ1x0fc2m6tW47r20cu/kUB0BKpvqTFi9v2BOZgxdruT/rWeqZG?= =?us-ascii?Q?hzq7vPJ6vSU0TvBZigbW0029p9wqlSxWrMFx9nE9ZcnM65JwSOxSrcbd572l?= =?us-ascii?Q?42QtKqzyWVdr1A3jRGLRmr0+8ok/Kw6ONZAWXp/AYWld6x67CvUPWlc8f323?= =?us-ascii?Q?YUKryPJszjw4g9T/E5JNxR2YOdKOyJTxAZ5rTSyP425jGcObGH9Dx5svP6Vp?= =?us-ascii?Q?GZ2nZL9pMWuXhOHpkLJKh0A5eGv3Im+RUkgkB/cw8Wo3ahWELS8oxGHUBYEh?= =?us-ascii?Q?PL82UPHoN5Wg1vMvYVitgJAa+IKzHOqoVjywCDUxpJioRSz9?= 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: 9072aa54-2a5b-4471-d951-08da170cfb15 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Apr 2022 14:02:54.4187 (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: HkhUF9Owmty5QLnC91T8v0l0HZdtpS8/bzyIbwlqN/MOdrklgAgG/yrGaojfw4d6HQWeI54nKKm1PcYlWCWfVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3208 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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, 05 Apr 2022 14:03:01 -0000 [AMD Official Use Only] Sorry for my oversight on the spaces. I fixed it. Thank you so much @Bruno Larsen for taking time to review the patch. Lookin= g for someone to approve the patch. Regards, 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