From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2065.outbound.protection.outlook.com [40.107.92.65]) by sourceware.org (Postfix) with ESMTPS id F0B303858C2C for ; Tue, 24 Aug 2021 09:21:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F0B303858C2C ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hSyFhRo9xBiuYF8VQPumEow6zgL6fW8jy6ffx9QWrqO/K1NxAUtDgV07V/BA7waiqwS5nfkYQIctcKcqLBk6FUEVJB0DKvv5NlRs0454N9qOxs6uwQlnXf8GDLsEAdNLmOPVgn4uHwjaJ4OdDaehFbrWN3Odt+EGLnmf1Xj/zvFIIgyvb3FbU3yCci90xVqgICit2X+bw6XCAoONUmxglm9W6T6OyeCQQ0gj4bwigH9Y1uPH0J04LiBLY89dfHwcQiD9RbGiuGZQvBtrKj3JIBNIJgxqPFCCFYe79Y2/Z4FH/7gzQnVAaEfQkDnCDYC8XhN4qJgrZBsFgowogfwVaQ== 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-SenderADCheck; bh=2RwNEn8ljVeLdMOyl2BZACyYpavhi48C4jK2r1EKe+k=; b=ZYCXcTfwkJJPqUEcTm34QzB4tJAhXux8EYH6YWzGhjuWVR2yGqnEvvY/d8r+uPCenEfQwu0gdtgVSwrI4q+89wxUbhjIa8moMUW8LpQnohJwqtGC1OXK+O6KbZbSTj7uZmKotPRjOI61+K1k0LmnqWJ47KDuYSMxcXXi7tnn3RSdD/g6Nrn/hY1FBcF5v2QWOvwySBfQn6ZP0qw/81VWAm1dNUMBjg5z5Ru3zpKLTnnNm1tc4Fw+KLbQX54u3VQ6AsssMxeYzGPi4RTLu7CYGDlqPWhlH+y1tvKxe3OJ2PWq/XE7PiRjLyqZEg2qd512Snb7yeN4lpPzDxEmo8d+zQ== 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 MWHPR12MB1631.namprd12.prod.outlook.com (2603:10b6:301:f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.22; Tue, 24 Aug 2021 09:21:46 +0000 Received: from MW2PR12MB4684.namprd12.prod.outlook.com ([fe80::4025:2a95:e126:53de]) by MW2PR12MB4684.namprd12.prod.outlook.com ([fe80::4025:2a95:e126:53de%6]) with mapi id 15.20.4436.024; Tue, 24 Aug 2021 09:21:46 +0000 From: "Kumar N, Bhuvanendra" To: "gdb-patches@sourceware.org" CC: "George, Jini Susan" , "Sharma, Alok Kumar" , "Achra, Nitika" , "E, Nagajyothi" 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: AdeYyESNFilxiCvkSRWjYmJPezxZtgAAPWnw Date: Tue, 24 Aug 2021 09:21:46 +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_Enabled=true; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SetDate=2021-08-24T09:21:40Z; 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=357205d1-5ce1-4207-a6db-1ed65556c43c; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_ContentBits=1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d940e598-6767-4b21-fa1d-08d966e09885 x-ms-traffictypediagnostic: MWHPR12MB1631: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /KA6u7OHhCx8+NvjTjUl1dmOnlpIU/u4gj3vMcPYuuW064DOuCQ3HH39qptiymc3aCPHoU5SbtdWGc6DbSfFP8owARatM3ogRriaD4SC37m99PtaP2GIL21HQu/fdfVSX2ym9QEaDM8l5k5yeRxYYJwALm8RZTVSKJv65u9aLkpUko5yl+UDvpr4yb1Y2A36GcmVCKwB7bH91VeDB0rCjgCZ1aq7qUWUng90wohardE1U8jpr1Jd/7oWl4od6yi45ADsSb7FphNni+ZVD7zaXc3la265IyvYwl5himhnxQRhITgnhxqVaZYHAFQ/BJ1nrkEmobSUfF9bFWL9BTe+iefy1hMLo8g3x22X1NQV87Pln8BhPpQejuELmVCN5nKejaMt/YgF4g6VCLy+wgDAqKlFlVVh43yAz/hM7xZI+ngKGU9cl0WFE6eVWmNlcV9doUJGsFw5IhE7h8Fc2xft1QJDk2vD/O148HPpVoB2HzoFTxlZex9KcV+tWuIV0rSoqIoEcl7F11E7O0Dwy3HQqpOIyMoEL/HZJXZ4sC4jCPjaeYMf5m9VD3iD+SKTAotCal0YN6OzjxjFXFjcNJW2grKKupbJMRoPAH7ZLk1p1Gf3L75pUd2B8U8fym2Q371FEixx/PjKYusHE2QvwqC1ZoQ6KvhUEzVc4fAqb+kDKn25alHWbn1PmmFC+JyL0KaakwzUjyEg2uCQ6uKYABmZLrPkBiio2HVZoK59cTpsyO4X7BMmB0rOp9dc0D5XZXdj8A+HVGAMPj+jJfmSF+jGj3suRspdTuaiGoI4GxcbF5zJ77GXvoVylMjnjAO0auSYZAht4kHuBzrozpuW8UhGPqKJBzrMLbvWzyKsRo+xHEQ= 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)(136003)(396003)(39860400002)(346002)(376002)(366004)(26005)(38100700002)(54906003)(122000001)(316002)(66446008)(64756008)(30864003)(86362001)(55016002)(186003)(66476007)(66556008)(76116006)(5660300002)(33656002)(8936002)(66946007)(53546011)(2906002)(966005)(4326008)(52536014)(166002)(478600001)(6916009)(2940100002)(7696005)(71200400001)(83380400001)(9686003)(38070700005)(6506007)(8676002)(2004002)(579004)(559001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?JF9nm+l6ZlH1Py94Dgpv2HQzXWVrYPKmaM6ZGMjnEnudGpV0CtYbnTgrhXld?= =?us-ascii?Q?fO9+OWQae5WSqbCiffwpyfOf26glHf2GUBDMIJfhbXZommTFzSJIakf+Plmg?= =?us-ascii?Q?tdIw3f/0s6TEWX0DchFARxKQrxwHIhv8zohE+XDXWtwocThcsPKP5Z6dJnGY?= =?us-ascii?Q?vJKnSyrAhJOuqihyNPH/yuJv1b3rxXKdccb3Fz8oweopUpzr4LLezmjdPmri?= =?us-ascii?Q?iSMx6V3bCX1h2PvVmon6uEKSBPywKvZU35Yug3l4XUBx9Py+FTV/e05R4Ku3?= =?us-ascii?Q?+/HUnjj3kLR4yv6qKGc96cxvi3bhUjHWn1IYxCmSF5gKOhpUtrSalXBqMNUt?= =?us-ascii?Q?qY44nE5G78yhGW5yrQXi3Q4c0PSeu0FiIrkyDSU9HWGZ+sTWsIoQzB5DD2iw?= =?us-ascii?Q?aQjASjuGPTgfdV2QwCSKfqoZm9zZkyPB0AMStyx54uafW07h42v7TX2Whsnl?= =?us-ascii?Q?ZZffoDS2AuoPE8i/jV8eX3zVIfJomjQLnyhCS0FJ93ikmO+7qfBpBFVKaA7c?= =?us-ascii?Q?IaSTFEULb9NrlKmVpBeaBdg2fxUStGRQCOOoTP7JRPSZjw/tTg8qJgYSnHYu?= =?us-ascii?Q?nl/RBo3EFXTjBy0AwLBsUtTdqCZv0Q1GNA7LfcmfFBMcsGkSZyBOpEYc0GwJ?= =?us-ascii?Q?ppxTXwu2T94vPjS2Xd5NY9FpskBixd/xvTpTwtNwghMCo1qwhfr/0jkGmHBy?= =?us-ascii?Q?0vLF7pxphriOaeNyiITAfh5x30t12+GceJ/YGAFMF8rtaqlbhhbGL7gdl2i3?= =?us-ascii?Q?9dvvZvQCilTclzJw3/HKjeCe5pXg9k0gWOtce6sa2NNjzobFZO8Z7cxGyNAp?= =?us-ascii?Q?nVcrn+GmaIqdYW+oXmIYIdLbcVTNlRATPbIoPNlC6dtcgaT2IUriVoHbtJSY?= =?us-ascii?Q?7D5jnMrX4vI8jDySMWTjhZaPAgXY0RGcp4uY4tIwqzjQT19d58kSkXui8rdp?= =?us-ascii?Q?Q09umIJrgCM7wfQUgf4KYfjhtvPp6/QRG6qaDQVj9kcAJfNFuVwOKjPrcCrH?= =?us-ascii?Q?uIKlUDTXOw/3eajyK5CAP1CyIgchVeYQrrw+UUq6A3gHo6s3/aiWAQOERV2D?= =?us-ascii?Q?WVJkA119jnkwEpk1FlC5MJ409g0mSziZuRvGuH2IS8BQUurycJ53KSw3Dc1W?= =?us-ascii?Q?nqTUqyuL1n1lTpxeWKbBmK7xPLKs+7RgwY9ZShyBs6ul5dUoGdDiq+DNW1Jo?= =?us-ascii?Q?soWDf8NoxWNrq+/NTPgkVW9iEAHux5brbpzXeK07BMo91DPeCxhQezLJjFx8?= =?us-ascii?Q?b7KbvDgSPM+WW2WWfP5fD7C4YZqs3xcGuLC792Fx6YGOaec7YkvrAdXyFTM8?= =?us-ascii?Q?ZTiagRICzdzYb4Pb9eQn8Gbj?= 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: d940e598-6767-4b21-fa1d-08d966e09885 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Aug 2021 09:21:46.5941 (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: ZOy9ccirzoSKZLuqhxlA9mTN4iNAdw2jayJ08P9xX28X4lFecOqppHi3hTWDbE1cBsgJ+pXj8qt/FmHgA6+iMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1631 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP 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: Tue, 24 Aug 2021 09:22:01 -0000 [AMD Official Use Only] One additional information. Testing: - NO regressions found in GDB testsuite after the fix. - New test case is added for this fix. regards, bhuvan From: Kumar N, Bhuvanendra Sent: Tuesday, August 24, 2021 2:46 PM To: 'gdb-patches@sourceware.org' Cc: George, Jini Susan ; Sharma, Alok Kumar ; Achra, Nitika ; E, Nagajyothi = Subject: [PATCH] Fix ptype and print commands for namelist variables(a fort= ran feature) [AMD Official Use Only] Hi all, Requesting code review for this GDB patch. Required patch is attached and a= lso inlined below with this email. Problem description/summary: 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 supp= ort 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 variable= s and its items. Sample output of these commands is shared below, with fixe= d 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: * 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. 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://github.com/= gcc-mirror/gcc) will be handled in separate PATCH. I will raise separate pa= tch 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.Ku= marN@amd.com Date: Mon, 24 Aug 2021 11:49:14 +0530 Subject: [PATCH] Fix ptype and print commands for namelist variables(a fort= ran 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 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/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 None' 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 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 d= ie_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_it= em) && + ! 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_ite= m, cu); + struct die_info *item_die =3D 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, struct d= warf2_cu *cu) type =3D alloc_type (objfile); INIT_CPLUS_SPECIFIC (type); + if (die->tag =3D=3D DW_TAG_namelist) + INIT_NONE_SPECIFIC (type); name =3D dwarf2_name (die, cu); if (name !=3D NULL) @@ -15684,7 +15699,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 @@ -15728,7 +15744,9 @@ handle_struct_member_die (struct die_info *child_di= e, 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 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; + } { /* 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 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-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, stru= ct ui_file *stream, fputs_filtered (" =3D ", stream); } + /* While printing namelist items, fetch the appropriate value + field before printing its value. */ + if (TYPE_SPECIFIC_FIELD (type) =3D=3D TYPE_SPECIFIC_NONE) + { + struct block_symbol symni =3D lookup_symbol(field_name, + get_selected_block (0), VAR_DOMAIN, nullptr); + if (symni.symbol !=3D NULL) + field =3D value_of_variable(symni.symbol, symni.block); + } + 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.for= tran/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. + +# 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 http://www.gnu.org/licenses/. + +# 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 diff= erently. +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..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 http://www.gnu.org/licenses/. +! +! 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