PR37132 – RFC patch for generation of DWARF symbol for Fortran's namelists (DW_TAG_namelist)
Tobias Burnus
burnus@net-b.de
Tue Nov 12 08:13:00 GMT 2013
Am 11.11.2013 19:18, schrieb Cary Coutant:
>> But for "USE mod_name, only: nml", one is supposed to generate a
>> DW_TAG_imported_declaration.
>>
>> And there I am stuck. For normal variables, the DW_TAG_imported_declaration
>> refers to a DW_TAG_variable die. Analogously, for a namelist one would have
>> to refer to a DW_TAG_namelist die. But such DW_TAG_namelist comes with a
>> DW_TAG_namelist_item list. And for the latter, one needs to have the die of
>> all variables in the namelist. But with use-only the symbols aren't use
>> associate and no decl or die exists. (Failing call tree with the patch:
>> gfc_trans_use_stmts -> dwarf2out_imported_module_or_decl_1 ->
>> force_decl_die.)
>>
>> What's the proper DWARF way of handling this? Creating a DW_TAG_namelist
>> without any DW_TAG_namelist_items, relying on the debugger to pick those
>> from the module? Or how is one supposed to handle it?
> Why wouldn't you have DIEs for the imported namelist items?I'd think
> that once the compiler has processed the USE statement and imported
> the namelist into the current compilation unit, it would generate DIEs
> for all the imported items, and then be able to construct a
> fully-populated DW_TAG_namelist DIE. (At least it would have DIEs for
> all the imported items that are actually used in that module, which
> should be sufficient for debugging.)
I think in most real-world cases, the module variables in the namelist
have been imported and are available. But as shown in the example,
subroutine example()
use mod, only: my_nml
read(uid, my_nml)
end subroutine example
is possible and there one hasn't imported any of the module variables
which are in namelist. Still, one might want to do:
(gdb) print my_nml
to get something like:
&my_nml i=6, r=8 /
One cannot simply also import, e.g., "i" as the code might have:
subroutine example()
use mod, only: my_nml
integer :: i ! < Locally defined variable
read(uid, my_nml)
...
end subroutine example
In that case "i" is the local variable. As written, one can create a
decl and a die for the "i" of the module, but the question is how to
name it.
Tobias
More information about the Fortran
mailing list