[PATCH v2 1/1] dwarf, fortran: add support for DW_TAG_entry_point

Kempke, Nils-Christian nils-christian.kempke@intel.com
Wed Jul 6 15:30:37 GMT 2022



> -----Original Message-----
> From: Tom Tromey <tom@tromey.com>
> Sent: Thursday, May 26, 2022 7:35 PM
> To: Kempke, Nils-Christian via Gdb-patches <gdb-patches@sourceware.org>
> Cc: Tom Tromey <tom@tromey.com>; Kempke, Nils-Christian <nils-
> christian.kempke@intel.com>; jinisusan.george@amd.com; Bernhard Heckel
> <bernhard.heckel@intel.com>; Tim Wiederhake
> <tim.wiederhake@intel.com>
> Subject: Re: [PATCH v2 1/1] dwarf, fortran: add support for
> DW_TAG_entry_point
> 
> >>>>> Kempke, Nils-Christian via Gdb-patches <gdb-
> patches@sourceware.org> writes:
> 
> >> If it's needed I suppose I would expect some other changes to the
> >> indexer.  Like maybe cooked_indexer::index_dies has to handle it, or
> >> cooked_index_entry::matches(search_domain).
> 
> > I am honestly not quite sure about the two parts you pointed out.
> > What I think I understand it this:
> 
> > In cooked_index_entry::matches(search_domain) we could add the
> > DW_TAG_entry_point to the FUNCTIONS_DOMAIN (similar to
> > DW_TAG_subroutine). Not sure if this would be wanted but I think
> > this is quite reasonable. Entry points are virtually like separate functions
> > with their own argument lists.
> 
> > I am not sure what this would actually change within GDB though -
> commands
> > like 'info functions' and 'info module functions'
> 
> The test case in this situation is to have an entry point in some other
> CU -- not the same one with the program's "main" -- and then try to
> "break" on the entry point.
> 
> I think this should make gdb try to look up the function via the index,
> but since the matching will fail, I suspect it won't cause CU expansion,
> and so the entry point won't be found.
> 
> > The other part you mentioned is cooked_indexer::index_dies. I think here
> the
> > change you meant is to recurse the entry if it is a DW_TAG_entry_point? In
> my
> > understanding this would then also index possibly interesting child DIEs,
> right?
> 
> Yeah, I think I was mistaken about this one.
> 
> thanks,
> Tom

Hi Tom,

It took me a while but now: yes, you are right - when compiling (with ifort) e.g.
a static library containing an entry point, linking it and trying to break on the
entry point the symbol lookup fails as the symtab is not created.

I added the entry_point to the FUNCTIONS_DOMAIN now and also found another
place where I probably had missed to add DW_TAG_entry_point.  In
write_cooked_index I added it to the GDB_INDEX_SYMBOL_KIND_FUNCTION.

I adapted the testcase and added a second cu to the DWARF testing the lookup of
the entry_point.

I'll send a v3 soon with these changes.

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



More information about the Gdb-patches mailing list