From paul.robinson  Tue Oct 23 21:40:18 2018
From: paul.robinson (paul.robinson@sony.com)
Date: Tue, 23 Oct 2018 21:40:18 +0000
Subject: [Dwarf-Discuss] Alternate entry points
Message-ID: <E3B07FDB86BFF041819DC057DEED8FEA0141AEA887@USCULXMSG13.am.sony.com>

On one of the LLVM lists, a question came up about representing alternate
entry points. Fortran and PL/I and probably other languages can do this.

I see DWARF has DW_TAG_entry_point, however the spec is completely silent
on how this entry relates to other entries for the same subprogram.
Should there be one "primary" DW_TAG_subprogram, which then owns the
alternate DW_TAG_entry_point entries?  Or maybe several sibling entries
all with DW_TAG_entry_point, and no primary DW_TAG_subprogram entry?
I don't have a Fortran compiler handy to try this with so I'm curious
what the current state-of-the-practice is (and of course whether this
ought to be spelled out in the spec itself).

Thanks,
--paulr


From paul.robinson  Tue Oct 23 22:00:53 2018
From: paul.robinson (paul.robinson@sony.com)
Date: Tue, 23 Oct 2018 22:00:53 +0000
Subject: [Dwarf-Discuss] Alternate entry points
In-Reply-To: <E3B07FDB86BFF041819DC057DEED8FEA0141AEA887@USCULXMSG13.am.sony.com>
References: <E3B07FDB86BFF041819DC057DEED8FEA0141AEA887@USCULXMSG13.am.sony.com>
Message-ID: <E3B07FDB86BFF041819DC057DEED8FEA0141AEA97C@USCULXMSG13.am.sony.com>



> -----Original Message-----
> From: Dwarf-Discuss [mailto:dwarf-discuss-bounces at lists.dwarfstd.org] On
> Behalf Of Paul Robinson via Dwarf-Discuss
> Sent: Tuesday, October 23, 2018 5:40 PM
> To: dwarf-discuss at lists.dwarfstd.org
> Subject: [Dwarf-Discuss] Alternate entry points
> 
> On one of the LLVM lists, a question came up about representing alternate
> entry points. Fortran and PL/I and probably other languages can do this.
> 
> I see DWARF has DW_TAG_entry_point, however the spec is completely silent
> on how this entry relates to other entries for the same subprogram.
> Should there be one "primary" DW_TAG_subprogram, which then owns the
> alternate DW_TAG_entry_point entries?  Or maybe several sibling entries
> all with DW_TAG_entry_point, and no primary DW_TAG_subprogram entry?
> I don't have a Fortran compiler handy to try this with so I'm curious
> what the current state-of-the-practice is (and of course whether this
> ought to be spelled out in the spec itself).

I dug up gfortran 5.4, which does not emit DW_TAG_entry_point with my
simple example program.  Does anybody actually use it?
--paulr

> 
> Thanks,
> --paulr
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org


From rzurob@ca.ibm.com  Wed Oct 24 05:00:26 2018
From: rzurob@ca.ibm.com (Rafik Zurob)
Date: Wed, 24 Oct 2018 01:00:26 -0400
Subject: [Dwarf-Discuss] Alternate entry points
In-Reply-To: <E3B07FDB86BFF041819DC057DEED8FEA0141AEA97C@USCULXMSG13.am.sony.com>
References: <E3B07FDB86BFF041819DC057DEED8FEA0141AEA887@USCULXMSG13.am.sony.com>
 <E3B07FDB86BFF041819DC057DEED8FEA0141AEA97C@USCULXMSG13.am.sony.com>
Message-ID: <OF9FBA1FF1.6ECF94B4-ON00258330.001B3E35-85258330.001B7FF9@notes.na.collabserv.com>

> 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:

 <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))





From ron.brender@gmail.com  Wed Oct 24 10:07:23 2018
From: ron.brender@gmail.com (Ron Brender)
Date: Wed, 24 Oct 2018 06:07:23 -0400
Subject: [Dwarf-Discuss] Alternate entry points
In-Reply-To: <OF9FBA1FF1.6ECF94B4-ON00258330.001B3E35-85258330.001B7FF9@notes.na.collabserv.com>
References: <E3B07FDB86BFF041819DC057DEED8FEA0141AEA887@USCULXMSG13.am.sony.com>
 <E3B07FDB86BFF041819DC057DEED8FEA0141AEA97C@USCULXMSG13.am.sony.com>
 <OF9FBA1FF1.6ECF94B4-ON00258330.001B3E35-85258330.001B7FF9@notes.na.collabserv.com>
