Bug 37132 - Debug: No DW_TAG_namelist emitted for NAMELISTS
Summary: Debug: No DW_TAG_namelist emitted for NAMELISTS
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 24546 40756
  Show dependency treegraph
 
Reported: 2008-08-15 19:36 UTC by Tobias Burnus
Modified: 2013-12-05 00:46 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2008-08-15 19:36:45 UTC
http://dwarfstd.org/Dwarf3.pdf

"4.3 Namelist Entries"

"A namelist is represented by a debugging information entry with the tag DW_TAG_namelist. If the namelist itself has a name, the namelist entry has a DW_AT_name attribute, whose value is a null-terminated string containing the namelist’s name as it appears in the source program.

"Each name that is part of the namelist is represented by a debugging information entry with the tag DW_TAG_namelist_item. Each such entry is a child of the namelist entry, and all of the namelist item entries for a given namelist are ordered as were the list of names they correspond to in the source program.

"Each namelist item entry contains a DW_AT_namelist_item attribute whose value is a reference to the debugging information entry representing the declaration of the item whose name appears in the namelist."

Example:

        integer :: aa,bb
        namelist /nml/aa,bb
        bb=2
        end

gfortran -g test.f90
readelf -wi a.out -> no DW_TAG_namelist
Comment 1 Tobias Burnus 2013-04-09 22:18:25 UTC
Draft patch: http://gcc.gnu.org/ml/gcc-patches/2013-04/msg00560.html
Comment 2 Tobias Burnus 2013-04-09 23:08:35 UTC
For gdb-support, see http://sourceware.org/bugzilla/show_bug.cgi?id=15353
Comment 3 Tobias Burnus 2013-04-10 13:08:22 UTC
(In reply to comment #1)
> Draft patch: http://gcc.gnu.org/ml/gcc-patches/2013-04/msg00560.html

The draft patch fails for dummy arguments as the shipping comes to early: There is no die to be referenced for them. Thus, the generation of DW_TAG_namelist has to be deferred until the full function decl is available.

The current idea is to add a NAMELIST_DECL to BLOCK_VARS in tree.def, similarly to IMPORTED_DECL. DECL_NAME will then contain the the namelist /name/ - and the decl the vector with all decls in that namelist.  See C++ for how IMPORTED_DECL gets filled - and "grep IMPORTED_DECL" which files are affected (including LTO!).
Comment 4 Tobias Burnus 2013-06-10 20:41:02 UTC
New draft patch: http://gcc.gnu.org/ml/gcc-patches/2013-06/msg00534.html
Comment 6 Tobias Burnus 2013-12-04 19:59:44 UTC
Author: burnus
Date: Wed Dec  4 19:59:42 2013
New Revision: 205679

URL: http://gcc.gnu.org/viewcvs?rev=205679&root=gcc&view=rev
Log:
gcc/
2013-12-04  Tobias Burnus  <burnus@net-b.de>

        PR debug/37132
        * lto-streamer.h (LTO_tags): Add LTO_namelist_decl_ref.
        * tree.def (NAMELIST_DECL): Add.
        * tree.h (NAMELIST_DECL_ASSOCIATED_DECL): New macro.
        * tree.c (initialize_tree_contains_struct): Add asserts for it.
        * dwarf2out.c (gen_namelist_decl): New function.
        (gen_decl_die, dwarf2out_decl): Call it.
        (dwarf2out_imported_module_or_decl_1): Handle NAMELIST_DECL.
        * lto-streamer-in.c (lto_input_tree_ref): Handle NAMELIST_DECL.
        (lto_input_tree_ref, lto_input_tree_1): Update lto_tag_check_range
        call.
        * lto-streamer-out.c (lto_output_tree_ref): Handle
        * NAMELIST_DECL.

gcc/fortran
2013-12-04  Tobias Burnus  <burnus@net-b.de>

        PR debug/37132
        * trans-decl.c (generate_namelist_decl, create_module_nml_decl):
        New static functions.
        (gfc_generate_module_vars, generate_local_vars): Call them.
        (gfc_trans_use_stmts): Handle namelists for debug genertion.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/lto-streamer-in.c
    trunk/gcc/lto-streamer-out.c
    trunk/gcc/lto-streamer.h
    trunk/gcc/tree.c
    trunk/gcc/tree.def
    trunk/gcc/tree.h
Comment 7 Tobias Burnus 2013-12-05 00:46:47 UTC
FIXED on the 4.9 trunk.