Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Kempke, Nils-Christian via Gdb-patches" <gdb-patches@sourceware.org>
To: Tom Tromey <tom@tromey.com>,
	Nils-Christian Kempke via Gdb-patches
	<gdb-patches@sourceware.org>
Cc: "jinisusan.george@amd.com" <jinisusan.george@amd.com>,
	"aburgess@redhat.com" <aburgess@redhat.com>
Subject: RE: [PATCH v4 3/3] dwarf, fortran: add support for DW_TAG_entry_point
Date: Mon, 8 Aug 2022 16:52:41 +0000	[thread overview]
Message-ID: <CY4PR1101MB20718AA9A45B7CC75E862D10B8639@CY4PR1101MB2071.namprd11.prod.outlook.com> (raw)
In-Reply-To: <87pmi6m9ot.fsf@tromey.com>

> -----Original Message-----
> From: Tom Tromey <tom@tromey.com>
> Sent: Friday, July 15, 2022 9:57 PM
> To: Nils-Christian Kempke via Gdb-patches <gdb-patches@sourceware.org>
> Cc: Kempke, Nils-Christian <nils-christian.kempke@intel.com>;
> aburgess@redhat.com; Tim Wiederhake <tim.wiederhake@intel.com>;
> Bernhard Heckel <bernhard.heckel@intel.com>;
> jinisusan.george@amd.com; tom@tromey.com
> Subject: Re: [PATCH v4 3/3] dwarf, fortran: add support for
> DW_TAG_entry_point
> 
> >>>>> Nils-Christian Kempke via Gdb-patches <gdb-
> patches@sourceware.org> writes:
> 
> > Fortran provides additional entry points for subroutines and functions.
> > These entry points may use only a subset (or a different set) of the
> > parameters of the original subroutine.  The entry points may be described
> > via the DWARF tag DW_TAG_entry_point.
> 
> > @@ -21797,12 +21852,15 @@ determine_prefix (struct die_info *die,
> struct dwarf2_cu *cu)
> >  	return "";
> >        case DW_TAG_subprogram:
> >  	/* Nested subroutines in Fortran get a prefix with the name
> > -	   of the parent's subroutine.  */
> > +	   of the parent's subroutine.  Entry points are prefixed by the
> > +	   parent's namespace.  */
> >  	if (cu->lang () == language_fortran)
> >  	  {
> >  	    if ((die->tag ==  DW_TAG_subprogram)
> >  		&& (dwarf2_name (parent, cu) != NULL))
> >  	      return dwarf2_name (parent, cu);
> > +	    else if (die->tag == DW_TAG_entry_point)
> > +	      return determine_prefix (parent, cu);
> >  	  }
> 
> It seems to me that this will also need a special case in
> cooked_indexer::index_dies to ensure that the cooked_index_entry for the
> entry point has the correct parent.  Parent relationships are how name
> components are determined there, so IIUC the entry point's parent should
> be the same as the subroutine's parent -- not the subroutine itself.
> 
> One way to see whether this works is to write a .gdb_index and then dump
> it and examine the resulting name of the entry point.
> 
> thanks,
> Tom

Hi Tom,

Thanks for the review - ah, I see. Let me quickly recap just to see whether I
understood this: when writing the gdb_index we use the
full_name (struct obstack *storage) method of the cooked_index_entry.

In order for the name scope to be correct we'd have to set the function's
parent as the entry's parent.

I changed this now to correctly set the cooked_index_entry's parent but,
I could not test this with my Fortran examples/code.  The problem is that
full_name (struct obstack *storage) does not consider the scope when
the language is set to Fortran - while I could verify that the parent is set
correctly and the name would be printed correctly if I hack the language if
a bit - with Fortran code (the currently only user of DW_TAG_entry_point
I know), full_name will return 'canonical' which is still the name of the
entry point without scope.

I will send a v5 shortly with the above mentioned change.

Thanks,
Nils
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-08-08 16:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 11:12 [PATCH v4 0/3] Fortran entry and DW_TAG_entry_point Nils-Christian Kempke via Gdb-patches
2022-07-13 11:12 ` [PATCH v4 1/3] gdb, dwarf: move part of dwarf2_get_pc_bounds into separate function Nils-Christian Kempke via Gdb-patches
2022-07-13 11:12 ` [PATCH v4 2/3] gdb, dwarf: add assert to dwarf2_get_pc_bounds Nils-Christian Kempke via Gdb-patches
2022-07-13 11:12 ` [PATCH v4 3/3] dwarf, fortran: add support for DW_TAG_entry_point Nils-Christian Kempke via Gdb-patches
2022-07-15 19:56   ` Tom Tromey
2022-08-08 16:52     ` Kempke, Nils-Christian via Gdb-patches [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=CY4PR1101MB20718AA9A45B7CC75E862D10B8639@CY4PR1101MB2071.namprd11.prod.outlook.com \
    --to=gdb-patches@sourceware.org \
    --cc=aburgess@redhat.com \
    --cc=jinisusan.george@amd.com \
    --cc=nils-christian.kempke@intel.com \
    --cc=tom@tromey.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