Message-ID: <CANSbVTjcoD0Bb-KwehKHE5bU7EpvSLJP5iJKaigC3o5G5_f3+g@mail.gmail.com>

OpenVMS Fortran on Alpha and Itanium uses DW_TAG_entry_point as well, just
as shown in the prior email.

Ron Brender

On Wed, Oct 24, 2018 at 1:00 AM Rafik Zurob via Dwarf-Discuss <
dwarf-discuss at lists.dwarfstd.org> 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:
>
>  <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))
>
>
>
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/attachments/20181024/00c08abd/attachment.html>


From jakub@redhat.com  Wed Oct 24 10:15:53 2018
From: jakub@redhat.com (Jakub Jelinek)
Date: Wed, 24 Oct 2018 12:15:53 +0200
Subject: [Dwarf-Discuss] Alternate entry points
In-Reply-To: <OF9FBA1FF1.6ECF94B4-ON00258330.001B3E35-85258330.001B7FF9@notes.na.collabserv.com>
References: <E3B07FDB86BFF041819DC057DEED8FEA0141AEA887@USCULXMSG13.am.sony.com>
 <E3B07FDB86BFF041819DC057DEED8FEA0141AEA97C@USCULXMSG13.am.sony.com>
 <OF9FBA1FF1.6ECF94B4-ON00258330.001B3E35-85258330.001B7FF9@notes.na.collabserv.com>
Message-ID: <20181024101553.GQ11625@tucnak>

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))

	Jakub


From paul.robinson  Wed Oct 24 15:44:58 2018
From: paul.robinson (paul.robinson@sony.com)
Date: Wed, 24 Oct 2018 15:44:58 +0000
Subject: [Dwarf-Discuss] Alternate entry points
In-Reply-To: <20181024101553.GQ11625@tucnak>
References: <E3B07FDB86BFF041819DC057DEED8FEA0141AEA887@USCULXMSG13.am.sony.com>
 <E3B07FDB86BFF041819DC057DEED8FEA0141AEA97C@USCULXMSG13.am.sony.com>
 <OF9FBA1FF1.6ECF94B4-ON00258330.001B3E35-85258330.001B7FF9@notes.na.collabserv.com>
 <20181024101553.GQ11625@tucnak>
Message-ID: <E3B07FDB86BFF041819DC057DEED8FEA0141AEBABB@USCULXMSG13.am.sony.com>



> -----Original Message-----
> From: Jakub Jelinek [mailto:jakub at redhat.com]
> Sent: Wednesday, October 24, 2018 6:16 AM
> To: Rafik Zurob
> Cc: Robinson, Paul; dwarf-discuss at lists.dwarfstd.org
> Subject: Re: [Dwarf-Discuss] Alternate entry points
> 
> 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))

If the entry for 'bar' has a formal_parameter child describing 'b'
then this is behaving according to my intuition.
Thanks,
--paulr

> 
> 	Jakub


From eager@eagercon.com  Wed Oct 24 16:44:42 2018
From: eager@eagercon.com (Michael Eager)
Date: Wed, 24 Oct 2018 09:44:42 -0700
Subject: [Dwarf-Discuss] Alternate entry points
In-Reply-To: <20181024101553.GQ11625@tucnak>
References: <E3B07FDB86BFF041819DC057DEED8FEA0141AEA887@USCULXMSG13.am.sony.com>
 <E3B07FDB86BFF041819DC057DEED8FEA0141AEA97C@USCULXMSG13.am.sony.com>
 <OF9FBA1FF1.6ECF94B4-ON00258330.001B3E35-85258330.001B7FF9@notes.na.collabserv.com>
 <20181024101553.GQ11625@tucnak>
Message-ID: <8fe1bc78-7080-2692-12ea-b3bcc823974e@eagercon.com>



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


From john.e.bishop@intel.com  Wed Oct 24 18:40:41 2018
From: john.e.bishop@intel.com (Bishop, John E)
Date: Wed, 24 Oct 2018 18:40:41 +0000
Subject: [Dwarf-Discuss] Alternate entry points
Message-ID: <8AA83D0D74B8AF4EB4D90F34FA7563D3AF6BC396@ORSMSX114.amr.corp.intel.com>

Intel Fortran uses DW_TAG_entry_point as well, and shows "a" as a parameter to foo() and "b" as a parameter to alt entry point bar().

	-John Bishop


