Re: [Dwarf-Discuss] Dwarf-Discuss Digest, Vol 72, Issue 3
Question: Would it be permissible to create a DW_TAG_imported_declaration for a DW_TAG_namelist with an empty DW_TAG_namelist_item list and rely on the compiler to fetch the namelist items from the module's DW_TAG_namelist? I think if you are importing, you don't even need the DW_TAG_namelist: DW_TAG_imported_declaration '/nml' DW_AT_import DW_FORM_ref_addr [ reference to other file's DWARF ] I'm a bit weak on how that cross-file reference works, but reading section 3.2.3 that's what I come up with. I wish "my" compiler generated namelist entries, but it doesn't and so I can't point to a worked example. I append my understanding of what you would do with the suggested fix above. -John ---[ file 1 ]--- module mm integer :: ii real :: rr NAMELIST /nml/ ii, rr end module mm ---[ sketch of DWARF for file 1 ]--- DW_TAG_module 'mm' DW_TAG_variable 'ii' DW_TAG_variable 'rr' DW_TAG_namelist '/nml' <--- $1 DW_TAG_namelist_entry 'rr' DW_TAG_namelist_entry 'ii' ---[ file 2 ]--- subroutine read_nml() use mm, only: nml read(99, nml=nml) end subroutine read_nml ---[ sketch of DWARF for file 2 ]--- DW_TAG_subprogram 'read_nml' DW_TAG_imported_declaration '/nml' DW_AT_import DW_FORM_ref_addr [ somehow a reference to $1 ] ---[ end ]--- ___ Dwarf-Discuss mailing list Dwarf-Discuss@lists.dwarfstd.org http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
Re: [Dwarf-Discuss] Dwarf-Discuss Digest, Vol 72, Issue 3
Bishop, John E wrote: I think if you are importing, you don't even need the DW_TAG_namelist: DW_TAG_imported_declaration '/nml' DW_AT_import DW_FORM_ref_addr [ reference to other file's DWARF ] I'm a bit weak on how that cross-file reference works, but reading section 3.2.3 that's what I come up with. [...] ---[ sketch of DWARF for file 2 ]--- DW_TAG_subprogram 'read_nml' DW_TAG_imported_declaration '/nml' DW_AT_import DW_FORM_ref_addr [ somehow a reference to $1 ] Well, that's probably the problem: The "somehow". If the files are generated independently, the "reference to $1" is not available. At least that's how I understand it. (My DWARF knowledge is rather weak.) Tobias ___ Dwarf-Discuss mailing list Dwarf-Discuss@lists.dwarfstd.org http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
Re: [Dwarf-Discuss] Dwarf-Discuss Digest, Vol 72, Issue 3
On 18 Nov 2013, at 20:06, Tobias Burnus wrote: > Bishop, John E wrote: >> ---[ sketch of DWARF for file 2 ]--- >> >> DW_TAG_subprogram 'read_nml' >> DW_TAG_imported_declaration '/nml' >> DW_AT_import DW_FORM_ref_addr [ somehow a reference to $1 ] > > Well, that's probably the problem: The "somehow". If the files are generated > independently, the "reference to $1" is not available. At least that's how I > understand it. (My DWARF knowledge is rather weak.) At least on ELF and PECOFF platforms it's perfectly possible: you just insert a reference to a global symbol declared in the DWARF section of another object file. Our compiler doesn't use this particular tag, but at least for e.g. DW_TAG_typedef it works fine with gdb. Jonas ___ Dwarf-Discuss mailing list Dwarf-Discuss@lists.dwarfstd.org http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
Re: [Dwarf-Discuss] Using DW_TAG_imported_declaration with Fortran's DW_TAG_namelist
(Putting this discussion back on the original thread…) >>> ---[ sketch of DWARF for file 2 ]--- >>> >>> DW_TAG_subprogram 'read_nml' >>> DW_TAG_imported_declaration '/nml' >>> DW_AT_import DW_FORM_ref_addr [ somehow a reference to $1 ] >> >> Well, that's probably the problem: The "somehow". If the files are generated >> independently, the "reference to $1" is not available. At least that's how I >> understand it. (My DWARF knowledge is rather weak.) > > At least on ELF and PECOFF platforms it's perfectly possible: you just insert > a reference to a global symbol declared in the DWARF section of another > object file. Our compiler doesn't use this particular tag, but at least for > e.g. DW_TAG_typedef it works fine with gdb. Yes, but the compiler has to anticipate the need for the reference by generating a global symbol when compiling the other file. This is why DW_FORM_ref_addr isn't used much outside of contexts where the entire program is visible (e.g., dwz). Another problem with using DW_FORM_ref_addr is that it's not compatible with split dwarf (aka "Fission"), because the .dwo files are stripped of both ELF symbols and relocations. I think it'd probably be simpler to just emit an empty DW_TAG_namelist, maybe with the DW_AT_declaration flag set. Let the debugger find the definition of the namelist via the DW_AT_name. -cary ___ Dwarf-Discuss mailing list Dwarf-Discuss@lists.dwarfstd.org http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org