Dwarf: Don't add nameless modules to partial symbol table
A name for BLOCK DATA in Fortran is optional. If no name has been
assigned, GDB crashes during read-in of DWARF when BLOCK DATA is
represented via DW_TAG_module. BLOCK DATA is used for one-time
initialization of non-pointer variables in named common blocks.
As of now there is no issue when gfortran is used as DW_TAG_module is
not emitted. However, with Intel ifort the nameless DW_TAG_module is
present and has the following form:
...
<1><dd>: Abbrev Number: 7 (DW_TAG_module)
<de> DW_AT_decl_line : 46
<df> DW_AT_decl_file : 1
<e0> DW_AT_description : (indirect string, offset: 0x110): block
data
<e4> DW_AT_high_pc : 0x402bb7
<ec> DW_AT_low_pc : 0x402bb7
...
The missing name leads to a crash in add_partial_symbol, during length
calculation.
gdb/ChangeLog:
2019-06-11 Bernhard Heckel <bernhard.heckel@intel.com>
* dwarf2read.c (add_partial_symbol): Skip nameless modules.
gdb/testsuite/Changelog:
2019-06-11 Bernhard Heckel <bernhard.heckel@intel.com>
* gdb.fortran/block-data.f: New.
* gdb.fortran/block-data.exp: New.