Bug 15353 - ptype/whatis doesn't handle DW_TAG_namelist
Summary: ptype/whatis doesn't handle DW_TAG_namelist
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: fortran (show other bugs)
Version: 7.5
: P2 normal
Target Milestone: 12.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-09 22:20 UTC by Tobias Burnus
Modified: 2022-02-25 17:01 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2013-04-09 22:20:50 UTC
Vaguely related to bug 15209.

Example:
        integer :: aa,bb
        namelist /nml/ aa
        aa = 5
        end
generates
 <2><1a9>: Abbrev Number: 3 (DW_TAG_namelist)
    <1aa>   DW_AT_name        : nml
    <1ae>   DW_AT_sibling     : <0x1b8>
 <3><1b2>: Abbrev Number: 4 (DW_TAG_namelist_item)
    <1b3>   DW_AT_namelist_items: <0x1b8>
 <2><1b8>: Abbrev Number: 5 (DW_TAG_variable)
    <1b9>   DW_AT_name        : aa


I would expect that gdb prints something like
  type = namelist /nml/ aa

Currently, it does not recognize "nml".


DW_TAG_namelist is part of DWARF2.

See also:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37132
http://gcc.gnu.org/ml/gcc-patches/2013-04/msg00560.html
Comment 1 Tobias Burnus 2013-12-05 00:55:48 UTC
GCC 4.9 now supports DW_TAG_namelist. A special case is:
  module mm
    integer :: aa, bb
    namelist /nml/ aa, bb
  end module mm

  subroutine test()
    use mm, only: nml
    write(*,nml)
  end subroutine test

for which GCC/gfortran - at least when compiled in two files - generates a DW_TAG_imported_declaration with DW_TAG_namelist and *no* DW_TAG_namelist_item (but: DW_AT_declaration = 1). In that case, gdb has to find the DW_TAG_namelist_item from the module.
Comment 2 Tom Tromey 2022-02-25 17:01:29 UTC
I believe this was fixed by 

commit e951225303b7d0565c985e2d562d3787983ff06f
Author: Bhuvanendra Kumar N <Bhuvanendra.KumarN@amd.com>
Date:   Wed Feb 2 17:52:27 2022 +0000

    gdb/fortran: support ptype and print commands for namelist variables