public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Kempke, Nils-Christian" <nils-christian.kempke@intel.com>
To: Kevin Buettner <kevinb@redhat.com>,
	Nils-Christian Kempke via Gdb-patches
	<gdb-patches@sourceware.org>
Subject: RE: [RFC][PATCH 0/1] Fortran entry and DW_TAG_entry_point
Date: Mon, 11 Apr 2022 16:08:32 +0000	[thread overview]
Message-ID: <CY4PR1101MB2071EA07947232F69F488A5AB8EA9@CY4PR1101MB2071.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220408133655.3a556fc4@f35-zws-1>

Hi Kevin,

- thanks for having a look!

> I skimmed the dwarf2/read.c part of the patch; I think it looks
> reasonable, though I'd prefer that the comment introducing
> add_partial_entry_point() not refer to Fortran entry points.
> (DW_TAG_entry point could be used for other languages too, right?)
>
Yes, absolutely. I'll change that - it is in theory language agnostic (even
though it might have been introduced with Fortran in mind).

About the tests: yes, good point. Somehow I did not think of
that at all .. 

I will add a proper DWARF test and resend the patch. I would keep the
existing test too - it seems to have some value still in testing whether the
entry point feature is correctly handled inside GDB and respective compilers.

- Nils

> -----Original Message-----
> From: Kevin Buettner <kevinb@redhat.com>
> Sent: Friday, April 8, 2022 10:37 PM
> To: Nils-Christian Kempke via Gdb-patches <gdb-patches@sourceware.org>
> Cc: Kempke, Nils-Christian <nils-christian.kempke@intel.com>
> Subject: Re: [RFC][PATCH 0/1] Fortran entry and DW_TAG_entry_point
> 
> Hi Nils,
> 
> I skimmed the dwarf2/read.c part of the patch; I think it looks
> reasonable, though I'd prefer that the comment introducing
> add_partial_entry_point() not refer to Fortran entry points.
> (DW_TAG_entry point could be used for other languages too, right?)
>
> As for the test case, I think you should use the DWARF assembler to
> make a test case which uses DW_TAG_entry_point.  That way we don't
> depend on having a compiler which outputs the correct info.  This test
> case would be placed in gdb/testsuite/gdb.dwarf2 instead of
> gdb/testsuite/gdb.fortran.
> 
> You can find existing test cases which use the DWARF assembler by
> searching for "load_lib dwarf.exp" in the .exp files in
> gdb/testsuite/gdb.dwarf2.  At present there are nearly 200 .exp files
> which contain this line, so there are plenty of examples.
> 
> Kevin
> 
> On Wed, 23 Mar 2022 11:53:18 +0100
> Nils-Christian Kempke via Gdb-patches <gdb-patches@sourceware.org>
> wrote:
> 
> > Hi,
> >
> > please find attached a patch that enables GDB to parse the
> > DW_TAG_entry_point DWARF tag.
> >
> > It was already sent to the mailing list a while ago but got lost in
> > review (see the commit message of the attached patch).
> >
> > The patch was originally written with ifort in mind, the only compiler
> > we know of, that actually emits the DW_TAG_entry_point.  It is used to
> > describe alternative entry points to functions defined with Fortran's
> > 'entry' keyword.  With this patch it becomes possible to define and hit
> > breakpoints in an executable that uses the 'entry' feature and has been
> > compiled with ifort.
> >
> > Gfortran and ifx actually follow a different way to describe Fortran entry
> > points.  Both emit a DW_TAG_subprogram instead.
> >
> > Sadly, the DWARF emitted by ifort is not quite correct for the given
> > test (or any other entry point test we tried).  Some parameters of
> > subroutines and entry points have a wrong DWARF location description.  So
> > even though hitting breakpoints is possible in the test, printing of the
> > passed variables fails and running the test with ifort will still produce
> > FAILs.
> >
> > With this in mind, we were unsure what to do with this patch, thus the RFC.
> > On the one hand we did not want the patch to be lost.  On the other hand
> the
> > compiler the patch was written for has some issues in its emitted DWARF
> > and we do not know when these issues can/will get fixed.
> >
> > Note, that the attached test only fully passes with gfortran.  Ifx, while
> > able to define breakpoints at entry points, also has issues producing
> > correct DWARF for entry points (using the DW_TAG_subprogram
> approach).
> >
> > The patch was tested with the standard board, unix/-m32,
> > navtive-gdbserver and native-extended-gdbserver and we did not find any
> > regressions with these.
> >
> > Any feedback is highly welcome.
> >
> > Cheers!
> >
> > Nils
> >
> > Nils-Christian Kempke (1):
> >   dwarf, fortran: add support for DW_TAG_entry_point
> >
> >  gdb/dwarf2/read.c                         | 101 ++++++++++++++++++++++
> >  gdb/testsuite/gdb.fortran/entry-point.exp |  67 ++++++++++++++
> >  gdb/testsuite/gdb.fortran/entry-point.f90 |  48 ++++++++++
> >  3 files changed, 216 insertions(+)
> >  create mode 100644 gdb/testsuite/gdb.fortran/entry-point.exp
> >  create mode 100644 gdb/testsuite/gdb.fortran/entry-point.f90
> >
> > --
> > 2.25.1
> >
> > Intel Deutschland GmbH
> > Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
> > Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
> > Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
> > Chairperson of the Supervisory Board: Nicole Lau
> > Registered Office: Munich
> > Commercial Register: Amtsgericht Muenchen HRB 186928
> >

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


      reply	other threads:[~2022-04-11 16:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 10:53 Nils-Christian Kempke
2022-03-23 10:53 ` [RFC][PATCH 1/1] dwarf, fortran: add support for DW_TAG_entry_point Nils-Christian Kempke
2022-04-08 20:36 ` [RFC][PATCH 0/1] Fortran entry and DW_TAG_entry_point Kevin Buettner
2022-04-11 16:08   ` Kempke, Nils-Christian [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CY4PR1101MB2071EA07947232F69F488A5AB8EA9@CY4PR1101MB2071.namprd11.prod.outlook.com \
    --to=nils-christian.kempke@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).