[PATCH] DWARF: Don't add nameless modules to partial symbol table.

Bernhard Heckel bernhard.heckel@intel.com
Mon Oct 31 09:06:00 GMT 2016


On 21/10/2016 17:37, Yao Qi wrote:
> Bernhard Heckel <bernhard.heckel@intel.com> writes:
>
>> A name for BLOCK DATA in Fortran is optional. If no
>> name has been assigned, GDB will crash 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.
> I compiled your test case block-data.f, but there is no DW_TAG_module in
> debug info.  It has DW_TAG_common_block.  IOW, I run block-data.exp
> without your fix in dwarf2read.c, there is no crash in GDB.  My gfotran
> is 4.9.3.
>
It happen when compiled with Ifort. I attached a dump of the debug info, 
line 80+ is important.

Do you want me to send you an executable as reproducer?
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
-------------- next part --------------
Contents of the .debug_info section:

  Compilation Unit @ offset 0x0:
   Length:        0x21b (32-bit)
   Version:       4
   Abbrev Offset: 0x0
   Pointer Size:  8
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <c>   DW_AT_comp_dir    : (indirect string, offset: 0x0): .../gdb/testsuite	
    <10>   DW_AT_name        : (indirect string, offset: 0x58): .../gdb/testsuite/../../../gdb/testsuite/gdb.fortran/block-data.f	
    <14>   DW_AT_producer    : (indirect string, offset: 0xce): Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.0
	
    <18>   Unknown AT value: 3b01: (indirect string, offset: 0x140): -c -g -o .../gdb/testsuite/outputs/gdb.fortran/block-data/block-data0.o	
    <1c>   DW_AT_language    : 14	(Fortran 95)
    <1d>   DW_AT_use_UTF8    : 1	
    <1e>   DW_AT_low_pc      : 0x402af0	
    <26>   DW_AT_high_pc     : 0x108	
    <2e>   DW_AT_main_subprogram: 1	
    <2f>   DW_AT_stmt_list   : 0x0	
 <1><33>: Abbrev Number: 2 (DW_TAG_subprogram)
    <34>   DW_AT_decl_line   : 21	
    <35>   DW_AT_decl_file   : 1	
    <36>   DW_AT_name        : (indirect string, offset: 0x1ce): bdata	
    <3a>   DW_AT_calling_convention: 2	(program)
    <3b>   DW_AT_low_pc      : 0x402af0	
    <43>   DW_AT_high_pc     : 0xd7	
    <4b>   DW_AT_main_subprogram: 1	
    <4c>   DW_AT_external    : 1	
 <2><4d>: Abbrev Number: 3 (DW_TAG_common_block)
    <4e>   DW_AT_decl_line   : 25	
    <4f>   DW_AT_decl_file   : 1	
    <50>   DW_AT_name        : (indirect string, offset: 0x1d4): blk1_	
    <54>   DW_AT_location    : 9 byte block: 3 a0 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3a0)
 <3><5e>: Abbrev Number: 4 (DW_TAG_variable)
    <5f>   DW_AT_decl_line   : 22	
    <60>   DW_AT_decl_file   : 1	
    <61>   DW_AT_name        : (indirect string, offset: 0x1da): doub1	
    <65>   DW_AT_type        : <0xca>	
    <69>   DW_AT_location    : 9 byte block: 3 a0 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3a0)
    <73>   DW_AT_external    : 1	
 <3><74>: Abbrev Number: 4 (DW_TAG_variable)
    <75>   DW_AT_decl_line   : 23	
    <76>   DW_AT_decl_file   : 1	
    <77>   DW_AT_name        : (indirect string, offset: 0x1e8): char1	
    <7b>   DW_AT_type        : <0xd1>	
    <7f>   DW_AT_location    : 9 byte block: 3 a8 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3a8)
    <89>   DW_AT_external    : 1	
 <3><8a>: Abbrev Number: 0
 <2><8b>: Abbrev Number: 3 (DW_TAG_common_block)
    <8c>   DW_AT_decl_line   : 26	
    <8d>   DW_AT_decl_file   : 1	
    <8e>   DW_AT_name        : (indirect string, offset: 0x1f9): blk2_	
    <92>   DW_AT_location    : 9 byte block: 3 c0 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3c0)
 <3><9c>: Abbrev Number: 4 (DW_TAG_variable)
    <9d>   DW_AT_decl_line   : 22	
    <9e>   DW_AT_decl_file   : 1	
    <9f>   DW_AT_name        : (indirect string, offset: 0x1ff): doub2	
    <a3>   DW_AT_type        : <0xca>	
    <a7>   DW_AT_location    : 9 byte block: 3 c0 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3c0)
    <b1>   DW_AT_external    : 1	
 <3><b2>: Abbrev Number: 4 (DW_TAG_variable)
    <b3>   DW_AT_decl_line   : 23	
    <b4>   DW_AT_decl_file   : 1	
    <b5>   DW_AT_name        : (indirect string, offset: 0x205): char2	
    <b9>   DW_AT_type        : <0xd7>	
    <bd>   DW_AT_location    : 9 byte block: 3 c8 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3c8)
    <c7>   DW_AT_external    : 1	
 <3><c8>: Abbrev Number: 0
 <2><c9>: Abbrev Number: 0
 <1><ca>: Abbrev Number: 5 (DW_TAG_base_type)
    <cb>   DW_AT_byte_size   : 8	
    <cc>   DW_AT_encoding    : 4	(float)
    <cd>   DW_AT_name        : (indirect string, offset: 0x1e0): REAL(8)	
 <1><d1>: Abbrev Number: 6 (DW_TAG_string_type)
    <d2>   DW_AT_name        : (indirect string, offset: 0x1ee): .str.CHAR1	
    <d6>   DW_AT_byte_size   : 6	
 <1><d7>: Abbrev Number: 6 (DW_TAG_string_type)
    <d8>   DW_AT_name        : (indirect string, offset: 0x20b): .str.CHAR2	
    <dc>   DW_AT_byte_size   : 6	
 <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: 0x216): block data	
    <e4>   DW_AT_high_pc     : 0x402bc7	
    <ec>   DW_AT_low_pc      : 0x402bc7	
 <2><f4>: Abbrev Number: 3 (DW_TAG_common_block)
    <f5>   DW_AT_decl_line   : 42	
    <f6>   DW_AT_decl_file   : 1	
    <f7>   DW_AT_name        : (indirect string, offset: 0x1d4): blk1_	
    <fb>   DW_AT_location    : 9 byte block: 3 a0 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3a0)
 <3><105>: Abbrev Number: 4 (DW_TAG_variable)
    <106>   DW_AT_decl_line   : 39	
    <107>   DW_AT_decl_file   : 1	
    <108>   DW_AT_name        : (indirect string, offset: 0x1da): doub1	
    <10c>   DW_AT_type        : <0xca>	
    <110>   DW_AT_location    : 9 byte block: 3 a0 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3a0)
    <11a>   DW_AT_external    : 1	
 <3><11b>: Abbrev Number: 4 (DW_TAG_variable)
    <11c>   DW_AT_decl_line   : 40	
    <11d>   DW_AT_decl_file   : 1	
    <11e>   DW_AT_name        : (indirect string, offset: 0x1e8): char1	
    <122>   DW_AT_type        : <0x171>	
    <126>   DW_AT_location    : 9 byte block: 3 a8 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3a8)
    <130>   DW_AT_external    : 1	
 <3><131>: Abbrev Number: 0
 <2><132>: Abbrev Number: 3 (DW_TAG_common_block)
    <133>   DW_AT_decl_line   : 43	
    <134>   DW_AT_decl_file   : 1	
    <135>   DW_AT_name        : (indirect string, offset: 0x1f9): blk2_	
    <139>   DW_AT_location    : 9 byte block: 3 c0 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3c0)
 <3><143>: Abbrev Number: 4 (DW_TAG_variable)
    <144>   DW_AT_decl_line   : 39	
    <145>   DW_AT_decl_file   : 1	
    <146>   DW_AT_name        : (indirect string, offset: 0x1ff): doub2	
    <14a>   DW_AT_type        : <0xca>	
    <14e>   DW_AT_location    : 9 byte block: 3 c0 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3c0)
    <158>   DW_AT_external    : 1	
 <3><159>: Abbrev Number: 4 (DW_TAG_variable)
    <15a>   DW_AT_decl_line   : 40	
    <15b>   DW_AT_decl_file   : 1	
    <15c>   DW_AT_name        : (indirect string, offset: 0x205): char2	
    <160>   DW_AT_type        : <0x177>	
    <164>   DW_AT_location    : 9 byte block: 3 c8 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3c8)
    <16e>   DW_AT_external    : 1	
 <3><16f>: Abbrev Number: 0
 <2><170>: Abbrev Number: 0
 <1><171>: Abbrev Number: 6 (DW_TAG_string_type)
    <172>   DW_AT_name        : (indirect string, offset: 0x1ee): .str.CHAR1	
    <176>   DW_AT_byte_size   : 6	
 <1><177>: Abbrev Number: 6 (DW_TAG_string_type)
    <178>   DW_AT_name        : (indirect string, offset: 0x20b): .str.CHAR2	
    <17c>   DW_AT_byte_size   : 6	
 <1><17d>: Abbrev Number: 8 (DW_TAG_subprogram)
    <17e>   DW_AT_decl_line   : 49	
    <17f>   DW_AT_decl_file   : 1	
    <180>   DW_AT_name        : (indirect string, offset: 0x221): sub_block_data	
    <184>   DW_AT_low_pc      : 0x402bcd	
    <18c>   DW_AT_high_pc     : 0x2b	
    <194>   DW_AT_external    : 1	
 <2><195>: Abbrev Number: 3 (DW_TAG_common_block)
    <196>   DW_AT_decl_line   : 54	
    <197>   DW_AT_decl_file   : 1	
    <198>   DW_AT_name        : (indirect string, offset: 0x1d4): blk1_	
    <19c>   DW_AT_location    : 9 byte block: 3 a0 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3a0)
 <3><1a6>: Abbrev Number: 4 (DW_TAG_variable)
    <1a7>   DW_AT_decl_line   : 51	
    <1a8>   DW_AT_decl_file   : 1	
    <1a9>   DW_AT_name        : (indirect string, offset: 0x1da): doub1	
    <1ad>   DW_AT_type        : <0xca>	
    <1b1>   DW_AT_location    : 9 byte block: 3 a0 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3a0)
    <1bb>   DW_AT_external    : 1	
 <3><1bc>: Abbrev Number: 4 (DW_TAG_variable)
    <1bd>   DW_AT_decl_line   : 52	
    <1be>   DW_AT_decl_file   : 1	
    <1bf>   DW_AT_name        : (indirect string, offset: 0x1e8): char1	
    <1c3>   DW_AT_type        : <0x212>	
    <1c7>   DW_AT_location    : 9 byte block: 3 a8 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3a8)
    <1d1>   DW_AT_external    : 1	
 <3><1d2>: Abbrev Number: 0
 <2><1d3>: Abbrev Number: 3 (DW_TAG_common_block)
    <1d4>   DW_AT_decl_line   : 55	
    <1d5>   DW_AT_decl_file   : 1	
    <1d6>   DW_AT_name        : (indirect string, offset: 0x1f9): blk2_	
    <1da>   DW_AT_location    : 9 byte block: 3 c0 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3c0)
 <3><1e4>: Abbrev Number: 4 (DW_TAG_variable)
    <1e5>   DW_AT_decl_line   : 51	
    <1e6>   DW_AT_decl_file   : 1	
    <1e7>   DW_AT_name        : (indirect string, offset: 0x1ff): doub2	
    <1eb>   DW_AT_type        : <0xca>	
    <1ef>   DW_AT_location    : 9 byte block: 3 c0 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3c0)
    <1f9>   DW_AT_external    : 1	
 <3><1fa>: Abbrev Number: 4 (DW_TAG_variable)
    <1fb>   DW_AT_decl_line   : 52	
    <1fc>   DW_AT_decl_file   : 1	
    <1fd>   DW_AT_name        : (indirect string, offset: 0x205): char2	
    <201>   DW_AT_type        : <0x218>	
    <205>   DW_AT_location    : 9 byte block: 3 c8 f3 6a 0 0 0 0 0 	(DW_OP_addr: 6af3c8)
    <20f>   DW_AT_external    : 1	
 <3><210>: Abbrev Number: 0
 <2><211>: Abbrev Number: 0
 <1><212>: Abbrev Number: 6 (DW_TAG_string_type)
    <213>   DW_AT_name        : (indirect string, offset: 0x1ee): .str.CHAR1	
    <217>   DW_AT_byte_size   : 6	
 <1><218>: Abbrev Number: 6 (DW_TAG_string_type)
    <219>   DW_AT_name        : (indirect string, offset: 0x20b): .str.CHAR2	
    <21d>   DW_AT_byte_size   : 6	
 <1><21e>: Abbrev Number: 0



More information about the Gdb-patches mailing list