public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Nils-Christian Kempke <nils-christian.kempke@intel.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 0/2][PR fortran/26373][PR fortran/22497] GDB support for Fortran extends feature
Date: Thu, 13 Jan 2022 17:39:07 +0100	[thread overview]
Message-ID: <20220113163909.2880018-1-nils-christian.kempke@intel.com> (raw)

Hi,

please find attached 2 patches enabling GDB to deal with the
Fortran 2003 feature of type extension.

For ifx and ifort this patch addresses the above mentioned Bugzilla
bugs fully.  For gfortran (and flang - these are all I tried) the
bugs still somewhat exist but I'd not consider them to be on GDB side.

The problem when using gfortran (or flang) is, that the compilers
do not emit the respective DWARF tag for inheritance when the extends
feature is used.  Thus, GDB has no chance of actually knowing about
it. Assume the following scenario:

    type :: a
        real :: a_real
    end type a

    type, extends(a) :: b
    end type b

Now if we have

    type(b) :: obj

and compiled with gfortran or flang GDB is not able to directly resolve
a member access of the sort

    (gdb) obj%a_real
    There is no member named a_real.

since gfortran will not emit the DW_TAG_inheritance for b.  There is a
gcc bug gcc/49475 filed for this which is set as kfail in the respective
test in [PATCH (1/2)].

Any feedback is welcome!

Cheers,

Nils

Bernhard Heckel (2):
  gdb/fortran: add support for accessing fields of extended types
  gdb/fortran: print fortran extended types with ptype

 gdb/f-exp.y                                   |   7 +-
 gdb/f-lang.h                                  |  11 +
 gdb/f-typeprint.c                             |  24 ++-
 gdb/testsuite/gdb.fortran/oop_extend_type.exp | 190 ++++++++++++++++++
 gdb/testsuite/gdb.fortran/oop_extend_type.f90 |  69 +++++++
 gdb/valops.c                                  |   6 +
 6 files changed, 303 insertions(+), 4 deletions(-)
 create mode 100755 gdb/testsuite/gdb.fortran/oop_extend_type.exp
 create mode 100755 gdb/testsuite/gdb.fortran/oop_extend_type.f90

-- 
2.25.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


             reply	other threads:[~2022-01-13 16:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13 16:39 Nils-Christian Kempke [this message]
2022-01-13 16:39 ` [PATCH 1/2][PR fortran/26373][PR fortran/22497] gdb/fortran: add support for accessing fields of extended types Nils-Christian Kempke
2022-01-14 20:06   ` Tom Tromey
2022-01-17 10:28     ` Kempke, Nils-Christian
2022-02-01 15:06       ` Kempke, Nils-Christian
2022-02-10 13:20         ` Kempke, Nils-Christian
2022-02-18 16:14           ` Kempke, Nils-Christian
2022-01-13 16:39 ` [PATCH 2/2] gdb/fortran: print fortran extended types with ptype Nils-Christian Kempke
2022-01-14 20:10   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220113163909.2880018-1-nils-christian.kempke@intel.com \
    --to=nils-christian.kempke@intel.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).