From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2044.outbound.protection.outlook.com [40.107.237.44]) by sourceware.org (Postfix) with ESMTPS id 39F313858C54 for ; Tue, 5 Apr 2022 06:26:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 39F313858C54 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nngW2VBpGElSueyMwTav8wZ3iNzf8yUQ/3FMSHyENgH+9E07wi69T+fQIgACu2ou/iSpJKTpOJUePHP00x3zqNKn6v4I+bJXFHQm6YCC7mvUJICFbueIGeCNsaN8M9/FCValwfoxHEUUz5YfaJyEQD5x4nK0SeilZJDe3y/2Vn10ATQSwDyh+aIY8qaePIuM8O3SafZHlvbkqrRz1lMzIGTZiPpPcB/pnsOkhep2vqdpj6HUeM6Ue6McGv7Wd0mhcfgYwFbE2gh3YiIDio/YZqfCnV61G2x1bp/WlFvla3YpEWa68ZXHnkdj15NOIUWz+tH/p1N2l4mwCxs15hWnqA== 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=b3ud2HDduDcMzwnHAZ5lwVPOJOEZ5XWOmdh9q2VWd24=; b=U1/nzkQLJPk27HOpbhgcomN184xBgS+Niucv2qmgNL5yMWlKTeYzF/kiBs3KdiHvKAvbFXVtkhAmKZranmv9RxbjGogMkbc2glMSUb6mIl7QDjvwouUOTtwii4pdoL6akhyopnhb7Qs0RaOnkA2ztFOt3+J35YkLM4CCTj2yrDD6dcUW63Pp0OduRQBArdEKH2PS9lO4ntFkGiu/1FxuLfc3pIVK3x/HXhITpyq0dtNSUqXGyExMPEhCza3F3+dbGGVPnNcP+JFJgvoPbbvZW0vxc26QrEujpQ7wVV3SV1G1pEqqZFm23xIX3/Hv2LP4PjTyW8ngyupZSIyRR31bcg== 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 DM6PR12MB4417.namprd12.prod.outlook.com (2603:10b6:5:2a4::12) 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 06:26:30 +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 06:26:30 +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/KC9Ls2FcnvTJeRu5jcNWYisQPvqNcAAMR4mPAAN0esgAApFU6QAAWQfSABHvNY8A== Date: Tue, 5 Apr 2022 06:26:30 +0000 Message-ID: References: <66ca57f9-c3b8-4aeb-f07c-c3c254dfdea6@redhat.com> In-Reply-To: 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=668382c6-c21d-4cd3-b212-ea9c4bae3bb0; 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-03-30T09:38:33Z; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2d65ca5e-ba4f-433b-e07b-08da16cd38f7 x-ms-traffictypediagnostic: DM6PR12MB4417: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: 5vNb+ajYY9jSFk8bSP0G559tSNQqMMRUzonbimQFILEiJIelR2PqGL/ccRtsPZ5C+HC6wMgEDE+dzxGLjl7eRbj/YIeus1AP9L/YVOl1ARA7rm69IEhHsl3+5FMg6uS+U351nvCbwjuJWDTdUpwKi+kUiRkHht8tCX3zkmIGeFBe6TGwGpQ3MdnajqyTwa+HNPwfkhV0o1hYH7UheJ0UjeayUmKTV4jLqCHty0ytXNbSaQtTvknHun1TK5oB6yaSvDRMN6YPYywq4bc13bnq8AgZncZBM/XZC6X6gvD7E76E9P2F+5a40SOOqtuMkzNLiGeFTN6F/+gEAjS77cq4HVA3FAWn4ZdRTSZZzVv0ef2/5vJFvn4+B0WqJXxvMJs9KmXLd1OgtenYAO2cwBSEwqky6p2zV56ZS0fvxCm5YpZR67TVMmtRXa6HZr8nGON3JhRLONBR4JWT0fLIvfTNplZMbXbLg7OcM7G6lsg4WoBcuDgQhW4GO8yUis2vMAFsYJrWaYd4FLW/tuwB1tRKuwh7mbC5EfiAhpALcMzC4rvzBX1STFz8wiQ63HIHI1jis609PQSFXSf2Wlbwm1wNwEdD2+HrscV+sLBSI+qE1KqU+Cq3Y/CJ15xOuxvsYqdbnro7zTVkqSnsbzy50ftobJBM5f7KU+5AEV0P5Pu1vYpzykCQ0UGVgUPrXsWZTQ2h7CtV7fsCGOLAjGyAQie4M/P1dqSbXEggqnpmpYdjDr+cIde7Put4OBtrOlbDxXpbrNlRzf0Mkcy0cslx0fVmK4e6apDsVvSN+rhoAntbCh12jBOqUDROKRFAfVpw43XZ9om+aEz7bPMv0OHhgl9Qtw== 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)(508600001)(6506007)(9686003)(66556008)(64756008)(66476007)(86362001)(66446008)(7696005)(76116006)(66946007)(83380400001)(38070700005)(54906003)(110136005)(316002)(71200400001)(38100700002)(84970400001)(26005)(52536014)(30864003)(53546011)(186003)(8676002)(8936002)(5660300002)(122000001)(55016003)(2906002)(4326008)(33656002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?XqeqytgFWJRMnvFJzQb4osZY2FahTe6ies2rg7sMxJmVF0ck9T5+O4k8Jhck?= =?us-ascii?Q?5h5LgQjsfKuTiAo19uRgdQI4KYTuJP2BUfSIZRjwuTGF/cEbC4FxvCUaWovO?= =?us-ascii?Q?hSD5/Jj9WnjVhRdpABpmSVyGA47joCb3xqZccK/fI0nzpoK7FaCoNp/u86KL?= =?us-ascii?Q?VFmXQ449VpOXB+/Ni8mWw2FpCIYld82VfJxYeTgUxpU8fnClqy8ZF9irH0pQ?= =?us-ascii?Q?sYLkOznFaJmCOGw9wKwRJkswHSPP+2vkx352nX6QOcNVLASL9Mdf3Y4c2YUi?= =?us-ascii?Q?bL8zatNABXsWpVCNyd6QNeJ5119MkIyFSjNDoPoFxHcAsuvvhcMszQvH1vZG?= =?us-ascii?Q?rUHdkhTqzJ5pbj/FDnRo2z9yRDjDYbO9no14MVwPVvxQxm68miBZMg5qTC1O?= =?us-ascii?Q?cPCq8zgWoGcJBk0nwUudTyvtdiBDncm+vnm1WknClFWZF8mdNV9t6oFllL3A?= =?us-ascii?Q?2TyoMX0KELvSLO0eEYedC1yV1gdTIXNPBHkbfA7euml4QZY0ZDjHUkX53LjZ?= =?us-ascii?Q?rEIF9e04yQiZCH7fOCnojT+kdfv7zHmZi2QnAudISckv40YC52QzBU13WPYV?= =?us-ascii?Q?P4Yr4CocuhIKiwEjXfeHELcm5LNBSwkM1OwMBkokU8dvn6yDOih1pAizUktO?= =?us-ascii?Q?zshd8lDAfVMIr7G7VFlOlMSPN4THz4oqiJIpOLz8HwdLZ7RFTN5V4Ewm5aIu?= =?us-ascii?Q?777FBqg9WphPaEAvyVP0Rm1CfHyDdQckN3/MUjCYIZMzxDrk0XVeYOlURG8h?= =?us-ascii?Q?yg+ytAQglKjMgDbB7u+NrYOMrFjoVpL3MsyPRxemPKCsqO0vqqlgVZxEyFOU?= =?us-ascii?Q?Vof4SEKJvZ6fW9m+nJc6dPrgH3Mx/oDHtXqYTGaqp6RvPvfc/iJEdr9OSVxK?= =?us-ascii?Q?rNkrKYcy/tcSdZuc1fQtsdbO1ZCKa6J635P5Xy91B744UAFUAXDS+ZpMHzpK?= =?us-ascii?Q?VqxJhRAKLJ2sRWilCtt0XpmuGDkLLyj06TN8dQO8TTKp7yo9zq7QV16KB2OU?= =?us-ascii?Q?NhA1x58fJZG3aHHhQNocwwHb4qSX/GDGHyx4cFA3wiWUK0pnil86mDGSKI4F?= =?us-ascii?Q?iTBYUMgdt/z8Ib7k+Xw5dxmv+HFvhtqBKUUIRM2eUYgyVWfIvQLEjsK4uJu/?= =?us-ascii?Q?4HYynIGGNybsigYUNHFxpbRhU9aKk5DLyFKctPTmiQOCB1G3MAFxTPHxxlFW?= =?us-ascii?Q?UFYyp5/wk3f1n7pjLPYYk/cY2LiKqwE3CP8ao+dbG6E2rAHcybYNGhmws/uF?= =?us-ascii?Q?+ZcuvNp4NRx8czqvQW51+d4bT8xgMZmwWAJtxUHl10KYmwQlPFvaPrcDvCef?= =?us-ascii?Q?uEJazEYQ0Ud3NBYiGvlMAzf78DDvPJmLmp4USzSg4FjGIn7gqQwcRJADTbvu?= =?us-ascii?Q?mGLGgYaInURMyU7tDc4QfiS25ckx7aCr6kp7W4YJ+93ZhdBJgzV5m5Nd+8mq?= =?us-ascii?Q?9/HQ7v2q4XUAU/UF31f2uHqRFPLmbZ3j1kBWc+q5xfBFg4pcxNex+dxadOpl?= =?us-ascii?Q?0mQmwN3dPJzsCx1jHt+RAZCW4qhYSWn8RSfHYEx+j7Af6XAk9rB/Pi1lAKSc?= =?us-ascii?Q?c858SetnHNDtbPUUzKppC1hmlmMII223wti040QQuw6j+v87pr3qJHPJBkOD?= =?us-ascii?Q?QIj5K7N0SrV03GeyS8/1kmLCq3LKlG6J8cfyukiJ3mLUGAaZtuB8mHYgPQvp?= =?us-ascii?Q?L3oBSSliw4CUS9yeWNiIWdvkHpKAhLGUWdKJhe7oS+OnErOR?= 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: 2d65ca5e-ba4f-433b-e07b-08da16cd38f7 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Apr 2022 06:26:30.4503 (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: gOFa+lR2aaLXm2iJm69kJ44BD/fmWKbiSW0Oe9FLA12uzcauEOQPFngSJYpDAPcQjd+g8tJAak4pmGf19I76Dw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4417 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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 06:26:35 -0000 [AMD Official Use Only] Hi Bruno, Can you please review the changes that you suggested? It would be much appreciated if you or someone from gdb community approve t= he patch if everything is fine. It will help in progressing the clang patch that gen= erate these debug information for alias variable. Thanks, Kavitha > -----Original Message----- > From: Natarajan, Kavitha > Sent: Wednesday, March 30, 2022 5:56 PM > To: 'Bruno Larsen' ; 'Natarajan, Kavitha via Gdb- > patches' > Cc: George, Jini Susan ; Parasuraman, > Hariharan > Subject: RE: [PATCH] Debug support for global alias variable > > Sorry, I missed to send the new patch. Please find it below: > > --------------------------------------------------------------------- > 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 fort= ran > 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 *highpc, > 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_c= u > *); > > -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_cu *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. */ > 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_NAMESPACE) > + 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_NAMESPAC= E) > + { > + /* This declaration is a global namespace alias. Add > + a symbol for it whose type is the aliased namespace. = */ > + new_symbol (die, type, cu); > + return true; > + } > } > } > } > - > - return 0; > + return false; > } > > /* Return the using directives repository (global or local?) to use in t= he 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 . > > 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 $srcfile= $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_prompt > $" { > + 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_prompt = $" { > + 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_prompt = $" { > + 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_prompt = $" { > + 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 out > 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