[Dwarf-Discuss] Alternate entry points
Michael Eager
eager@eagercon.com
Wed Oct 24 16:44:42 GMT 2018
On 10/24/2018 03:15 AM, Jakub Jelinek via Dwarf-Discuss wrote:
> On Wed, Oct 24, 2018 at 01:00:26AM -0400, Rafik Zurob via Dwarf-Discuss wrote:
>>> I dug up gfortran 5.4, which does not emit DW_TAG_entry_point with my
>>> simple example program. Does anybody actually use it?
>>
>> IBM XL Fortran generates it.
>>
>> $ cat entry.f
>> subroutine foo(a)
>> integer a
>> real b
>>
>> a = 5
>> return
>> entry bar(b)
>> b = 3.0
>> return
>> end subroutine
>> $
>>
>> Gets the following DWARF:
>
> That is kind of weird, because foo only has dummy argument a
> and entry bar only has b, there is nothing that tells the debug info
> consumer that the subprogram doesn't have (a, b) arguments.
>
>> <1><42>: Abbrev Number: 2 (DW_TAG_base_type)
>> <43> DW_AT_name : INTEGER
>> <4b> DW_AT_byte_size : 4
>> <4c> DW_AT_encoding : 5 (signed)
>> <1><51>: Abbrev Number: 2 (DW_TAG_base_type)
>> <52> DW_AT_name : REAL
>> <57> DW_AT_byte_size : 4
>> <58> DW_AT_encoding : 4 (float)
>> <1><59>: Abbrev Number: 4 (DW_TAG_subprogram)
>> <5a> DW_AT_name : foo
>> <5e> DW_AT_low_pc : 0x0
>> <66> DW_AT_high_pc : 128
>> <67> DW_AT_decl_file : 1
>> <68> DW_AT_decl_line : 1
>> <69> DW_AT_external : 1
>> <6a> DW_AT_frame_base : 0x0 (location list)
>> <2><72>: Abbrev Number: 5 (DW_TAG_formal_parameter)
>> <73> DW_AT_location : 3 byte block: 91 20 6 (DW_OP_fbreg: 32;
>> DW_OP_deref)
>> <77> DW_AT_name : a
>> <79> DW_AT_type : 0x42
>> <2><81>: Abbrev Number: 5 (DW_TAG_formal_parameter)
>> <82> DW_AT_location : 3 byte block: 91 28 6 (DW_OP_fbreg: 40;
>> DW_OP_deref)
>> <86> DW_AT_name : b
>> <88> DW_AT_type : 0x51
>> <2><90>: Abbrev Number: 6 (DW_TAG_entry_point)
>> <91> DW_AT_name : bar
>> <95> DW_AT_low_pc : 0x28
>> <9d> DW_AT_decl_file : 1
>> <9e> DW_AT_decl_line : 7
>> <9f> DW_AT_frame_base : 1 byte block: 6e (DW_OP_reg30
>> (r30))
This looks odd to me as well.
Looking at the DWARF, I would interpret it to say that foo takes two
arguments, a and b, and bar takes zero arguments. Shouldn't the
DW_TAG_formal_parameter for b be a child of the DW_TAG_entry_point,
not the DW_TAG_subprogram?
--
Michael Eager eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306
More information about the Dwarf-discuss
mailing list