------- Comment #3 from dfranke at gcc dot gnu dot org  2007-08-11 22:08 -------
gfortran seems to lack the following information:

 1. DW_TAG_module
    to describe the module at hand
 2. DW_TAG_imported_declaration/DW_TAG_imported_module/DW_AT_import
    to describe use-associated variables (dwarf2, sec. 4.3; dwarf3, sec. 3.2.3
and 3.2.4)

The former is generated by ifort, the latter is not.

As dwarf3, sec 3.2, indicates similarities of modules to C++ namespaces, it
could be worth a try to see how it is implemented over there. The equivalent
C++-code:

$> cat a.cpp
#include <cstdio>

namespace foo {
  int i = 42;
}

int main() {
  using namespace foo;

  printf("%d\n", i);
  return 0;
}

$> g++ -g a.cpp
$> readelf 
[...]
 <1><ad3>: Abbrev Number: 29 (DW_TAG_subprogram)
     DW_AT_external    : 1
     DW_AT_name        : main
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 17
     DW_AT_type        : <109>
     DW_AT_low_pc      : 0x8048484
     DW_AT_high_pc     : 0x80484b8
     DW_AT_frame_base  : 0      (location list)
     DW_AT_sibling     : <af8>
 <2><af0>: Abbrev Number: 30 (DW_TAG_imported_module)
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 18
     DW_AT_import      : <af8>
 <1><af8>: Abbrev Number: 4 (DW_TAG_namespace)
     DW_AT_name        : foo
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 13
     DW_AT_sibling     : <b1a>
 <2><b03>: Abbrev Number: 31 (DW_TAG_variable)
     DW_AT_name        : i
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 14
     DW_AT_MIPS_linkage_name: _ZN3foo1iE
     DW_AT_type        : <109>
     DW_AT_external    : 1
     DW_AT_declaration : 1
 <1><b1a>: Abbrev Number: 32 (DW_TAG_variable)
     DW_AT_specification: <b03>
     DW_AT_location    : 5 byte block: 3 ec 96 4 8      (DW_OP_addr: 80496ec)
[...]

Steven, are you (still) working on this?


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29635

Reply via email to