From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2067.outbound.protection.outlook.com [40.107.244.67]) by sourceware.org (Postfix) with ESMTPS id 9997B385801D for ; Fri, 10 Dec 2021 16:18:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9997B385801D ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hXfpH9cSnM5KAKS06emKAkQvaDjbq8MZCvf/5AUN7w04c5fCmJBoLRrf7OHQDGOAwcomDXIBCIuima7KP3X4GnwjIpqE1lD+knnBdjmOHPuNVcvBmd7ZZsV4ULvrXtRd5jSLAITooI7aBHlFhBz0lLbV6R3CbT6e/irwopT72r9i+QUsnUIlI9QodGZ8OKoMkXaUZzPR6r5pMSyTVBQFuE80bExA8+j1/BtmnaeAzOGGfAjw+dGSJSPAtUyrUlNtOkESqNSRgNeB6EKM0C8ulqkYm4InUyQksJbdULPKsDy80wHuhFZO2D4LA+sMttPZM7Aziqsz5BtTCx9LBdVl7Q== 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=ooIGD4kjFOMGqjKNwwbIkiSTwHAnolxcQRNc+bUxSsA=; b=iP/736+rM6S05iK0YuOo0B2vPzNB3jSqsoHs4qcK15NY8nAihLIRksZ+bngrnLI5Wd3bEAGJyJAaA8evyCvlG6n2CKXiVC1Vm+nKs1qSa3Thmy2tL/Ev//xV9HAWdfFll2V1mvCbxYWu1pyBHKNNRCXEDsdA/0Bgietiu47Y3XlqLloMk4IY+ZW3NdU9GYw14Y2BXSZVeHabS0Shtv7oignzGOc0UlAIEx0QjwgOfQuXoSbcKM9QEr/WPpPSypNX4bscXlTccG1NZnL0JSrNdyPfg66RR/m0lmck43HkCi+s1yNyv4HLLnwuXKik3ouYfCz6gm2TKI5RY3omCRxS2w== 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 MW2PR12MB4684.namprd12.prod.outlook.com (2603:10b6:302:13::29) by MW3PR12MB4554.namprd12.prod.outlook.com (2603:10b6:303:55::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12; Fri, 10 Dec 2021 16:18:53 +0000 Received: from MW2PR12MB4684.namprd12.prod.outlook.com ([fe80::604e:c4ba:b448:1b40]) by MW2PR12MB4684.namprd12.prod.outlook.com ([fe80::604e:c4ba:b448:1b40%5]) with mapi id 15.20.4755.021; Fri, 10 Dec 2021 16:18:53 +0000 From: "Kumar N, Bhuvanendra" To: Joel Brobecker CC: "gdb-patches@sourceware.org" , "George, Jini Susan" , "Achra, Nitika" , "Sharma, Alok Kumar" , "E, Nagajyothi" , Andrew Burgess Subject: RE: [PATCH] Fix ptype and print commands for namelist variables(a fortran feature) Thread-Topic: [PATCH] Fix ptype and print commands for namelist variables(a fortran feature) Thread-Index: AdeYyESNFilxiCvkSRWjYmJPezxZtgVO2csAAGpd/AACxzmqgAA84QAgCGPfWdAAAOU2MALESQhwACv/V4ABM5CGMA== Date: Fri, 10 Dec 2021 16:18:52 +0000 Message-ID: References: <20210920094122.GB4950@embecosm.com> <20211006155135.GS1900093@embecosm.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: msip_labels: MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Enabled=true; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SetDate=2021-12-10T16:18:46Z; 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_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_ActionId=7fecb33e-860e-475c-8fdc-7c4351fff77d; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_ContentBits=1 msip_label_88914ebd-7e6c-4e12-a031-a9906be2db14_enabled: true msip_label_88914ebd-7e6c-4e12-a031-a9906be2db14_setdate: 2021-12-10T16:18:46Z 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_siteid: 3dd8961f-e488-4e60-8e11-a82d994e183d msip_label_88914ebd-7e6c-4e12-a031-a9906be2db14_actionid: 60c81980-6392-4f86-a942-c483e302df4a msip_label_88914ebd-7e6c-4e12-a031-a9906be2db14_contentbits: 0 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 00220a5d-8ec1-49c7-87a4-08d9bbf8c21b x-ms-traffictypediagnostic: MW3PR12MB4554:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:517; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 93r8UCHJWkcrHfmWKqwS52vCyKBa6a+Ofs/HGmzXRaAP96xayhttaRgJZKuiHc7cLobZGI8oMQxQMyrFmKftCUT4f34fhMCEUJ3U4dMolmP4IcdOskEsHIckJUPoYuZ9c91HD3HgsUTbrwng9HcE940dxHcjLbxz+RuaZYG1Ky5vC5DEisklkRZ8NOMhJQSQG9Kv2DBCc7sI4L5wT8Usru1g+BAIVXq914GAUojOuOEQWB88mGsGjLYyVrbZ5GSgYirMeqUW4OEZbTfDnzZe3dunvnEaSWcAsFkKEUg5WCcMzh+Fl5IDgzX7B4Mqk0KFBdPGwmQSA/H6w3p68KeI4w8a+auSOMxizbwrNXJJszRKTLMHTpuN3P522o9ghElhJYp7ZhLzgQLviOyFRsej1howTwKgEeO8/hNDsilZINOk7ckploWNkfH035ONTsMNlUZ8Ll3Wkw/fcjQ12RSMwUgtWZ03SawVUoUpgjya/8+l0IZVohNY7fY4KJu/5X5PENCMT//digJtioqrjnc2xSeCCrwFf+RjC5ejDipbqs8aE4eVHJQGuc/UXnUBLYip6yKtUx8yshjwUKkzXZh02n9AzdZ34IWqknVXJ67Ol97cvqgfwg3/01Rd9OZleYjFiouFx7EFpP5QMiz4uh8P7tCGGpwQw0TvuiNJlOSehD+Aro99S7+expTCniTOM9OkUE+ZeTPC7XLk0PmzbU/hw500Kiw88POAvbQTbCw/O4IxbBTvNt0/Sd2nmjVr6s3WRyDfCHlocTS5UKNYHXrRHklEbNxxe3vpbTYfs1fIV/ETdV2T6f0JSwquqzoFV11uPO3lKBu2rLFKO0+4F1FYtHACXpkbAm/Jx90HZfLGcIq6p9p+6llGL2Dtcwpyy1rC x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW2PR12MB4684.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(9686003)(52536014)(30864003)(966005)(45080400002)(508600001)(53546011)(8936002)(7696005)(6506007)(64756008)(76116006)(84970400001)(55016003)(66476007)(66556008)(38100700002)(66946007)(5660300002)(66446008)(83380400001)(86362001)(99936003)(38070700005)(186003)(2906002)(54906003)(6916009)(316002)(122000001)(26005)(55236004)(33656002)(4326008)(71200400001)(8676002)(2004002)(21314003)(579004)(559001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?mikOgJuq4boHIdFwPqTOGH9eg+g5o4XoYQuiprOb2u7ApMphF1IlW/Y2H+Cx?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corVw9XOh4/LUWvoOngRdeRRTkj7byzRFhCET?= =?us-ascii?Q?zrw7tSAEnoLRweJdXphwbCXKp5shtjrssNYZ3r9eaqI06/UkHFd7SCQ9M4fe?= =?us-ascii?Q?cL51Rafn3ncWUKPFJCrYZzTrZxYeDesE26Af4fDL5OnDuXWnnf+kmihhV5O9?= =?us-ascii?Q?yHaaR6ZysACdD3Ug/bRTsKPrUJW0o1mbH8OH3lwncm/QV+azAUlurdhCkBy5?= =?us-ascii?Q?6JQBCJw2DlNutZ+SZNXN0ElU/VaeeCMXFJEL6JgKYGszvxSIsfm9h7wvUIAi?= =?us-ascii?Q?kLiecP4FyZdEOZ9ick+RLCiG+cSKEvQmGUjYLAin6knIw/6n45XBA7rijnmY?= =?us-ascii?Q?28C4j95sQAKyc8ftoo4pH/U8cuTIAJdBNEJfuhE+ojX+CSkDdo3pvEV8crTk?= =?us-ascii?Q?PW/C3zW93dd4RsswgKCH45S2IlZXhuuHc2lpsJ05xP6LuAqxIbvcsI2frAXQ?= =?us-ascii?Q?riaHv4IHK8yoS3L4oWH7m2rn8DHMLdgkbF6MGbAWAM1VzTi+KyQdUECBb0yM?= =?us-ascii?Q?4kPg+OAhteXN2V29/Y1x2UT2SYhO3EQFoxZgp+/UI2X17v/AtTmMx5Zt5f4o?= =?us-ascii?Q?HypUjjipHE2lS4UGV7/ZeE942ELZHBxCNSP2AhFVvd3E9D8t5VaT+OdWVCAP?= =?us-ascii?Q?WOwjq4yJcmeXNzaKfM0EBl4Hoa2+AB8hYDNudxqsb5Ladcpvf3HFUslwUQtA?= =?us-ascii?Q?4tJxZwXrRIQM3/3gPC14GN0=3D?= Content-Type: multipart/mixed; boundary="_002_MW2PR12MB4684B82433FC18B9058B25E187719MW2PR12MB4684namp_" MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW2PR12MB4684.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00220a5d-8ec1-49c7-87a4-08d9bbf8c21b X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Dec 2021 16:18:52.9785 (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: 7YR3X5+YdvT3c15HVeM1/v2u2JcOn5bQbiHTeWkKlpKX0T10VYXSZYcjVR9BpzBo++OmIObmOU/vmOHDDXZiTQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4554 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_LOTSOFHASH, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, TXREP, T_SPF_TEMPERROR 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: Fri, 10 Dec 2021 16:19:09 -0000 --_002_MW2PR12MB4684B82433FC18B9058B25E187719MW2PR12MB4684namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only] Hi, Thanks a lot for your comments. I have tried to address all your previous c= omments. I have attached the revised patch and also inlined. Not sure if yo= u see some trailing spaces or indentation issues still, mostly they are due= to my email client(MS outlook). Please let me know if you have any comment= s. Thanks again. Regards, bhuvan PATCH inlined: >From a0e67a82709c8753778c02d5438decc7dae33172 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?=3DE2=3D80=3D9Cbhkumarn=3DE2=3D80=3D9D?=3D Date: Fri, 8 Oct 2021 02:01:18 +0530 Subject: [PATCH] gdb/fortran: Fix ptype and print commands for namelist variables. GCC/gfortran support namelist(a fortran feature), it emits DW_TAG_namelist and DW_TAG_namelist_item dies. But gdb does not process these dies and support namelist variables during print and ptype commands. When tried to print, it bails out with the error message as shown below. (gdb) print nml No symbol "nml" in current context. This commit is to make the print and ptype commands work for namelist variables and its items. Sample output of these commands is shared below, with fixed gdb. (gdb) ptype nml type =3D Type nml integer(kind=3D4) :: a integer(kind=3D4) :: b End Type nml (gdb) print nml $1 =3D ( a =3D 10, b =3D 20 ) --- gdb/dwarf2/read.c | 44 +++++++++++++++++++---- gdb/f-typeprint.c | 6 +++- gdb/f-valprint.c | 11 ++++++ gdb/gdbtypes.h | 13 +++++++ gdb/testsuite/gdb.fortran/namelist.exp | 50 ++++++++++++++++++++++++++ gdb/testsuite/gdb.fortran/namelist.f90 | 27 ++++++++++++++ include/dwarf2.def | 2 +- 7 files changed, 145 insertions(+), 8 deletions(-) create mode 100644 gdb/testsuite/gdb.fortran/namelist.exp create mode 100644 gdb/testsuite/gdb.fortran/namelist.f90 diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index cbd9a3012eb..2629a0ff432 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -9705,6 +9705,7 @@ process_die (struct die_info *die, struct dwarf2_cu *= cu) case DW_TAG_interface_type: case DW_TAG_structure_type: case DW_TAG_union_type: + case DW_TAG_namelist: process_structure_scope (die, cu); break; case DW_TAG_enumeration_type: @@ -14562,8 +14563,21 @@ dwarf2_add_field (struct field_info *fip, struct d= ie_info *die, =20 fp =3D &new_field->field; =20 - if (die->tag =3D=3D DW_TAG_member && ! die_is_declaration (die, cu)) - { + if ((die->tag =3D=3D DW_TAG_member || die->tag =3D=3D DW_TAG_namelist_it= em) + && ! die_is_declaration (die, cu)) + { + if (die->tag =3D=3D DW_TAG_namelist_item) + { + /* Typically, DW_TAG_namelist_item are references to namelist it= ems. + If so, follow that reference. */ + struct attribute *attr1 =3D dwarf2_attr (die, DW_AT_namelist_ite= m, cu); + struct die_info *item_die =3D nullptr; + struct dwarf2_cu *item_cu =3D cu; + if (attr1->form_is_ref ()) + item_die =3D follow_die_ref (die, attr1, &item_cu); + if (item_die !=3D nullptr) + die =3D item_die; + } /* Data member other than a C++ static data member. */ =20 /* Get type of field. */ @@ -15621,6 +15635,10 @@ read_structure_type (struct die_info *die, struct = dwarf2_cu *cu) { type->set_code (TYPE_CODE_UNION); } + else if (die->tag =3D=3D DW_TAG_namelist) + { + type->set_code (TYPE_CODE_NAMELIST); + } else { type->set_code (TYPE_CODE_STRUCT); @@ -15823,7 +15841,8 @@ handle_struct_member_die (struct die_info *child_di= e, struct type *type, struct dwarf2_cu *cu) { if (child_die->tag =3D=3D DW_TAG_member - || child_die->tag =3D=3D DW_TAG_variable) + || child_die->tag =3D=3D DW_TAG_variable + || child_die->tag =3D=3D DW_TAG_namelist_item) { /* NOTE: carlton/2002-11-05: A C++ static data member should be a DW_TAG_member that is a declaration, but @@ -15867,7 +15886,9 @@ handle_struct_member_die (struct die_info *child_di= e, struct type *type, } =20 /* Finish creating a structure or union type, including filling in - its members and creating a symbol for it. */ + its members and creating a symbol for it. This function also + handles Fortran namelist variable, its items or members and + creating a symbol for it. */ =20 static void process_structure_scope (struct die_info *die, struct dwarf2_cu *cu) @@ -21971,8 +21992,17 @@ new_symbol (struct die_info *die, struct type *typ= e, struct dwarf2_cu *cu, case DW_TAG_union_type: case DW_TAG_set_type: case DW_TAG_enumeration_type: - SYMBOL_ACLASS_INDEX (sym) =3D LOC_TYPEDEF; - SYMBOL_DOMAIN (sym) =3D STRUCT_DOMAIN; + case DW_TAG_namelist: + if (die->tag =3D=3D DW_TAG_namelist) + { + SYMBOL_ACLASS_INDEX (sym) =3D LOC_STATIC; + SYMBOL_DOMAIN (sym) =3D VAR_DOMAIN; + } + else + { + SYMBOL_ACLASS_INDEX (sym) =3D LOC_TYPEDEF; + SYMBOL_DOMAIN (sym) =3D STRUCT_DOMAIN; + } =20 { /* NOTE: carlton/2003-11-10: C++ class symbols shouldn't @@ -22909,6 +22939,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu= *cu) && die->tag !=3D DW_TAG_class_type && die->tag !=3D DW_TAG_interface_type && die->tag !=3D DW_TAG_structure_type + && die->tag !=3D DW_TAG_namelist && die->tag !=3D DW_TAG_union_type) return NULL; =20 @@ -22933,6 +22964,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu= *cu) case DW_TAG_interface_type: case DW_TAG_structure_type: case DW_TAG_union_type: + case DW_TAG_namelist: /* Some GCC versions emit spurious DW_AT_name attributes for unnamed structures or unions. These were of the form "._%d" in GCC 4.1, or simply "" or "" in GCC 4.3 diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index 1791cb29451..5b34622dacb 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -121,6 +121,7 @@ f_language::f_type_print_varspec_prefix (struct type *t= ype, case TYPE_CODE_UNDEF: case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: + case TYPE_CODE_NAMELIST: case TYPE_CODE_ENUM: case TYPE_CODE_INT: case TYPE_CODE_FLT: @@ -261,6 +262,7 @@ f_language::f_type_print_varspec_suffix (struct type *t= ype, case TYPE_CODE_UNDEF: case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: + case TYPE_CODE_NAMELIST: case TYPE_CODE_ENUM: case TYPE_CODE_INT: case TYPE_CODE_FLT: @@ -305,7 +307,8 @@ f_language::f_type_print_base (struct type *type, struc= t ui_file *stream, const char *prefix =3D ""; if (type->code () =3D=3D TYPE_CODE_UNION) prefix =3D "Type, C_Union :: "; - else if (type->code () =3D=3D TYPE_CODE_STRUCT) + else if (type->code () =3D=3D TYPE_CODE_STRUCT + || type->code () =3D=3D TYPE_CODE_NAMELIST) prefix =3D "Type "; fprintf_filtered (stream, "%*s%s%s", level, "", prefix, type->name (= )); return; @@ -391,6 +394,7 @@ f_language::f_type_print_base (struct type *type, struc= t ui_file *stream, =20 case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: + case TYPE_CODE_NAMELIST: if (type->code () =3D=3D TYPE_CODE_UNION) fprintf_filtered (stream, "%*sType, C_Union :: ", level, ""); else diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 27d9a730978..0491bff42aa 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -295,6 +295,7 @@ f_language::value_print_inner (struct value *val, struc= t ui_file *stream, =20 case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: + case TYPE_CODE_NAMELIST: /* Starting from the Fortran 90 standard, Fortran supports derived types. */ fprintf_filtered (stream, "( "); @@ -320,6 +321,16 @@ f_language::value_print_inner (struct value *val, stru= ct ui_file *stream, fputs_filtered (" =3D ", stream); } =20 + /* While printing namelist items, fetch the appropriate value + field before printing its value. */ + if (type->code () =3D=3D TYPE_CODE_NAMELIST) + { + struct block_symbol symni =3D lookup_symbol + (field_name, get_selected_block (0), VAR_DOMAIN, nullptr); + if (symni.symbol !=3D nullptr) + field =3D value_of_variable (symni.symbol, symni.block); + } + common_val_print (field, stream, recurse + 1, options, current_language); =20 diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index dc575c42996..8da362bddec 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -195,6 +195,19 @@ enum type_code =20 /* * Fixed Point type. */ TYPE_CODE_FIXED_POINT, + + /* * Fortran namelist is a group of variables or arrays that can be + read or written. + + Namelist syntax: NAMELIST / groupname / namelist_items ... + NAMELIST statement assign a group name to a collection of variables + called as namelist items. The namelist items can be of any data typ= e + and can be variables or arrays. + + Compiler emit DW_TAG_namelist for group name and DW_TAG_namelist_it= em + for each of the namelist items. GDB process these namelist dies + and print namelist variables during print and ptype commands. */ + TYPE_CODE_NAMELIST, }; =20 /* * Some bits for the type's instance_flags word. See the macros diff --git a/gdb/testsuite/gdb.fortran/namelist.exp b/gdb/testsuite/gdb.for= tran/namelist.exp new file mode 100644 index 00000000000..2e8325c0b1d --- /dev/null +++ b/gdb/testsuite/gdb.fortran/namelist.exp @@ -0,0 +1,50 @@ +# Copyright (C) 2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# This file is part of the gdb testsuite. It contains tests for fortran +# namelist. + +if { [skip_fortran_tests] } { return -1 } + +standard_testfile .f90 +load_lib "fortran.exp" + +if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90= }]} { + return -1 +} + +if ![fortran_runto_main] then { + perror "couldn't run to main" + continue +} + +# Depending on the compiler being used, the type names can be printed +# differently. +set int [fortran_int4] + +gdb_breakpoint [gdb_get_line_number "Display namelist"] +gdb_continue_to_breakpoint "Display namelist" + +if {[test_compiler_info {gcc-*}]} { + gdb_test "ptype nml" \ + "type =3D Type nml\r\n *$int :: a\r\n *$int :: b\r\n *End Type nml= " + gdb_test "print nml" \ + "\\$\[0-9\]+ =3D \\( a =3D 10, b =3D 20 \\)" +} else { + gdb_test "ptype nml" \ + "No symbol \"nml\" in current context\\." + gdb_test "print nml" \ + "No symbol \"nml\" in current context\\." +} diff --git a/gdb/testsuite/gdb.fortran/namelist.f90 b/gdb/testsuite/gdb.for= tran/namelist.f90 new file mode 100644 index 00000000000..fb36690d765 --- /dev/null +++ b/gdb/testsuite/gdb.fortran/namelist.f90 @@ -0,0 +1,27 @@ +! Copyright (C) 2021 Free Software Foundation, Inc. +! +! This program is free software; you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation; either version 3 of the License, or +! (at your option) any later version. +! +! This program is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this program. If not, see . +! +! This file is the Fortran source file for namelist.exp. + +program main + + integer :: a, b + namelist /nml/ a, b + + a =3D 10 + b =3D 20 + Write(*,nml) ! Display namelist + +end program main diff --git a/include/dwarf2.def b/include/dwarf2.def index 1ae6e1df298..6b8be1f6a16 100644 --- a/include/dwarf2.def +++ b/include/dwarf2.def @@ -289,7 +289,7 @@ DW_AT (DW_AT_frame_base, 0x40) DW_AT (DW_AT_friend, 0x41) DW_AT (DW_AT_identifier_case, 0x42) DW_AT (DW_AT_macro_info, 0x43) -DW_AT (DW_AT_namelist_items, 0x44) +DW_AT (DW_AT_namelist_item, 0x44) DW_AT (DW_AT_priority, 0x45) DW_AT (DW_AT_segment, 0x46) DW_AT (DW_AT_specification, 0x47) --=20 2.17.1 -----Original Message----- From: Joel Brobecker =20 Sent: Saturday, December 4, 2021 6:51 PM To: Kumar N, Bhuvanendra Cc: brobecker@adacore.com; gdb-patches@sourceware.org; George, Jini Susan <= JiniSusan.George@amd.com>; Achra, Nitika ; Sharma, Al= ok Kumar ; E, Nagajyothi ; = Andrew Burgess Subject: Re: [PATCH] Fix ptype and print commands for namelist variables(a = fortran feature) [CAUTION: External Email] > Thanks a lot for your reply on this thread. I have observed your reply > in the below GDB patches email archive. This is because the email as received on this mailing-list did not have the From field set to your email address, but rather the mailing-list's address. I don't know when this happens, and why it does happen, but I've observed a number of such emails have that "Name of contributor via gdb-patches " sender email instead of the original sender's email. When that happened, my reply-all did not include you. I've added comments (see below). I'll wait for a new version of this patch which hopefully address all my comments. > My replies are inlined below with Bhuvan start> and Bhuvan end>. > Please bear with me for following such notation only for this time, > since I had to copy and paste your reply and reply on top of that, I > could not find better method. Also majority of the indentation > comments are mostly due to email client related, but I will address > all of them. I tried to answer most of your queries and also giving > brief introduction to namelist feature. Please let me know if you have > more questions about these. > > https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fsourc= eware.org%2Fpipermail%2Fgdb-patches%2F2021-November%2F183907.html&data= =3D04%7C01%7CBhuvanendra.KumarN%40amd.com%7C6ae3b002df6f4f99442808d9b728e77= 5%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637742208605796849%7CUnknown= %7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6= Mn0%3D%7C3000&sdata=3DCkjxqJa5ySO4KQ%2BE%2FYnk52SijHcp2u1LFXKPHkdl1zo%3= D&reserved=3D0 > > Joel Brobecker brobecker@adacore.com > Sat Nov 27 07:56:51 GMT 2021 > > Hi Bhuvan, > > > Gentle PING*4 for the revised patch. Requesting some of you from the > > community to review the updated code patch please, i had addressed all > > the previous review comments. > > I'm very sorry for the lack of feedback for this patch. I'll attempt > to help you push this patch through, knowing that I have no knowledge > of Fortran. > > I only have time to do code reviews in the weekend, at the moment, > so hopefully others might be able to join in and help. But otherwise, > please bear with me. > > > From 89b7f847042ccea44633f714db07400fa6dd3617 Mon Sep 17 00:00:00 2001 > > From: =3D?UTF-8?q?=3DE2=3D80=3D9Cbhkumarn=3DE2=3D80=3D9D?=3D > > Date: Fri, 8 Oct 2021 02:01:18 +0530 > > Subject: [PATCH] gdb/fortran: Fix ptype and print commands for namelist= variables. > > > > GCC/gfortran support namelist(a fortran feature), it emits DW_TAG_namel= ist and DW_TAG_namelist_item dies. But gdb does not process these dies and = support namelist variables during print and ptype commands. When tried to p= rint, it bails out with the error message as shown below. > > (gdb) print nml > > No symbol "nml" in current context. > > This commit is to make the print and ptype commands work for namelist v= ariables and its items. Sample output of these commands is shared below, wi= th fixed gdb. > > (gdb) ptype nml > > type =3D Type nml > > integer(kind=3D4) :: a > > integer(kind=3D4) :: b > > End Type nml > > (gdb) print nml > > $1 =3D ( a =3D 10, b =3D 20 ) > > This is a small detail, but typically, for text which is not > a copy/paste of other things like GDB sessions, etc, we try > to keep the length of each line down to something that fits > within an 80-characters terminal. Adding the 4 characters that > commands like "git log" or "git show" indents the commit message > with, would you mind reformatting your explanations to fit within > those 76-characters per line, please? > > Also, for those who are not familiar with Fortran, I think it would > be useful to have a small introduction to that feature that goes > beyond a bit of Fortran code in a testcase, and how GDB is proposed > to show it. I'd like to understand what they mean semantically, > how those are typically used, and how they are stored in memory > (to understand how they work). This will help me better review > this change. > > Can you provide that kind of info? > > Bhuvan start> Thanks, this is much clear for me, now. I think it might be useful to have that information available as a comment in the code, for those of us who aren't familiar with Fortran. I tried to think of a place where we could add this information, and I propose we do this at the location where we document the new TYPE_CODE_NAMELIST enum. I would use the comment to provide the very quick introduction to namelists you provides, and also a short summary of how they can be described using DWARF (I wouldn't go as far as dumping the whole DWARF debug info, as this is a bit over the top). > Bhuvan end> > > > --- > > gdb/dwarf2/read.c | 43 ++++++++++++++++++---- > > gdb/f-typeprint.c | 6 +++- > > gdb/f-valprint.c | 11 ++++++ > > gdb/gdbtypes.h | 2 ++ > > gdb/testsuite/gdb.fortran/namelist.exp | 49 ++++++++++++++++++++++++++ > > gdb/testsuite/gdb.fortran/namelist.f90 | 27 ++++++++++++++ > > include/dwarf2.def | 2 +- > > 7 files changed, 132 insertions(+), 8 deletions(-) create mode 100644= gdb/testsuite/gdb.fortran/namelist.exp > > create mode 100644 gdb/testsuite/gdb.fortran/namelist.f90 > > > > diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index cbd9a3012eb..e= 6cd8ed48f0 100644 > > --- a/gdb/dwarf2/read.c > > +++ b/gdb/dwarf2/read.c > > @@ -9705,6 +9705,7 @@ process_die (struct die_info *die, struct dwarf2_= cu *cu) > > case DW_TAG_interface_type: > > case DW_TAG_structure_type: > > case DW_TAG_union_type: > > + case DW_TAG_namelist: > > process_structure_scope (die, cu); > > break; > > case DW_TAG_enumeration_type: > > @@ -14562,8 +14563,20 @@ dwarf2_add_field (struct field_info *fip, stru= ct die_info *die, > > > > fp =3D &new_field->field; > > > > - if (die->tag =3D=3D DW_TAG_member && ! die_is_declaration (die, cu)) > > - { > > + if ((die->tag =3D=3D DW_TAG_member || die->tag =3D=3D DW_TAG_namelis= t_item) > > + && ! die_is_declaration (die, cu)) > > The indentation is incorrect. The "&&" opeator should line up > with the indentation of the condition expression. Thus: > > > + if ((die->tag =3D=3D DW_TAG_member || die->tag =3D=3D DW_TAG_namelis= t_item) > > + && ! die_is_declaration (die, cu)) > > > + { > > + /* For the DW_TAG_namelist_item die, use the referenced die. */ > > Can you explain why, and put that information in the comment? > > Bhuvan start> > As shown in the above sample dwarf dump, DW_TAG_namelist_item points or r= efers to actual variable die thru DW_FORM_ref4, hence we need to use the re= ferenced die. > Bhuvan end> Thank you for the explanation. Given your answer above, and the associated comment below: > > Also, this is only a minor comment that you don't have to agree with, > but FWIW, when I read your comment, I intuitively thought that > namelist items were always references. On the other hand, reading > the code itself, it doesn't appear to be so. ... I propose you move the comment inside the the following "if" block... > > + if (die->tag =3D=3D DW_TAG_namelist_item) > > + { > > + struct attribute *attr1 =3D dwarf2_attr (die, DW_AT_namelist= _item, cu); > > + struct die_info *item_die =3D nullptr; > > + struct dwarf2_cu *item_cu =3D cu; > > + if (attr1->form_is_ref ()) > > + item_die =3D follow_die_ref (die, attr1, &item_cu); > > + if (item_die !=3D nullptr) > > + die =3D item_die; > > + } > > /* Data member other than a C++ static data member. */ ... and make that comment a little more conditional, like so: if (die->tag =3D=3D DW_TAG_namelist_item) { /* Typically, DW_TAG_namelist_item are references to XXX. If so, follow that reference. */ [...] } Logically, I undesrtand now why items of your nameslists are references to other entities, but perhaps this is not an absolute necessity? Otherwise, why did you feel it was worth verifying this before following the reference link? This is a bit minor, but at the same time, I find that it's important to provide good and clear comments, and they often impact heavily on how quickly one can understand (or misunderstand) the code. > > I think it would be better if you kept that comment at the start > of the if block, so above your special handling of DW_TAG_namelist_item. > > > /* Get type of field. */ > > @@ -15621,6 +15634,10 @@ read_structure_type (struct die_info *die, str= uct dwarf2_cu *cu) > > { > > type->set_code (TYPE_CODE_UNION); > > } > > + else if (die->tag =3D=3D DW_TAG_namelist) > > + { > > + type->set_code (TYPE_CODE_NAMELIST); > > + } > > else > > { > > type->set_code (TYPE_CODE_STRUCT); @@ -15823,7 +15840,8 @@ handl= e_struct_member_die (struct die_info *child_die, struct type *type, > > struct dwarf2_cu *cu) > > { > > if (child_die->tag =3D=3D DW_TAG_member > > - || child_die->tag =3D=3D DW_TAG_variable) > > + || child_die->tag =3D=3D DW_TAG_variable > > + || child_die->tag =3D=3D DW_TAG_namelist_item) > > { > > /* NOTE: carlton/2002-11-05: A C++ static data member > > should be a DW_TAG_member that is a declaration, but @@ -15867,7 += 15885,9 @@ handle_struct_member_die (struct die_info *child_die, struct typ= e *type, } > > > > /* Finish creating a structure or union type, including filling in > > - its members and creating a symbol for it. */ > > + its members and creating a symbol for it. This function also > > + handles Fortran namelist variable, its items or members and > > + creating a symbol for it. */ > > > > static void > > process_structure_scope (struct die_info *die, struct dwarf2_cu *cu) @= @ -21971,8 +21991,17 @@ new_symbol (struct die_info *die, struct type *type= , struct dwarf2_cu *cu, > > case DW_TAG_union_type: > > case DW_TAG_set_type: > > case DW_TAG_enumeration_type: > > - SYMBOL_ACLASS_INDEX (sym) =3D LOC_TYPEDEF; > > - SYMBOL_DOMAIN (sym) =3D STRUCT_DOMAIN; > > + case DW_TAG_namelist: > > + if (die->tag =3D=3D DW_TAG_namelist) > > + { > > + SYMBOL_ACLASS_INDEX (sym) =3D LOC_STATIC; > > + SYMBOL_DOMAIN (sym) =3D VAR_DOMAIN; > > + } > > + else > > + { > > + SYMBOL_ACLASS_INDEX (sym) =3D LOC_TYPEDEF; > > + SYMBOL_DOMAIN (sym) =3D STRUCT_DOMAIN; > > + } > > I have to say, I'm a little uncomfortable with this part of > the change -- perhaps simply because I don't understand it. > Does it make sense to handle DW_TAG_namelist here? This second > handles a group of *types*, wheres the change suggests that > namelist are more like *variables*. Should the two be handled > at the same place? What made you pick this part of the code > to insert support for DW_TAG_namelist? Or am I misunderstanding > the concept of namelists (which brings me back to the question > at the beginning)? > > Bhuvan start> > DW_TAG_namelist are similar to DW_TAG_structure_type or DW_TAG_union_type= , hence I have placed them here. Basically namelist variable nml (in the ab= ove sample program) is a group of items a and b. please note a and b are de= clared before only and storage is allocated as part of that. For namelist i= tems (a and b), there is no separate storage gets created or allocated, sam= e storage is used/referenced. DW_TAG_namelist_item points to the original v= ariable die. Hence namelist is just a group of such items. Main advantage o= f these namelist is that they can be used for I/O and they cannot be catego= rized strictly as type only, hence namelists are handled at the same place = as that of DW_TAG_structure_type, but since they can be used with I/O state= ments (which is the main advantage of using namelist in fortran), I have ca= tegorized them as VAR_DOMAIN, so that I can use it during print command as = well inside GDB. > Hence namelist cannot be categorized as type only feature, it's a combina= tion of type and variable, if we want to put it this way. > I have used a separate type (TYPE_CODE_NAMELIST) for namelist after Andre= w suggestion. > Bhuvan end> OK. Let's go with your approach. > > > { > > /* NOTE: carlton/2003-11-10: C++ class symbols shouldn't @@ -22= 909,6 +22938,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu) > > && die->tag !=3D DW_TAG_class_type > > && die->tag !=3D DW_TAG_interface_type > > && die->tag !=3D DW_TAG_structure_type > > + && die->tag !=3D DW_TAG_namelist > > && die->tag !=3D DW_TAG_union_type) > > return NULL; > > > > @@ -22933,6 +22963,7 @@ dwarf2_name (struct die_info *die, struct dwarf= 2_cu *cu) > > case DW_TAG_interface_type: > > case DW_TAG_structure_type: > > case DW_TAG_union_type: > > + case DW_TAG_namelist: > > /* Some GCC versions emit spurious DW_AT_name attributes for unn= amed > > structures or unions. These were of the form "._%d" in GCC 4.1, > > or simply "" or "" in GCC 4.3 d= iff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index 1791cb29451..5b3462= 2dacb 100644 > > --- a/gdb/f-typeprint.c > > +++ b/gdb/f-typeprint.c > > @@ -121,6 +121,7 @@ f_language::f_type_print_varspec_prefix (struct typ= e *type, > > case TYPE_CODE_UNDEF: > > case TYPE_CODE_STRUCT: > > case TYPE_CODE_UNION: > > + case TYPE_CODE_NAMELIST: > > case TYPE_CODE_ENUM: > > case TYPE_CODE_INT: > > case TYPE_CODE_FLT: > > @@ -261,6 +262,7 @@ f_language::f_type_print_varspec_suffix (struct typ= e *type, > > case TYPE_CODE_UNDEF: > > case TYPE_CODE_STRUCT: > > case TYPE_CODE_UNION: > > + case TYPE_CODE_NAMELIST: > > case TYPE_CODE_ENUM: > > case TYPE_CODE_INT: > > case TYPE_CODE_FLT: > > @@ -305,7 +307,8 @@ f_language::f_type_print_base (struct type *type, s= truct ui_file *stream, > > const char *prefix =3D ""; > > if (type->code () =3D=3D TYPE_CODE_UNION) > > prefix =3D "Type, C_Union :: "; > > - else if (type->code () =3D=3D TYPE_CODE_STRUCT) > > + else if (type->code () =3D=3D TYPE_CODE_STRUCT > > + || type->code () =3D=3D TYPE_CODE_NAMELIST) > > prefix =3D "Type "; > > fprintf_filtered (stream, "%*s%s%s", level, "", prefix, type->na= me ()); > > return; > > @@ -391,6 +394,7 @@ f_language::f_type_print_base (struct type *type, s= truct ui_file *stream, > > > > case TYPE_CODE_STRUCT: > > case TYPE_CODE_UNION: > > + case TYPE_CODE_NAMELIST: > > if (type->code () =3D=3D TYPE_CODE_UNION) > > fprintf_filtered (stream, "%*sType, C_Union :: ", level, ""); > > else > > diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 27d9a730978..6f8= 0b5a12ff 100644 > > --- a/gdb/f-valprint.c > > +++ b/gdb/f-valprint.c > > @@ -295,6 +295,7 @@ f_language::value_print_inner (struct value *val, s= truct ui_file *stream, > > > > case TYPE_CODE_STRUCT: > > case TYPE_CODE_UNION: > > + case TYPE_CODE_NAMELIST: > > /* Starting from the Fortran 90 standard, Fortran supports deriv= ed > > types. */ > > fprintf_filtered (stream, "( "); > > @@ -320,6 +321,16 @@ f_language::value_print_inner (struct value *val, = struct ui_file *stream, > > fputs_filtered (" =3D ", stream); > > } > > > > + /* While printing namelist items, fetch the appropriate value > > + field before printing its value. */ > > + if (type->code () =3D=3D TYPE_CODE_NAMELIST) > > + { > > + struct block_symbol symni =3D lookup_symbol (field_name, > > + get_selected_block (0), VAR_DOMAIN, nullptr); > > Can you fix the indentation here, please? On the second line, > the start of the parameters should be aligned with the start > of the parameters on the lines above. Also, remember that indentation > is 2 characters, not 4. You could have... > > struct block_symbol symni =3D lookup_symbol (field_name, > get_selected_block (0), > VAR_DOMAIN, nullptr); > > ... or (one parameter per line) ... > > struct block_symbol symni =3D lookup_symbol (field_name, > get_selected_block (0), > VAR_DOMAIN, > nullptr); > > ... or move all the parameters on the next line, with: > > struct block_symbol symni =3D lookup_symbol > (field_name, get_selected_block (0), VAR_DOMAIN, nullptr); > > > + if (symni.symbol !=3D nullptr) > > + field =3D value_of_variable (symni.symbol, symni.block)= ; > > + } > > + > > common_val_print (field, stream, recurse + 1, > > options, current_language); > > > > diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index dc575c42996..ba8a619= 87db 100644 > > --- a/gdb/gdbtypes.h > > +++ b/gdb/gdbtypes.h > > @@ -195,6 +195,8 @@ enum type_code > > > > /* * Fixed Point type. */ > > TYPE_CODE_FIXED_POINT, > > + > > + TYPE_CODE_NAMELIST, /**< Fortran namelist. */ > > In terms of documenting the enumerate, can you use the same style > as the other enums? This is actually important, because I believe > this is to allow us to use Doxygen to generate documentation (something > we may not have done for a while, but I'd rather we don't make it > worse). > > > > > /* * Some bits for the type's instance_flags word. See the macros dif= f --git a/gdb/testsuite/gdb.fortran/namelist.exp b/gdb/testsuite/gdb.fortra= n/namelist.exp > > new file mode 100644 > > index 00000000000..90762928455 > > --- /dev/null > > +++ b/gdb/testsuite/gdb.fortran/namelist.exp > > @@ -0,0 +1,49 @@ > > +# Copyright (C) 2021 Free Software Foundation, Inc. > > + > > +# This program is free software; you can redistribute it and/or modify > > +# it under the terms of the GNU General Public License as published by > > +# the Free Software Foundation; either version 3 of the License, or # > > +(at your option) any later version. > > +# > > +# This program is distributed in the hope that it will be useful, # bu= t > > +WITHOUT ANY WARRANTY; without even the implied warranty of # > > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU > > +General Public License for more details. > > +# > > +# You should have received a copy of the GNU General Public License # > > +along with this program. If not, see . > > + > > +# This file is part of the gdb testsuite. It contains tests for > > +fortran # namelist. > > I think there are trailing spaces at the end of several lines above. > While at it, would you mind please removing them all? > Or, actually, given the above, I'm wondering if this wasn't caused > by your mailer making some reformatting changes.. > > > + > > +if { [skip_fortran_tests] } { return -1 } > > + > > +standard_testfile .f90 > > +load_lib "fortran.exp" > > + > > +if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug= f90}]} { > > + return -1 > > +} > > + > > +if ![fortran_runto_main] then { > > + perror "couldn't run to main" > > + continue > > +} > > + > > +# Depending on the compiler being used, the type names can be printed = differently. > > Same request as in the commit message: It would be nice if we could > keep the code and comments without 80-characters whenever reasonable. > > > +set int [fortran_int4] > > + > > +gdb_breakpoint [gdb_get_line_number "Display namelist"] > > +gdb_continue_to_breakpoint "Display namelist" > > + > > +if {[test_compiler_info {gcc-*}]} { > > + gdb_test "ptype nml" \ > > + "type =3D Type nml\r\n *$int :: a\r\n *$int :: b\r\n *End Type= nml" > > + gdb_test "print nml" \ > > + "\\$\[0-9\]+ =3D \\( a =3D 10, b =3D 20 \\)" > > +} else { > > + gdb_test "ptype nml" \ > > + "No symbol \"nml\" in current context\\." > > + gdb_test "print nml" \ > > + "No symbol \"nml\" in current context\\." > > +} > > diff --git a/gdb/testsuite/gdb.fortran/namelist.f90 b/gdb/testsuite/gdb= .fortran/namelist.f90 > > new file mode 100644 > > index 00000000000..fb36690d765 > > --- /dev/null > > +++ b/gdb/testsuite/gdb.fortran/namelist.f90 > > @@ -0,0 +1,27 @@ > > +! Copyright (C) 2021 Free Software Foundation, Inc. > > +! > > +! This program is free software; you can redistribute it and/or modify > > +! it under the terms of the GNU General Public License as published by > > +! the Free Software Foundation; either version 3 of the License, or ! > > +(at your option) any later version. > > +! > > +! This program is distributed in the hope that it will be useful, ! bu= t > > +WITHOUT ANY WARRANTY; without even the implied warranty of ! > > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU > > +General Public License for more details. > > +! > > +! You should have received a copy of the GNU General Public License ! > > +along with this program. If not, see . > > +! > > +! This file is the Fortran source file for namelist.exp. > > + > > +program main > > + > > + integer :: a, b > > + namelist /nml/ a, b > > + > > + a =3D 10 > > + b =3D 20 > > + Write(*,nml) ! Display namelist > > + > > +end program main > > diff --git a/include/dwarf2.def b/include/dwarf2.def index 1ae6e1df298.= .6b8be1f6a16 100644 > > --- a/include/dwarf2.def > > +++ b/include/dwarf2.def > > @@ -289,7 +289,7 @@ DW_AT (DW_AT_frame_base, 0x40) DW_AT (DW_AT_friend= , 0x41) DW_AT (DW_AT_identifier_case, 0x42) DW_AT (DW_AT_macro_info, 0x43= ) -DW_AT (DW_AT_namelist_items, 0x44) > > +DW_AT (DW_AT_namelist_item, 0x44) > > DW_AT (DW_AT_priority, 0x45) > > DW_AT (DW_AT_segment, 0x46) > > DW_AT (DW_AT_specification, 0x47) > > -- > > 2.17.1 > > -----Original Message----- > From: Kumar N, Bhuvanendra > Sent: Friday, November 19, 2021 8:03 PM > To: aburgess@redhat.com > Cc: gdb-patches@sourceware.org; George, Jini Susan ; Achra, Nitika ; Sharma, Alok Kumar ; E, Nagajyothi ; Joseph, Ancel > Subject: RE: [PATCH] Fix ptype and print commands for namelist variables(= a fortran feature) > > [AMD Official Use Only] > > Hi Andrew, > > Looks like gfortran is emitting DW_TAG_namelist for "nml" twice, hence yo= u are seeing it twice with "info local" command. But clang/flang emits only= once, hence I am getting only once with "info local" command. > > my GDB command outputs are with clang/flang compiler. Please let me know = if you want to try with clang/flang, I can share the details, thanks a lot = again > > regards, > bhuvan > > -----Original Message----- > From: Kumar N, Bhuvanendra > Sent: Friday, November 19, 2021 7:39 PM > To: 'aburgess@redhat.com' > Cc: 'gdb-patches@sourceware.org' ; George, Ji= ni Susan ; Achra, Nitika ; = Sharma, Alok Kumar ; E, Nagajyothi ; Joseph, Ancel > Subject: FW: [PATCH] Fix ptype and print commands for namelist variables(= a fortran feature) > > [AMD Official Use Only] > > Hi Andrew, > > Thanks again for the review. Could you please use this revised patch for = the review, thanks > > I am resending the revised patch now and details are shared just below in= this email chain. > I am getting the proper outputs with "info local" as shown below. > > Regards, > bhuvan > > (gdb) i local > a =3D 10 > b =3D 20 > nml =3D ( a =3D 10, b =3D 20 ) > (gdb) pt nml > type =3D Type nml > integer :: a > integer :: b > End Type nml > (gdb) whatis nml > type =3D Type nml > > -----Original Message----- > From: Kumar N, Bhuvanendra > Sent: Friday, October 8, 2021 2:35 AM > To: Andrew Burgess > Cc: gdb-patches@sourceware.org; George, Jini Susan ; Achra, Nitika ; Sharma, Alok Kumar ; E, Nagajyothi > Subject: RE: [PATCH] Fix ptype and print commands for namelist variables(= a fortran feature) > > [AMD Official Use Only] > > Hi Andrew, > > Thanks again for your review comments. I have now introduced a new type(T= YPE_CODE_NAMELIST) for namelist type as you suggested, could you please rev= iew the revised changes. Updated patch is attached and also inlined with th= is email. There are no regressions found during testing. > > thanks, > bhuvan > > PATCH inlined: > > From 89b7f847042ccea44633f714db07400fa6dd3617 Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?=3DE2=3D80=3D9Cbhkumarn=3DE2=3D80=3D9D?=3D > Date: Fri, 8 Oct 2021 02:01:18 +0530 > Subject: [PATCH] gdb/fortran: Fix ptype and print commands for namelist = variables. > > GCC/gfortran support namelist(a fortran feature), it emits DW_TAG_namelis= t and DW_TAG_namelist_item dies. But gdb does not process these dies and su= pport namelist variables during print and ptype commands. When tried to pri= nt, it bails out with the error message as shown below. > (gdb) print nml > No symbol "nml" in current context. > This commit is to make the print and ptype commands work for namelist var= iables and its items. Sample output of these commands is shared below, with= fixed gdb. > (gdb) ptype nml > type =3D Type nml > integer(kind=3D4) :: a > integer(kind=3D4) :: b > End Type nml > (gdb) print nml > $1 =3D ( a =3D 10, b =3D 20 ) > --- > gdb/dwarf2/read.c | 43 ++++++++++++++++++---- > gdb/f-typeprint.c | 6 +++- > gdb/f-valprint.c | 11 ++++++ > gdb/gdbtypes.h | 2 ++ > gdb/testsuite/gdb.fortran/namelist.exp | 49 ++++++++++++++++++++++++++ > gdb/testsuite/gdb.fortran/namelist.f90 | 27 ++++++++++++++ > include/dwarf2.def | 2 +- > 7 files changed, 132 insertions(+), 8 deletions(-) create mode 100644 g= db/testsuite/gdb.fortran/namelist.exp > create mode 100644 gdb/testsuite/gdb.fortran/namelist.f90 > > diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index cbd9a3012eb..e6c= d8ed48f0 100644 > --- a/gdb/dwarf2/read.c > +++ b/gdb/dwarf2/read.c > @@ -9705,6 +9705,7 @@ process_die (struct die_info *die, struct dwarf2_cu= *cu) > case DW_TAG_interface_type: > case DW_TAG_structure_type: > case DW_TAG_union_type: > + case DW_TAG_namelist: > process_structure_scope (die, cu); > break; > case DW_TAG_enumeration_type: > @@ -14562,8 +14563,20 @@ dwarf2_add_field (struct field_info *fip, struct= die_info *die, > > fp =3D &new_field->field; > > - if (die->tag =3D=3D DW_TAG_member && ! die_is_declaration (die, cu)) > - { > + if ((die->tag =3D=3D DW_TAG_member || die->tag =3D=3D DW_TAG_namelist_= item) > + && ! die_is_declaration (die, cu)) > + { > + /* For the DW_TAG_namelist_item die, use the referenced die. */ > + if (die->tag =3D=3D DW_TAG_namelist_item) > + { > + struct attribute *attr1 =3D dwarf2_attr (die, DW_AT_namelist_i= tem, cu); > + struct die_info *item_die =3D nullptr; > + struct dwarf2_cu *item_cu =3D cu; > + if (attr1->form_is_ref ()) > + item_die =3D follow_die_ref (die, attr1, &item_cu); > + if (item_die !=3D nullptr) > + die =3D item_die; > + } > /* Data member other than a C++ static data member. */ > > /* Get type of field. */ > @@ -15621,6 +15634,10 @@ read_structure_type (struct die_info *die, struc= t dwarf2_cu *cu) > { > type->set_code (TYPE_CODE_UNION); > } > + else if (die->tag =3D=3D DW_TAG_namelist) > + { > + type->set_code (TYPE_CODE_NAMELIST); > + } > else > { > type->set_code (TYPE_CODE_STRUCT); @@ -15823,7 +15840,8 @@ handle_= struct_member_die (struct die_info *child_die, struct type *type, > struct dwarf2_cu *cu) > { > if (child_die->tag =3D=3D DW_TAG_member > - || child_die->tag =3D=3D DW_TAG_variable) > + || child_die->tag =3D=3D DW_TAG_variable > + || child_die->tag =3D=3D DW_TAG_namelist_item) > { > /* NOTE: carlton/2002-11-05: A C++ static data member > should be a DW_TAG_member that is a declaration, but @@ -15867,7 += 15885,9 @@ handle_struct_member_die (struct die_info *child_die, struct typ= e *type, } > > /* Finish creating a structure or union type, including filling in > - its members and creating a symbol for it. */ > + its members and creating a symbol for it. This function also > + handles Fortran namelist variable, its items or members and > + creating a symbol for it. */ > > static void > process_structure_scope (struct die_info *die, struct dwarf2_cu *cu) @@ = -21971,8 +21991,17 @@ new_symbol (struct die_info *die, struct type *type, = struct dwarf2_cu *cu, > case DW_TAG_union_type: > case DW_TAG_set_type: > case DW_TAG_enumeration_type: > - SYMBOL_ACLASS_INDEX (sym) =3D LOC_TYPEDEF; > - SYMBOL_DOMAIN (sym) =3D STRUCT_DOMAIN; > + case DW_TAG_namelist: > + if (die->tag =3D=3D DW_TAG_namelist) > + { > + SYMBOL_ACLASS_INDEX (sym) =3D LOC_STATIC; > + SYMBOL_DOMAIN (sym) =3D VAR_DOMAIN; > + } > + else > + { > + SYMBOL_ACLASS_INDEX (sym) =3D LOC_TYPEDEF; > + SYMBOL_DOMAIN (sym) =3D STRUCT_DOMAIN; > + } > > { > /* NOTE: carlton/2003-11-10: C++ class symbols shouldn't @@ -22= 909,6 +22938,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu) > && die->tag !=3D DW_TAG_class_type > && die->tag !=3D DW_TAG_interface_type > && die->tag !=3D DW_TAG_structure_type > + && die->tag !=3D DW_TAG_namelist > && die->tag !=3D DW_TAG_union_type) > return NULL; > > @@ -22933,6 +22963,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_= cu *cu) > case DW_TAG_interface_type: > case DW_TAG_structure_type: > case DW_TAG_union_type: > + case DW_TAG_namelist: > /* Some GCC versions emit spurious DW_AT_name attributes for unnam= ed > structures or unions. These were of the form "._%d" in GCC 4.1, > or simply "" or "" in GCC 4.3 d= iff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index 1791cb29451..5b3462= 2dacb 100644 > --- a/gdb/f-typeprint.c > +++ b/gdb/f-typeprint.c > @@ -121,6 +121,7 @@ f_language::f_type_print_varspec_prefix (struct type = *type, > case TYPE_CODE_UNDEF: > case TYPE_CODE_STRUCT: > case TYPE_CODE_UNION: > + case TYPE_CODE_NAMELIST: > case TYPE_CODE_ENUM: > case TYPE_CODE_INT: > case TYPE_CODE_FLT: > @@ -261,6 +262,7 @@ f_language::f_type_print_varspec_suffix (struct type = *type, > case TYPE_CODE_UNDEF: > case TYPE_CODE_STRUCT: > case TYPE_CODE_UNION: > + case TYPE_CODE_NAMELIST: > case TYPE_CODE_ENUM: > case TYPE_CODE_INT: > case TYPE_CODE_FLT: > @@ -305,7 +307,8 @@ f_language::f_type_print_base (struct type *type, str= uct ui_file *stream, > const char *prefix =3D ""; > if (type->code () =3D=3D TYPE_CODE_UNION) > prefix =3D "Type, C_Union :: "; > - else if (type->code () =3D=3D TYPE_CODE_STRUCT) > + else if (type->code () =3D=3D TYPE_CODE_STRUCT > + || type->code () =3D=3D TYPE_CODE_NAMELIST) > prefix =3D "Type "; > fprintf_filtered (stream, "%*s%s%s", level, "", prefix, type->name= ()); > return; > @@ -391,6 +394,7 @@ f_language::f_type_print_base (struct type *type, str= uct ui_file *stream, > > case TYPE_CODE_STRUCT: > case TYPE_CODE_UNION: > + case TYPE_CODE_NAMELIST: > if (type->code () =3D=3D TYPE_CODE_UNION) > fprintf_filtered (stream, "%*sType, C_Union :: ", level, ""); > else > diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 27d9a730978..6f80b= 5a12ff 100644 > --- a/gdb/f-valprint.c > +++ b/gdb/f-valprint.c > @@ -295,6 +295,7 @@ f_language::value_print_inner (struct value *val, str= uct ui_file *stream, > > case TYPE_CODE_STRUCT: > case TYPE_CODE_UNION: > + case TYPE_CODE_NAMELIST: > /* Starting from the Fortran 90 standard, Fortran supports derived > types. */ > fprintf_filtered (stream, "( "); > @@ -320,6 +321,16 @@ f_language::value_print_inner (struct value *val, st= ruct ui_file *stream, > fputs_filtered (" =3D ", stream); > } > > + /* While printing namelist items, fetch the appropriate value > + field before printing its value. */ > + if (type->code () =3D=3D TYPE_CODE_NAMELIST) > + { > + struct block_symbol symni =3D lookup_symbol (field_name, > + get_selected_block (0), VAR_DOMAIN, nullptr); > + if (symni.symbol !=3D nullptr) > + field =3D value_of_variable (symni.symbol, symni.block)= ; > + } > + > common_val_print (field, stream, recurse + 1, > options, current_language); > > diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index dc575c42996..ba8a61987= db 100644 > --- a/gdb/gdbtypes.h > +++ b/gdb/gdbtypes.h > @@ -195,6 +195,8 @@ enum type_code > > /* * Fixed Point type. */ > TYPE_CODE_FIXED_POINT, > + > + TYPE_CODE_NAMELIST, /**< Fortran namelist. */ > }; > > /* * Some bits for the type's instance_flags word. See the macros diff = --git a/gdb/testsuite/gdb.fortran/namelist.exp b/gdb/testsuite/gdb.fortran/= namelist.exp > new file mode 100644 > index 00000000000..90762928455 > --- /dev/null > +++ b/gdb/testsuite/gdb.fortran/namelist.exp > @@ -0,0 +1,49 @@ > +# Copyright (C) 2021 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or # > +(at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, # but > +WITHOUT ANY WARRANTY; without even the implied warranty of # > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU > +General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License # > +along with this program. If not, see . > + > +# This file is part of the gdb testsuite. It contains tests for > +fortran # namelist. > + > +if { [skip_fortran_tests] } { return -1 } > + > +standard_testfile .f90 > +load_lib "fortran.exp" > + > +if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f= 90}]} { > + return -1 > +} > + > +if ![fortran_runto_main] then { > + perror "couldn't run to main" > + continue > +} > + > +# Depending on the compiler being used, the type names can be printed di= fferently. > +set int [fortran_int4] > + > +gdb_breakpoint [gdb_get_line_number "Display namelist"] > +gdb_continue_to_breakpoint "Display namelist" > + > +if {[test_compiler_info {gcc-*}]} { > + gdb_test "ptype nml" \ > + "type =3D Type nml\r\n *$int :: a\r\n *$int :: b\r\n *End Type n= ml" > + gdb_test "print nml" \ > + "\\$\[0-9\]+ =3D \\( a =3D 10, b =3D 20 \\)" > +} else { > + gdb_test "ptype nml" \ > + "No symbol \"nml\" in current context\\." > + gdb_test "print nml" \ > + "No symbol \"nml\" in current context\\." > +} > diff --git a/gdb/testsuite/gdb.fortran/namelist.f90 b/gdb/testsuite/gdb.f= ortran/namelist.f90 > new file mode 100644 > index 00000000000..fb36690d765 > --- /dev/null > +++ b/gdb/testsuite/gdb.fortran/namelist.f90 > @@ -0,0 +1,27 @@ > +! Copyright (C) 2021 Free Software Foundation, Inc. > +! > +! This program is free software; you can redistribute it and/or modify > +! it under the terms of the GNU General Public License as published by > +! the Free Software Foundation; either version 3 of the License, or ! > +(at your option) any later version. > +! > +! This program is distributed in the hope that it will be useful, ! but > +WITHOUT ANY WARRANTY; without even the implied warranty of ! > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU > +General Public License for more details. > +! > +! You should have received a copy of the GNU General Public License ! > +along with this program. If not, see . > +! > +! This file is the Fortran source file for namelist.exp. > + > +program main > + > + integer :: a, b > + namelist /nml/ a, b > + > + a =3D 10 > + b =3D 20 > + Write(*,nml) ! Display namelist > + > +end program main > diff --git a/include/dwarf2.def b/include/dwarf2.def index 1ae6e1df298..6= b8be1f6a16 100644 > --- a/include/dwarf2.def > +++ b/include/dwarf2.def > @@ -289,7 +289,7 @@ DW_AT (DW_AT_frame_base, 0x40) DW_AT (DW_AT_friend, = 0x41) DW_AT (DW_AT_identifier_case, 0x42) DW_AT (DW_AT_macro_info, 0x43) = -DW_AT (DW_AT_namelist_items, 0x44) > +DW_AT (DW_AT_namelist_item, 0x44) > DW_AT (DW_AT_priority, 0x45) > DW_AT (DW_AT_segment, 0x46) > DW_AT (DW_AT_specification, 0x47) > -- > 2.17.1 > > > -----Original Message----- > From: Andrew Burgess > Sent: Wednesday, October 6, 2021 9:22 PM > To: Kumar N, Bhuvanendra > Cc: gdb-patches@sourceware.org; George, Jini Susan ; Achra, Nitika ; Sharma, Alok Kumar ; E, Nagajyothi > Subject: Re: [PATCH] Fix ptype and print commands for namelist variables(= a fortran feature) > > [CAUTION: External Email] > > * Kumar N, Bhuvanendra [2021-09-22 12:38:20 = +0000]: > > > [AMD Official Use Only] > > > > Hi Andrew, > > > > Thanks a lot for your review comments, I have addressed all the review = comments and tested. Updated patch is attached and also inlined with this e= mail. > > > > >I'm a little uncomfortable with this if condition. This feels like a = bit of a hack. Is there precedent anywhere else in GDB for using the type = specific field like this? > > >Wouldn't adding a TYPE_CODE_NAMELIST be more in keeping with how GDB c= urrently does things, though I understand this is likely to make the patch = slightly bigger. Did you consider this approach? > > > > Regarding your major comment, I did considered introducing a new type > > specific field for namelist earlier, instead of using any of those > > existing. Reason I did not included in my earlier patch was, > > type_specific_kind is declared with 3 bits in struct main_type and > > already there were 8 values, hence deferred expanding > > type_specific_kind etc.... But now I have done that, thanks for the > > suggestion. > > Except that wasn't quite what I suggested; I actually asked whether namel= ist's should become their own type altogether, notice I suggested TYPE_CODE= _NAMELIST. > > Though what you have here is nice in its simplicity, but I can't shake th= e feeling that its not the right solution. > > I'll need to think about this some more - maybe others have an opinion? > > Thanks, > Andrew > > > > > > > > > Regards, > > bhuvan > > > > PATH inlined: > > > > From 59053daf1018c3e4bcae8cd342d46b00f4f03648 Mon Sep 17 00:00:00 2001 > > From: =3D?UTF-8?q?=3DE2=3D80=3D9Cbhkumarn=3DE2=3D80=3D9D?=3D > > > > Date: Wed, 22 Sep 2021 17:52:15 +0530 > > Subject: [PATCH] Fix ptype and print commands for namelist variables(a > > fortran feature). > > > > GCC/gfortran support namelist(a fortran feature), it emits > > DW_TAG_namelist and DW_TAG_namelist_item dies. But gdb does not > > process these dies and support namelist variables during print and > > ptype commands. When tried to print, it bails out with the error messag= e as shown below. > > (gdb) print nml > > No symbol "nml" in current context. > > This commit is to make the print and ptype commands work for namelist > > variables and its items. Sample output of these commands is shared > > below, with fixed gdb. > > (gdb) ptype nml > > type =3D Type nml > > integer(kind=3D4) :: a > > integer(kind=3D4) :: b > > End Type nml > > (gdb) print nml > > $1 =3D ( a =3D 10, b =3D 20 ) > > --- > > gdb/ChangeLog | 11 ++++++ > > gdb/dwarf2/read.c | 44 +++++++++++++++++++---- > > gdb/f-valprint.c | 10 ++++++ > > gdb/gdbtypes.h | 3 +- > > gdb/testsuite/ChangeLog | 5 +++ > > gdb/testsuite/gdb.fortran/namelist.exp | 49 > > ++++++++++++++++++++++++++ > > gdb/testsuite/gdb.fortran/namelist.f90 | 27 ++++++++++++++ > > include/dwarf2.def | 2 +- > > 8 files changed, 142 insertions(+), 9 deletions(-) create mode > > 100644 gdb/testsuite/gdb.fortran/namelist.exp > > create mode 100644 gdb/testsuite/gdb.fortran/namelist.f90 > > > > diff --git a/gdb/ChangeLog b/gdb/ChangeLog index > > 36cb4c9e7e9..ec01c2957e9 100644 > > --- a/gdb/ChangeLog > > +++ b/gdb/ChangeLog > > @@ -1,3 +1,14 @@ > > +2021-08-23 Bhuvanendra Kumar N > > + > > + * dwarf2/read.c (process_die): Add new case for namelist. > > + (dwarf2_add_field): Process DW_TAG_namelist_item die. > > + (read_structure_type, handle_struct_member_die, new_symbol) > > + (dwarf2_name): Update. > > + * f-valprint.c (f_language::value_print_inner): Add support for > > + printing namelist items. > > + * include/dwarf2.def: (DW_AT_namelist_items): Renamed to ... > > + (DW_AT_namelist_item): ... this. As per dwarf standard. > > + > > 2021-06-08 Lancelot Six > > > > * python/lib/gdb/FrameDecorator.py (FrameDecorator): Use 'is None= ' > > diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index > > 96009f1418f..88db06ec9e7 100644 > > --- a/gdb/dwarf2/read.c > > +++ b/gdb/dwarf2/read.c > > @@ -9570,6 +9570,7 @@ process_die (struct die_info *die, struct dwarf2_= cu *cu) > > case DW_TAG_interface_type: > > case DW_TAG_structure_type: > > case DW_TAG_union_type: > > + case DW_TAG_namelist: > > process_structure_scope (die, cu); > > break; > > case DW_TAG_enumeration_type: > > @@ -14417,8 +14418,20 @@ dwarf2_add_field (struct field_info *fip, > > struct die_info *die, > > > > fp =3D &new_field->field; > > > > - if (die->tag =3D=3D DW_TAG_member && ! die_is_declaration (die, cu)) > > - { > > + if ((die->tag =3D=3D DW_TAG_member || die->tag =3D=3D DW_TAG_namelis= t_item) > > + && ! die_is_declaration (die, cu)) > > + { > > + /* For the DW_TAG_namelist_item die, use the referenced die. */ > > + if (die->tag =3D=3D DW_TAG_namelist_item) > > + { > > + struct attribute *attr1 =3D dwarf2_attr (die, DW_AT_namelist= _item, cu); > > + struct die_info *item_die =3D nullptr; > > + struct dwarf2_cu *item_cu =3D cu; > > + if (attr1->form_is_ref ()) > > + item_die =3D follow_die_ref (die, attr1, &item_cu); > > + if (item_die !=3D nullptr) > > + die =3D item_die; > > + } > > /* Data member other than a C++ static data member. */ > > > > /* Get type of field. */ > > @@ -15448,7 +15461,10 @@ read_structure_type (struct die_info *die, str= uct dwarf2_cu *cu) > > } > > > > type =3D alloc_type (objfile); > > - INIT_CPLUS_SPECIFIC (type); > > + if (die->tag =3D=3D DW_TAG_namelist) > > + TYPE_SPECIFIC_FIELD (type) =3D TYPE_SPECIFIC_NAMELIST; else > > + INIT_CPLUS_SPECIFIC (type); > > > > name =3D dwarf2_name (die, cu); > > if (name !=3D NULL) > > @@ -15684,7 +15700,8 @@ handle_struct_member_die (struct die_info *chil= d_die, struct type *type, > > struct dwarf2_cu *cu) { > > if (child_die->tag =3D=3D DW_TAG_member > > - || child_die->tag =3D=3D DW_TAG_variable) > > + || child_die->tag =3D=3D DW_TAG_variable > > + || child_die->tag =3D=3D DW_TAG_namelist_item) > > { > > /* NOTE: carlton/2002-11-05: A C++ static data member > > should be a DW_TAG_member that is a declaration, but @@ > > -15728,7 +15745,9 @@ handle_struct_member_die (struct die_info > > *child_die, struct type *type, } > > > > /* Finish creating a structure or union type, including filling in > > - its members and creating a symbol for it. */ > > + its members and creating a symbol for it. This function also > > + handles Fortran namelist variable, its items or members and > > + creating a symbol for it. */ > > > > static void > > process_structure_scope (struct die_info *die, struct dwarf2_cu *cu) > > @@ -21807,8 +21826,17 @@ new_symbol (struct die_info *die, struct type = *type, struct dwarf2_cu *cu, > > case DW_TAG_union_type: > > case DW_TAG_set_type: > > case DW_TAG_enumeration_type: > > - SYMBOL_ACLASS_INDEX (sym) =3D LOC_TYPEDEF; > > - SYMBOL_DOMAIN (sym) =3D STRUCT_DOMAIN; > > + case DW_TAG_namelist: > > + if (die->tag =3D=3D DW_TAG_namelist) > > + { > > + SYMBOL_ACLASS_INDEX (sym) =3D LOC_STATIC; > > + SYMBOL_DOMAIN (sym) =3D VAR_DOMAIN; > > + } > > + else > > + { > > + SYMBOL_ACLASS_INDEX (sym) =3D LOC_TYPEDEF; > > + SYMBOL_DOMAIN (sym) =3D STRUCT_DOMAIN; > > + } > > > > { > > /* NOTE: carlton/2003-11-10: C++ class symbols shouldn't @@ > > -22744,6 +22772,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_c= u *cu) > > && die->tag !=3D DW_TAG_class_type > > && die->tag !=3D DW_TAG_interface_type > > && die->tag !=3D DW_TAG_structure_type > > + && die->tag !=3D DW_TAG_namelist > > && die->tag !=3D DW_TAG_union_type) > > return NULL; > > > > @@ -22768,6 +22797,7 @@ dwarf2_name (struct die_info *die, struct dwarf= 2_cu *cu) > > case DW_TAG_interface_type: > > case DW_TAG_structure_type: > > case DW_TAG_union_type: > > + case DW_TAG_namelist: > > /* Some GCC versions emit spurious DW_AT_name attributes for unn= amed > > structures or unions. These were of the form "._%d" in GCC 4.1, > > or simply "" or "" in GCC > > 4.3 diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index > > 240daaf34f9..aa86fbc901e 100644 > > --- a/gdb/f-valprint.c > > +++ b/gdb/f-valprint.c > > @@ -320,6 +320,16 @@ f_language::value_print_inner (struct value *val, = struct ui_file *stream, > > fputs_filtered (" =3D ", stream); > > } > > > > + /* While printing namelist items, fetch the appropriate val= ue > > + field before printing its value. */ > > + if (TYPE_SPECIFIC_FIELD (type) =3D=3D TYPE_SPECIFIC_NAMELIS= T) > > + { > > + struct block_symbol symni =3D lookup_symbol (field_name= , > > + get_selected_block (0), VAR_DOMAIN, nullptr); > > + if (symni.symbol !=3D nullptr) > > + field =3D value_of_variable (symni.symbol, symni.bloc= k); > > + } > > + > > common_val_print (field, stream, recurse + 1, > > options, current_language); > > > > diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index > > 0cc00e74a20..124282c3d53 100644 > > --- a/gdb/gdbtypes.h > > +++ b/gdb/gdbtypes.h > > @@ -607,6 +607,7 @@ enum type_specific_kind > > TYPE_SPECIFIC_SELF_TYPE, > > TYPE_SPECIFIC_INT, > > TYPE_SPECIFIC_FIXED_POINT, > > + TYPE_SPECIFIC_NAMELIST, > > }; > > > > union type_owner > > @@ -833,7 +834,7 @@ struct main_type > > /* * A discriminant telling us which field of the type_specific > > union is being used for this type, if any. */ > > > > - ENUM_BITFIELD(type_specific_kind) type_specific_field : 3; > > + ENUM_BITFIELD(type_specific_kind) type_specific_field : 4; > > > > /* * Number of fields described for this type. This field appears > > at this location because it packs nicely here. */ diff --git > > a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index > > 87cf3e2a061..33f60c29b3c 100644 > > --- a/gdb/testsuite/ChangeLog > > +++ b/gdb/testsuite/ChangeLog > > @@ -1,3 +1,8 @@ > > +2021-07-26 Bhuvanendra Kumar N > > + > > + * gdb.fortran/namelist.exp: New file. > > + * gdb.fortran/namelist.f90: New file. > > + > > 2021-06-10 Bhuvanendra Kumar N > > > > * gdb.fortran/ptype-on-functions.exp: Add type info of formal > > diff --git a/gdb/testsuite/gdb.fortran/namelist.exp > > b/gdb/testsuite/gdb.fortran/namelist.exp > > new file mode 100644 > > index 00000000000..90762928455 > > --- /dev/null > > +++ b/gdb/testsuite/gdb.fortran/namelist.exp > > @@ -0,0 +1,49 @@ > > +# Copyright (C) 2021 Free Software Foundation, Inc. > > + > > +# This program is free software; you can redistribute it and/or > > +modify # it under the terms of the GNU General Public License as > > +published by # the Free Software Foundation; either version 3 of the > > +License, or # (at your option) any later version. > > +# > > +# This program is distributed in the hope that it will be useful, # > > +but WITHOUT ANY WARRANTY; without even the implied warranty of # > > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU > > +General Public License for more details. > > +# > > +# You should have received a copy of the GNU General Public License # > > +along with this program. If not, see . > > + > > +# This file is part of the gdb testsuite. It contains tests for > > +fortran # namelist. > > + > > +if { [skip_fortran_tests] } { return -1 } > > + > > +standard_testfile .f90 > > +load_lib "fortran.exp" > > + > > +if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug= f90}]} { > > + return -1 > > +} > > + > > +if ![fortran_runto_main] then { > > + perror "couldn't run to main" > > + continue > > +} > > + > > +# Depending on the compiler being used, the type names can be printed = differently. > > +set int [fortran_int4] > > + > > +gdb_breakpoint [gdb_get_line_number "Display namelist"] > > +gdb_continue_to_breakpoint "Display namelist" > > + > > +if {[test_compiler_info {gcc-*}]} { > > + gdb_test "ptype nml" \ > > + "type =3D Type nml\r\n *$int :: a\r\n *$int :: b\r\n *End Type= nml" > > + gdb_test "print nml" \ > > + "\\$\[0-9\]+ =3D \\( a =3D 10, b =3D 20 \\)" > > +} else { > > + gdb_test "ptype nml" \ > > + "No symbol \"nml\" in current context\\." > > + gdb_test "print nml" \ > > + "No symbol \"nml\" in current context\\." > > +} > > diff --git a/gdb/testsuite/gdb.fortran/namelist.f90 > > b/gdb/testsuite/gdb.fortran/namelist.f90 > > new file mode 100644 > > index 00000000000..fb36690d765 > > --- /dev/null > > +++ b/gdb/testsuite/gdb.fortran/namelist.f90 > > @@ -0,0 +1,27 @@ > > +! Copyright (C) 2021 Free Software Foundation, Inc. > > +! > > +! This program is free software; you can redistribute it and/or > > +modify ! it under the terms of the GNU General Public License as > > +published by ! the Free Software Foundation; either version 3 of the > > +License, or ! (at your option) any later version. > > +! > > +! This program is distributed in the hope that it will be useful, ! > > +but WITHOUT ANY WARRANTY; without even the implied warranty of ! > > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU > > +General Public License for more details. > > +! > > +! You should have received a copy of the GNU General Public License ! > > +along with this program. If not, see . > > +! > > +! This file is the Fortran source file for namelist.exp. > > + > > +program main > > + > > + integer :: a, b > > + namelist /nml/ a, b > > + > > + a =3D 10 > > + b =3D 20 > > + Write(*,nml) ! Display namelist > > + > > +end program main > > diff --git a/include/dwarf2.def b/include/dwarf2.def index > > 1ae6e1df298..6b8be1f6a16 100644 > > --- a/include/dwarf2.def > > +++ b/include/dwarf2.def > > @@ -289,7 +289,7 @@ DW_AT (DW_AT_frame_base, 0x40) DW_AT > > (DW_AT_friend, 0x41) DW_AT (DW_AT_identifier_case, 0x42) DW_AT > > (DW_AT_macro_info, 0x43) -DW_AT (DW_AT_namelist_items, 0x44) > > +DW_AT (DW_AT_namelist_item, 0x44) > > DW_AT (DW_AT_priority, 0x45) > > DW_AT (DW_AT_segment, 0x46) > > DW_AT (DW_AT_specification, 0x47) > > -- > > 2.17.1 > > > > > > -----Original Message----- > > From: Andrew Burgess > > Sent: Monday, September 20, 2021 3:11 PM > > To: Kumar N, Bhuvanendra > > Cc: gdb-patches@sourceware.org; George, Jini Susan > > ; Achra, Nitika ; > > Sharma, Alok Kumar ; E, Nagajyothi > > > > Subject: Re: [PATCH] Fix ptype and print commands for namelist > > variables(a fortran feature) > > > > [CAUTION: External Email] > > > > * Kumar N, Bhuvanendra via Gdb-patches [20= 21-08-24 09:16:19 +0000]: > > > > > [AMD Official Use Only] > > > > > > Hi all, > > > > > > Requesting code review for this GDB patch. Required patch is attached= and also inlined below with this email. > > > > > > Problem description/summary: > > > > > > GCC/gfortran support namelist(a fortran feature), it emits DW_TAG_nam= elist and DW_TAG_namelist_item dies. But gdb does not process these dies an= d support namelist variables during print and ptype commands. When tried to= print, it bails out with the error message as shown below. > > > (gdb) print nml > > > No symbol "nml" in current context. > > > > > > Fix details: > > > > > > This fix is to make the print and ptype commands work for namelist va= riables and its items. Sample output of these commands is shared below, wit= h fixed gdb. > > > > > > (gdb) ptype nml > > > type =3D Type nml > > > integer(kind=3D4) :: a > > > integer(kind=3D4) :: b > > > End Type nml > > > (gdb) print nml > > > $1 =3D ( a =3D 10, b =3D 20 ) > > > > bhuvan, > > > > Thanks for working on this. I have some small style issues, but I have= a bigger question which you'll find inline. > > > > Thanks, > > Andrew > > > > > > > > > > gdb/ChangeLog: > > > > > > * dwarf2/read.c (process_die): Add new case for namelist. > > > (dwarf2_add_field): Process DW_TAG_namelist_item die. > > > (read_structure_type, handle_struct_member_die, new_symbol) > > > (dwarf2_name): Update. > > > * f-valprint.c (f_language::value_print_inner): Add support fo= r > > > printing namelist items. > > > * include/dwarf2.def: (DW_AT_namelist_items): Renamed to ... > > > (DW_AT_namelist_item): ... this. As per dwarf standard. > > > > > > gdb/testsuite/ChangeLog: > > > > > > * gdb.fortran/namelist.exp: New file. > > > * gdb.fortran/namelist.f90: New file. > > > > > > NOTE: Similarly renaming DW_AT_namelist_items to DW_AT_namelist_item = as per DWARF standard naming convention in GCC/gfortran repo (https://nam11= .safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fgithub.com%2Fgcc-mir= ror%2Fgcc&data=3D04%7C01%7CBhuvanendra.KumarN%40amd.com%7C6ae3b002df6f4= f99442808d9b728e775%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C6377422086= 05806843%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTi= I6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=3DWt7zD2zRCOU%2Flds18hQFQotlDjD6G= pzUh0Hntq4pGFo%3D&reserved=3D0) will be handled in separate PATCH. I wi= ll raise separate patch for this. > > > > > > regards, > > > bhuvan > > > > > > Patch inlined: > > > > > > From 0775cbf3716bae9480c3f1f1d9d8860ac561929e Mon Sep 17 00:00:00 > > > 2001 > > > From: =3D?UTF-8?q?=3DE2=3D80=3D9Cbhkumarn=3DE2=3D80=3D9D?=3D > > > Bhuvanendra.KumarN@amd.com > > > Date: Mon, 24 Aug 2021 11:49:14 +0530 > > > Subject: [PATCH] Fix ptype and print commands for namelist > > > variables(a fortran feature). > > > > > > GCC/gfortran support namelist(a fortran feature), it emits > > > DW_TAG_namelist and DW_TAG_namelist_item dies. But gdb does not > > > process these dies and support namelist variables during print and > > > ptype commands. When tried to print, it bails out with the error mess= age as shown below. > > > (gdb) print nml > > > No symbol "nml" in current context. > > > This commit is to make the print and ptype commands work for > > > namelist variables and its items. Sample output of these commands is > > > shared below, with fixed gdb. > > > (gdb) ptype nml > > > type =3D Type nml > > > integer(kind=3D4) :: a > > > integer(kind=3D4) :: b > > > End Type nml > > > (gdb) print nml > > > $1 =3D ( a =3D 10, b =3D 20 ) > > > --- > > > gdb/ChangeLog | 11 +++++++ > > > gdb/dwarf2/read.c | 41 +++++++++++++++++++---- > > > gdb/f-valprint.c | 10 ++++++ > > > gdb/testsuite/ChangeLog | 5 +++ > > > gdb/testsuite/gdb.fortran/namelist.exp | 45 > > > ++++++++++++++++++++++++++ > > > gdb/testsuite/gdb.fortran/namelist.f90 | 27 ++++++++++++++++ > > > include/dwarf2.def | 2 +- > > > 7 files changed, 134 insertions(+), 7 deletions(-) create mode > > > 100644 gdb/testsuite/gdb.fortran/namelist.exp > > > create mode 100644 gdb/testsuite/gdb.fortran/namelist.f90 > > > > > > diff --git a/gdb/ChangeLog b/gdb/ChangeLog index > > > 36cb4c9e7e9..ec01c2957e9 100644 > > > --- a/gdb/ChangeLog > > > +++ b/gdb/ChangeLog > > > @@ -1,3 +1,14 @@ > > > +2021-08-23 Bhuvanendra Kumar N > > > +Bhuvanendra.KumarN@amd.com > > > + > > > + * dwarf2/read.c (process_die): Add new case for namelist. > > > + (dwarf2_add_field): Process DW_TAG_namelist_item die. > > > + (read_structure_type, handle_struct_member_die, new_symbol) > > > + (dwarf2_name): Update. > > > + * f-valprint.c (f_language::value_print_inner): Add support for > > > + printing namelist items. > > > + * include/dwarf2.def: (DW_AT_namelist_items): Renamed to ... > > > + (DW_AT_namelist_item): ... this. As per dwarf standard. > > > + > > > 2021-06-08 Lancelot Six lsix@lancelotsix.com > > > * python/lib/gdb/FrameDecorator.py (FrameDecorator): Use 'is No= ne' > > > diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index > > > 96009f1418f..54528d67498 100644 > > > --- a/gdb/dwarf2/read.c > > > +++ b/gdb/dwarf2/read.c > > > @@ -9570,6 +9570,7 @@ process_die (struct die_info *die, struct dwarf= 2_cu *cu) > > > case DW_TAG_interface_type: > > > case DW_TAG_structure_type: > > > case DW_TAG_union_type: > > > + case DW_TAG_namelist: > > > process_structure_scope (die, cu); > > > break; > > > case DW_TAG_enumeration_type: > > > @@ -14417,8 +14418,20 @@ dwarf2_add_field (struct field_info *fip, st= ruct die_info *die, > > > fp =3D &new_field->field; > > > - if (die->tag =3D=3D DW_TAG_member && ! die_is_declaration (die, cu= )) > > > - { > > > + if ((die->tag =3D=3D DW_TAG_member || die->tag =3D=3D DW_TAG_namel= ist_item) && > > > + ! die_is_declaration (die, cu)) > > > > The '&&' operator should start the line. > > > > > + { > > > + /* For the DW_TAG_namelist_item die, use the referenced die. = */ > > > + if (die->tag =3D=3D DW_TAG_namelist_item) > > > + { > > > + struct attribute *attr1 =3D dwarf2_attr (die, DW_AT_nameli= st_item, cu); > > > + struct die_info *item_die =3D NULL; > > > > Throughout this patch, please use nullptr instead of NULL. > > > > > + struct dwarf2_cu *item_cu =3D cu; > > > + if (attr1->form_is_ref ()) > > > + item_die =3D follow_die_ref (die, attr1, &item_cu); > > > + if (item_die !=3D NULL) > > > + die =3D item_die; > > > + } > > > /* Data member other than a C++ static data member. */ > > > /* Get type of field. */ > > > @@ -15449,6 +15462,8 @@ read_structure_type (struct die_info *die, st= ruct dwarf2_cu *cu) > > > type =3D alloc_type (objfile); > > > INIT_CPLUS_SPECIFIC (type); > > > + if (die->tag =3D=3D DW_TAG_namelist) > > > + INIT_NONE_SPECIFIC (type); > > > > I think you should use if/then/else and place INIT_CPLUS_SPECIFIC in th= e else block. > > > > > name =3D dwarf2_name (die, cu); > > > if (name !=3D NULL) > > > @@ -15684,7 +15699,8 @@ handle_struct_member_die (struct die_info *ch= ild_die, struct type *type, > > > struct dwarf2_cu *cu) { > > > if (child_die->tag =3D=3D DW_TAG_member > > > - || child_die->tag =3D=3D DW_TAG_variable) > > > + || child_die->tag =3D=3D DW_TAG_variable > > > + || child_die->tag =3D=3D DW_TAG_namelist_item) > > > { > > > /* NOTE: carlton/2002-11-05: A C++ static data member > > > should be a DW_TAG_member that is a declaration, but @@ > > > -15728,7 > > > +15744,9 @@ handle_struct_member_die (struct die_info *child_die, > > > struct type *type, } > > > /* Finish creating a structure or union type, including filling in > > > - its members and creating a symbol for it. */ > > > + its members and creating a symbol for it. This function also > > > + handles Fortran namelist variable, its items or members and > > > + creating a symbol for it. */ > > > static void > > > process_structure_scope (struct die_info *die, struct dwarf2_cu *cu) > > > @@ -21807,8 +21825,17 @@ new_symbol (struct die_info *die, struct typ= e *type, struct dwarf2_cu *cu, > > > case DW_TAG_union_type: > > > case DW_TAG_set_type: > > > case DW_TAG_enumeration_type: > > > - SYMBOL_ACLASS_INDEX (sym) =3D LOC_TYPEDEF; > > > - SYMBOL_DOMAIN (sym) =3D STRUCT_DOMAIN; > > > + case DW_TAG_namelist: > > > + if (die->tag =3D=3D DW_TAG_namelist) > > > + { > > > + SYMBOL_ACLASS_INDEX (sym) =3D LOC_STATIC; > > > + SYMBOL_DOMAIN (sym) =3D VAR_DOMAIN; > > > + } > > > + else > > > + { > > > + SYMBOL_ACLASS_INDEX (sym) =3D LOC_TYPEDEF; > > > + SYMBOL_DOMAIN (sym) =3D STRUCT_DOMAIN; > > > + } > > > { > > > /* NOTE: carlton/2003-11-10: C++ class symbols shouldn't @@ > > > -22744,6 +22771,7 @@ dwarf2_name (struct die_info *die, struct dwarf2= _cu *cu) > > > && die->tag !=3D DW_TAG_class_type > > > && die->tag !=3D DW_TAG_interface_type > > > && die->tag !=3D DW_TAG_structure_type > > > + && die->tag !=3D DW_TAG_namelist > > > && die->tag !=3D DW_TAG_union_type) > > > return NULL; > > > @@ -22768,6 +22796,7 @@ dwarf2_name (struct die_info *die, struct dwa= rf2_cu *cu) > > > case DW_TAG_interface_type: > > > case DW_TAG_structure_type: > > > case DW_TAG_union_type: > > > + case DW_TAG_namelist: > > > /* Some GCC versions emit spurious DW_AT_name attributes for u= nnamed > > > structures or unions. These were of the form "._%d" in GCC 4.1= , > > > or simply "" or "" in GCC > > > 4.3 diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index > > > 240daaf34f9..8ed35e2fb1f 100644 > > > --- a/gdb/f-valprint.c > > > +++ b/gdb/f-valprint.c > > > @@ -320,6 +320,16 @@ f_language::value_print_inner (struct value *val= , struct ui_file *stream, > > > fputs_filtered (" =3D ", stream); > > > } > > > + /* While printing namelist items, fetch the appropriate v= alue > > > + field before printing its value. */ > > > + if (TYPE_SPECIFIC_FIELD (type) =3D=3D TYPE_SPECIFIC_NONE) > > > > I'm a little uncomfortable with this if condition. This feels like a b= it of a hack. Is there precedent anywhere else in GDB for using the type s= pecific field like this? > > > > Wouldn't adding a TYPE_CODE_NAMELIST be more in keeping with how GDB cu= rrently does things, though I understand this is likely to make the patch s= lightly bigger. Did you consider this approach? > > > > > > > > > > > + { > > > + struct block_symbol symni =3D lookup_symbol(field_nam= e, > > > + get_selected_block (0), VAR_DOMAIN, nullptr); > > > > There's a missing space before '(' here, and two lines below. > > > > > + if (symni.symbol !=3D NULL) > > > + field =3D value_of_variable(symni.symbol, symni.blo= ck); > > > + } > > > + > > > common_val_print (field, stream, recurse + 1, > > > options, current_language); diff --git > > > a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index > > > 87cf3e2a061..33f60c29b3c 100644 > > > --- a/gdb/testsuite/ChangeLog > > > +++ b/gdb/testsuite/ChangeLog > > > @@ -1,3 +1,8 @@ > > > +2021-07-26 Bhuvanendra Kumar N > > > +Bhuvanendra.KumarN@amd.com > > > + > > > + * gdb.fortran/namelist.exp: New file. > > > + * gdb.fortran/namelist.f90: New file. > > > + > > > 2021-06-10 Bhuvanendra Kumar N Bhuvanendra.KumarN@amd.com > > > * gdb.fortran/ptype-on-functions.exp: Add type info of formal > > > diff --git a/gdb/testsuite/gdb.fortran/namelist.exp > > > b/gdb/testsuite/gdb.fortran/namelist.exp > > > new file mode 100644 > > > index 00000000000..e4df8c7debb > > > --- /dev/null > > > +++ b/gdb/testsuite/gdb.fortran/namelist.exp > > > @@ -0,0 +1,45 @@ > > > +# Copyright 2020-2021 Free Software Foundation, Inc. > > > > The '2020' date is only needed if the patch was original posted in 2020= , or if this file is copied/based on some other in-tree file that is copyri= ght 2020+. > > > > > + > > > +# This program is free software; you can redistribute it and/or > > > +modify # it under the terms of the GNU General Public License as > > > +published by # the Free Software Foundation; either version 3 of > > > +the License, or # (at your option) any later version. > > > +# > > > +# This program is distributed in the hope that it will be useful, # > > > +but WITHOUT ANY WARRANTY; without even the implied warranty of # > > > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU > > > +General Public License for more details. > > > +# > > > +# You should have received a copy of the GNU General Public License > > > +# along with this program. If not, see https://nam11.safelinks.prot= ection.outlook.com/?url=3Dhttp%3A%2F%2Fwww.gnu.org%2Flicenses%2F&data= =3D04%7C01%7CBhuvanendra.KumarN%40amd.com%7C6ae3b002df6f4f99442808d9b728e77= 5%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637742208605806843%7CUnknown= %7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6= Mn0%3D%7C3000&sdata=3D6EG9MK9nar3SvQCQ14n85uC3sVhIxMx8P5wfRSeLYTk%3D&am= p;reserved=3D0. > > > + > > > +# This file is part of the gdb testsuite. It contains tests for > > > +fortran # namelist. > > > + > > > +if { [skip_fortran_tests] } { return -1 } > > > + > > > +standard_testfile .f90 > > > +load_lib "fortran.exp" > > > + > > > +if {[prepare_for_testing "failed to prepare" $testfile $srcfile {deb= ug f90}]} { > > > + return -1 > > > +} > > > + > > > +if ![fortran_runto_main] then { > > > + perror "couldn't run to main" > > > + continue > > > +} > > > + > > > +# Depending on the compiler being used, the type names can be printe= d differently. > > > +set int [fortran_int4] > > > + > > > +gdb_breakpoint [gdb_get_line_number "Display namelist"] > > > +gdb_continue_to_breakpoint "Display namelist" > > > + > > > +if {[test_compiler_info {gcc-*}]} { > > > + gdb_test "ptype nml" "type =3D Type nml\r\n *$int :: a\r\n *$int= :: b\r\n *End Type nml" > > > + gdb_test "print nml" \\$\[0-9\]+ =3D \\( a =3D 10, b =3D 20 > > > +\\) > > > > The pattern should be wrapped onto the newline. > > > > Thanks, > > Andrew > > > > > +} else { > > > + gdb_test "ptype nml" "No symbol \"nml\" in current context\\." > > > + gdb_test "print nml" "No symbol \"nml\" in current context\\." > > > +} > > > diff --git a/gdb/testsuite/gdb.fortran/namelist.f90 > > > b/gdb/testsuite/gdb.fortran/namelist.f90 > > > new file mode 100644 > > > index 00000000000..00704eddf27 > > > --- /dev/null > > > +++ b/gdb/testsuite/gdb.fortran/namelist.f90 > > > @@ -0,0 +1,27 @@ > > > +! Copyright 2020-2021 Free Software Foundation, Inc. > > > +! > > > +! This program is free software; you can redistribute it and/or > > > +modify ! it under the terms of the GNU General Public License as > > > +published by ! the Free Software Foundation; either version 3 of > > > +the License, or ! (at your option) any later version. > > > +! > > > +! This program is distributed in the hope that it will be useful, ! > > > +but WITHOUT ANY WARRANTY; without even the implied warranty of ! > > > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU > > > +General Public License for more details. > > > +! > > > +! You should have received a copy of the GNU General Public License = ! > > > +along with this program. If not, see https://nam11.safelinks.protec= tion.outlook.com/?url=3Dhttp%3A%2F%2Fwww.gnu.org%2Flicenses%2F&data=3D0= 4%7C01%7CBhuvanendra.KumarN%40amd.com%7C6ae3b002df6f4f99442808d9b728e775%7C= 3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637742208605806843%7CUnknown%7CT= WFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%= 3D%7C3000&sdata=3D6EG9MK9nar3SvQCQ14n85uC3sVhIxMx8P5wfRSeLYTk%3D&re= served=3D0. > > > +! > > > +! This file is the Fortran source file for namelist.exp. > > > + > > > +program main > > > + > > > + integer :: a, b > > > + namelist /nml/ a, b > > > + > > > + a =3D 10 > > > + b =3D 20 > > > + Write(*,nml) ! Display namelist > > > + > > > +end program main > > > diff --git a/include/dwarf2.def b/include/dwarf2.def index > > > 1ae6e1df298..6b8be1f6a16 100644 > > > --- a/include/dwarf2.def > > > +++ b/include/dwarf2.def > > > @@ -289,7 +289,7 @@ DW_AT (DW_AT_frame_base, 0x40) DW_AT > > > (DW_AT_friend, 0x41) DW_AT (DW_AT_identifier_case, 0x42) DW_AT > > > (DW_AT_macro_info, 0x43) -DW_AT (DW_AT_namelist_items, 0x44) > > > +DW_AT (DW_AT_namelist_item, 0x44) > > > DW_AT (DW_AT_priority, 0x45) > > > DW_AT (DW_AT_segment, 0x46) > > > DW_AT (DW_AT_specification, 0x47) > > > -- > > > 2.17.1 > > > > > > > > > > > -- Joel --_002_MW2PR12MB4684B82433FC18B9058B25E187719MW2PR12MB4684namp_ Content-Type: application/octet-stream; name="0001-gdb-fortran-Fix-ptype-and-print-commands-for-namelis.patch" Content-Description: 0001-gdb-fortran-Fix-ptype-and-print-commands-for-namelis.patch Content-Disposition: attachment; filename="0001-gdb-fortran-Fix-ptype-and-print-commands-for-namelis.patch"; size=12373; creation-date="Fri, 10 Dec 2021 16:08:00 GMT"; modification-date="Fri, 10 Dec 2021 16:08:00 GMT" Content-Transfer-Encoding: base64 RnJvbSBhMGU2N2E4MjcwOWM4NzUzNzc4YzAyZDU0MzhkZWNjN2RhZTMzMTcyIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiA9P1VURi04P3E/PUUyPTgwPTlDYmhrdW1hcm49RTI9ODA9OUQ/ PSA8Qmh1dmFuZW5kcmEuS3VtYXJOQGFtZC5jb20+CkRhdGU6IEZyaSwgOCBPY3QgMjAyMSAwMjow MToxOCArMDUzMApTdWJqZWN0OiBbUEFUQ0hdIGdkYi9mb3J0cmFuOiBGaXggcHR5cGUgYW5kIHBy aW50IGNvbW1hbmRzIGZvciBuYW1lbGlzdAogdmFyaWFibGVzLgoKR0NDL2dmb3J0cmFuIHN1cHBv cnQgbmFtZWxpc3QoYSBmb3J0cmFuIGZlYXR1cmUpLCBpdCBlbWl0cwpEV19UQUdfbmFtZWxpc3Qg YW5kIERXX1RBR19uYW1lbGlzdF9pdGVtIGRpZXMuIEJ1dCBnZGIgZG9lcwpub3QgcHJvY2VzcyB0 aGVzZSBkaWVzIGFuZCBzdXBwb3J0IG5hbWVsaXN0IHZhcmlhYmxlcyBkdXJpbmcKcHJpbnQgYW5k IHB0eXBlIGNvbW1hbmRzLiBXaGVuIHRyaWVkIHRvIHByaW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