From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2058.outbound.protection.outlook.com [40.107.236.58]) by sourceware.org (Postfix) with ESMTPS id 7033F3858C2C for ; Thu, 24 Mar 2022 06:36:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7033F3858C2C ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZccJPXAVjMq1cwJzi9draVdgm6By/dR3fVL3CuKqP1kP/264GiBxCLCh4SS5/pvKLAqfHr/B4P8NdHFNxvUNcnD5bt8iqWdG9eNM6bTEervocJno0VKSkmyd3vhsZVMOmZ8wu/S+2jQEPR40yqkdP6hA6WJrT0IpSJWEn77/cWDmwQwvik/HsEnRowaEv54FsPpRlZD+DhT/Zzhl9x2S0bcAEwUbBiuICUH1iOdScGmobp/VQQeSHnf9d+AcMfMntDWgrKMy82Ir9JEP/p0aUYFWJGjwCPpOViWwI4Qj48na0mSr4Cgx4KH9+qDs0Iatwpo1u40dN94QqcEcZnkEmA== 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=d4ALxFfmJU+Xgyi8cjDsmAMwxfOpG0EPB3ooz5WAo5Y=; b=oSDkaeQTmqgDmIIhUk/UhSn1ecC+n90jCmrfcSgKXbjrncl1h7xZCgrT1uGG8gxZS2K+bbdmWOcckY0PqZ6UIzIuo0+yU/UEVU2zAtYxfhgR1lXcXxCnn0To9SMV+Zr02Fm9GgEM3AMAOZ+rFRAfaT2VCpP0D3O1K4hFHqyCK55V9Yp2z4jFkRSI1Iw2nldU0hBt3Ej0s2V6ExfnDbP9nK0/IApUzwLGHY4IXW7+kKJaWFQ5k6gEVfQxxm/CfhLVsWrdhnggdOmpKFz6NQDwzzEQ84iDSYKH/16Ke8t6ewdyJVyxxnT1LIe9ePq5E0ZdVMK5N9VK9d3SdSHaE9nNAA== 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 CY4PR1201MB0101.namprd12.prod.outlook.com (2603:10b6:910:1c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.16; Thu, 24 Mar 2022 06:36:50 +0000 Received: from DM4PR12MB5796.namprd12.prod.outlook.com ([fe80::c1c5:fe5b:5a50:ba4d]) by DM4PR12MB5796.namprd12.prod.outlook.com ([fe80::c1c5:fe5b:5a50:ba4d%6]) with mapi id 15.20.5081.022; Thu, 24 Mar 2022 06:36:50 +0000 From: "Natarajan, Kavitha" To: "Natarajan, Kavitha via Gdb-patches" CC: "Parasuraman, Hariharan" , "George, Jini Susan" Subject: RE: [PATCH] Debug support for global alias variable Thread-Topic: [PATCH] Debug support for global alias variable Thread-Index: Adgvx/KC9Ls2FcnvTJeRu5jcNWYisQHxHiHgAe9FpdA= Date: Thu, 24 Mar 2022 06:36:50 +0000 Message-ID: References: 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=dc9d7c15-1086-43c9-8bfb-09c6455a1224; 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-04T12:57:32Z; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e0cba561-5273-4f59-e2f1-08da0d60ad4a x-ms-traffictypediagnostic: CY4PR1201MB0101: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: 1T3kIq7dCH8HWtpqQQJ2hO0aJREDteKC6qYyVHB4BZHfpJmBOuTrr5CCO8Jo3M46L3pjO0w+fNj6gCYkOxvhNkd5VUaVLWvKyIpi2Myo+9wIK1PO8ixevQGamZy5JIoGfv5qY12l1MRvX7gWCvUHyqaM18O3N/MiLRvj0S46Z6yck7MAQ4sz4/zoGhQa/iqYkjDmKCGXrVfRuRi9JIEx8pVWRJAq9TrtVzqeQEsiLAGPN/h+sTBWBvZWS0x/yV9ieLi8Z1cef+EK5/+qXZD4FHMyb6nCGKIlvNMuJhfNua7D5N5Ttbf902GAlmb7RMGap4Q0VVwyD0MG2fxqwAm9jtiitoGX1Lt0RIIcTPmrKdiD6ZSSx3BIWGqxJr5Av69f85qlpaaxEpsNYFtXHlHXnqCsMabnrClm0Wboq0aMIumaJreCgxuZWEGUkeYErN7DLTNSZKc9DySHmazcaf6mvlwqkgGH/5ZWxZZeMA2HUTQkx8Qv97uP3q+/cI0IACrGRstxpDl/J17BbF04I+XukvOHlSQyHj2SXviQirpEVeiHF0J+2X6OOxf8mTpwfj97HMsi9JjdjPSlOyK6pshqYV8Ou3LuPIrXayNwoLZX7DR2KQTTaUgBUh5RuTOiLrDzZ9YKz9JfWpMxYIZNre+taoezr0FEl98w+q1WCFtpOLnErY+bfBMoWPZRuBbTmDRR5TCeu5vjhggb7rgJr3dndNKq+WsLqIKnkET1I26pFw5iA4KS0io2tCd0MyZWB4g/C8jZHy++wIEtEHmYA98ru9ldO5cmFYnb6ikkU2qyzPTWI2L9XKmcwHQ8zZ6tmPEIqFwTqDCiXdTwSIbyzUwniA== 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)(4326008)(6506007)(8936002)(52536014)(122000001)(71200400001)(5660300002)(966005)(38100700002)(2906002)(66476007)(66556008)(66946007)(9686003)(7696005)(66446008)(33656002)(64756008)(21615005)(76116006)(8676002)(166002)(53546011)(508600001)(38070700005)(86362001)(84970400001)(54906003)(55016003)(6916009)(83380400001)(26005)(316002)(186003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?70QO9h6QFpdxJ+3FSjKKCVt6Yw6ViFqZ8EdncjsRiJ5OYCO2zCsDazsYtiqO?= =?us-ascii?Q?N5lP0d8tAkuHgmzxHdLTbD3O4AQMex6U8Utmz0J4MA+7x5mzqn0SebAsqQX/?= =?us-ascii?Q?L81cYPATzccmYGewSDC8UaoRKLZtRo7969J51HqsPvHxq8ipw8oNm0+6trFt?= =?us-ascii?Q?d6FB9BqHwXFj1RuIjW1idJ4chVh2no7WKoXOR0/OjO7anRIB3GFE9F1l54g8?= =?us-ascii?Q?6EHrR16T44Y6mAAFWLj1kRUIcYKQdQZ9opg5DIwwtY+kpbaIaEBZzE1dII/v?= =?us-ascii?Q?MdtbuUUMqJ0AsYgxG8gwSNO/R3UIyonRu/nxAKTJvNzoF3j2qFktQ5f51JCn?= =?us-ascii?Q?FElyaayCikscygv47qxOx/bk1L46nRkOA7rMcwHCngENaQvTSgAR2aFF4Kjc?= =?us-ascii?Q?qkb8s7n1zj53PmqI11WQ+X4TCIaZ1zT6HjJ2yTwtS4siOA1FB8eIdmXh8TJT?= =?us-ascii?Q?2TdFbYauwpbOqs5oUGcx5oiNSS/qYuv8bP92YAR3HJ8cGl2rFmTf9bGufDcY?= =?us-ascii?Q?YCfHHD3X8K48rOmhslAMmHOcZjZ+nZPdcHQV5KCGc1x4lkGxDAhft5Pmx+ty?= =?us-ascii?Q?8qyIebYzy6NUYjYiq0un9CoC9ZQXpNQtpFmd5XuBQbVa/HIBQPvJXxxAF7y+?= =?us-ascii?Q?Tk8BD1HDOrBoO3AMJ2ztjLY3K555Fl9XPLdo611SfM3bXek6nfMjUNnNtLNB?= =?us-ascii?Q?QF0Ut7nRdv8yx1fi9rsIO+OD8Rfpa17CRGIgEdDUSAldWZvJFortXnimdlcJ?= =?us-ascii?Q?x+iLw5sq+jO7cjP4+HQmQTkfRhPY5JMG6LrpYbEmtoSiOtfdfcQYNm/nDb0B?= =?us-ascii?Q?pfU5nq9qQPL1mBPbiSKGV18S3Wr2Votl4aXftRiC6BlyeMXHSEALJFcImz6S?= =?us-ascii?Q?UEBjLaVJbiaLEQpb1jCYTdNxqL+WrtoTCbBaisJHOfwvtg8pPZgOJvw2emWt?= =?us-ascii?Q?7WVzBarn6Y6PyKabqhXvIu7bI01MVJ1paLexzIWp7L2ffghBebXki01Yzz5y?= =?us-ascii?Q?M9UADiUNO2WMPDqEZqciAIJ1p/jbv+ugZFeDloidIdENNxmtdvTTW5elgFbL?= =?us-ascii?Q?hnkl1tTiK3gRe+8vXcTm3zfo3yCq/grVLvbUzjzzEFMO50d+JT9GGs5+gAcv?= =?us-ascii?Q?byBh+ltUKrcbQQ8DfK/6Qz1o1yTQ74AgOgZ0QF/Uh0RDC1/ATi6klJkdxOfV?= =?us-ascii?Q?hWD+xi532paKyBsGEnxxNArp2yQiwS4n6hFSl0sqaSGy0hd/bmoC1qQIOmq4?= =?us-ascii?Q?Fu9VbkzUI54OfzTH1BD0keJrKU7yIALUinVZ69x/11tY0vNzk1Va/PQF2zc6?= =?us-ascii?Q?08T9wd/GgWf3W+VpVX8paE12b0sBAoGuHqfIz6k0aE9Q7SFBDjPWhphi+C4Q?= =?us-ascii?Q?N7g5cF9sxH8+Kc+2EvX4Lx9wnN68yTy8OVZz+ZJEODXCM1jIx5J8XkqlhN1z?= =?us-ascii?Q?3r3snCzraUt0P806HrgL4Su36JhKwlxd?= 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: e0cba561-5273-4f59-e2f1-08da0d60ad4a X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Mar 2022 06:36:50.1108 (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: Zd5HQJ3hqewHlJ5rQo5kSveK9Qp1kHwh5ewfR5HPVNJY7s1bZs3ifrakHiJaXNbzpcX68J0P+Puf98QhzKR75A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0101 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, KAM_SHORT, 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Thu, 24 Mar 2022 06:36:57 -0000 [AMD Official Use Only] Ping! From: Natarajan, Kavitha Sent: Monday, March 14, 2022 4:45 PM To: 'Natarajan, Kavitha via Gdb-patches' Cc: Parasuraman, Hariharan ; George, Jini Su= san Subject: RE: [PATCH] Debug support for global alias variable Appreciate your review comments on this patch. Thanks, Kavitha From: Natarajan, Kavitha Sent: Friday, March 4, 2022 7:15 PM To: Natarajan, Kavitha via Gdb-patches > Subject: [PATCH] Debug support for global alias variable Hi, For the below testcase, when compiled with clang compiler, debugger is not = able to print alias variable type or value. $ cat test.c int oldname =3D 1; extern int newname attribute((alias("oldname"))); int main () { return 0; } $ clang -g -O0 test.c $ gdb a.out (gdb) ptype oldname type =3D int (gdb) ptype newname type =3D (gdb) p oldname $1 =3D 1 (gdb) p newname 'newname' has unknown type; cast it to its declared type This is because clang is not emitting dwarf information for alias variable.= I have updated clang patch (originally from https://reviews.llvm.org/D1031= 31) to emit debug info for alias variable as imported entity (DW_TAG_import= ed_declaration): https://reviews.llvm.org/D120989 However, gdb cannot handle the imported declaration for alias variables. GC= C emits debug info for alias variables as DW_TAG_variable which gdb can han= dle. The discussions in the llvm bug report bug-50052 and above review links talk about why it is appro= priate to emit alias variable as DW_TAG_imported_declaration rather than DW= _TAG_variable. Refer section "3.2.3 Imported (or Renamed) Declaration Entri= es" in DWARF 5 specification. It was also previously discussed in gdb forum= in the below thread: https://sourceware.org/pipermail/gdb/2021-June/049509.html The attached gdb patch can handle DW_TAG_imported_declaration as alias vari= ables. This change fixes the failure in testcase: gdb.base/symbol-alias.exp This testcase is also updated to test nested (recursive) alias, static alia= see and deferred aliasee. Please review the below gdb patch (also attached). --- gdb/dwarf2/read.c | 113 ++++++++++++++++-------- gdb/testsuite/gdb.base/symbol-alias.exp | 23 ++++- gdb/testsuite/gdb.base/symbol-alias2.c | 10 +++ 3 files changed, 107 insertions(+), 39 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 10550336063..0f709d9ccc1 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -1132,6 +1132,10 @@ static void add_partial_subprogram (struct partial_d= ie_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_cu *= ); -static int read_namespace_alias (struct die_info *die, struct dwarf2_cu *c= u); +static int read_alias (struct die_info *die, struct dwarf2_cu *cu); static struct type *read_module_type (struct die_info *die, struct dwarf2_cu *cu); @@ -9742,9 +9746,11 @@ process_die (struct die_info *die, struct dwarf2_cu = *cu) break; case DW_TAG_imported_declaration: 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 +10218,20 @@ dwarf2_physname (const char *name, struct die_inf= o *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 + +/* Inspect DIE in CU for a namespace alias or a variable + with alias attribute. If one exists, record a new symbol + for it. - Returns 1 if a namespace alias was recorded, 0 otherwise. */ + Returns 1 if an alias was recorded, 0 otherwise. */ static int -read_namespace_alias (struct die_info *die, struct dwarf2_cu *cu) +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. */ + /* The die must have a name for namespace or variable alias */ attr =3D dwarf2_attr (die, DW_AT_name, cu); if (attr !=3D NULL) { @@ -10232,42 +10240,71 @@ read_namespace_alias (struct die_info *die, struc= t 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; + { + attr =3D dwarf2_attr (d, DW_AT_import, cu); + if (attr =3D=3D NULL) + return 0; - d =3D follow_die_ref (d, attr, &imported_cu); - if (d->tag !=3D DW_TAG_imported_declaration) - break; - } + d =3D follow_die_ref (d, attr, &imported_cu); + if (d->tag !=3D DW_TAG_imported_declaration) + break; + } if (num =3D=3D MAX_NESTED_IMPORTED_DECLARATIONS) - { - complaint (_("DIE at %s has too many recursively imported " - "declarations"), sect_offset_str (d->sect_off)); - return 0; - } + { + complaint (_("DIE at %s has too many recursively imported " + "declarations"), sect_offset_str (d->sect_off)); + return 0; + } 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_ob= jfile); - if (type !=3D NULL && type->code () =3D=3D TYPE_CODE_NAMESPACE) - { - /* 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; - } - } + { + struct type *type; + if (d->tag =3D=3D DW_TAG_variable) + { + /* 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); + if (attr !=3D nullptr) + { + var_decode_location (attr, sym, cu); + return 1; + } + else + { + /* We do not know the address of this symbol. + If it is an external symbol and we have type informat= ion + for it, enter the symbol as a LOC_UNRESOLVED symbol. + The address of the variable will then be determined f= rom + the minimal symbol table whenever the variable is + referenced. */ + attr =3D dwarf2_attr (d, DW_AT_external, imported_cu); + if (attr !=3D nullptr && attr->as_boolean () + && dwarf2_attr (d, DW_AT_type, imported_cu) !=3D NUL= L) + { + sym->set_aclass_index (LOC_UNRESOLVED); + return 1; + } + } + } + else + { + sect_offset sect_off =3D attr->get_ref_die_offset (); + type =3D get_die_type_at_offset (sect_off, cu->per_cu, cu->p= er_objfile); + if (type !=3D NULL && type->code () =3D=3D TYPE_CODE_NAMESPA= CE) + { + /* 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; + } + } + } } - return 0; } diff --git a/gdb/testsuite/gdb.base/symbol-alias.exp b/gdb/testsuite/gdb.ba= se/symbol-alias.exp index 2b53cc31053..1259c1daf1d 100644 --- a/gdb/testsuite/gdb.base/symbol-alias.exp +++ b/gdb/testsuite/gdb.base/symbol-alias.exp @@ -15,6 +15,7 @@ # along with this program. If not, see http://www.gnu.org/licenses/. standard_testfile symbol-alias.c symbol-alias2.c +set using_clang [test_compiler_info clang*] if { [prepare_for_testing "failed to prepare" ${testfile} [list $srcfile $s= rcfile2]] } { return -1 @@ -31,6 +32,26 @@ foreach f {"func" "func_alias"} { } # Variables. -foreach v {"g_var_s" "g_var_s_alias"} { +foreach v {"g_var_s" "g_var_s_alias" "g_var_s_alias2"} { gdb_test "p $v" "=3D {field1 =3D 1, field2 =3D 2}" } + +# Static Variable. +foreach v {"g_var" "g_var_alias"} { + gdb_test "p $v" " =3D 1" +} + +# 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" + } + } +} diff --git a/gdb/testsuite/gdb.base/symbol-alias2.c b/gdb/testsuite/gdb.bas= e/symbol-alias2.c index 34f4e121e25..79b3195caf5 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,11 @@ 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; --