This is the mail archive of the
mailing list for the GDB project.
RE: [RFA/DWARF2] Handle nested subprograms in CU pc bound calculation
- From: "Pierre Muller" <muller at ics dot u-strasbg dot fr>
- To: "'Joel Brobecker'" <brobecker at adacore dot com>, <gdb-patches at sourceware dot org>
- Cc: <gpc at gnu dot de>, <core at freepascal dot org>
- Date: Wed, 1 Oct 2008 09:42:02 +0200
- Subject: RE: [RFA/DWARF2] Handle nested subprograms in CU pc bound calculation
- References: <20080930152757.GC23135@adacore.com> <firstname.lastname@example.org> <20080930170648.GI3811@adacore.com> <20080930173837.GA959@caradoc.them.org> <20081001011534.GA3665@adacore.com>
> -----Message d'origine-----
> De?: Joel Brobecker [mailto:email@example.com]
> Envoyé?: Wednesday, October 01, 2008 3:16 AM
> À?: Pierre Muller; firstname.lastname@example.org
> Objet?: Re: [RFA/DWARF2] Handle nested subprograms in CU pc bound
> > > Actually, now that I think of it, a slightly cleaner approach would
> > > probably be to extend the language vector to add a flag set to
> > > non-zero for the languages that want nested-subprogram handling.
> > > The only slight issue is that the CU references the language enum,
> > > which means we need to go from that enum to the language_defn to
> get access to the flag.
> > I think you should stick with a language test in the DWARF reader.
> OK. Would the following kind of patch be what you have in mind?
> Or would you prefer that the function simply take a language, rather
> than a CU. Or actually no function at all?
> 2008-09-30 Joel Brobecker <email@example.com>
> * dwarf2read.c (dwarf2_handle_nested_subprograms_p): New
> (add_partial_subprogram): Replace check of Ada language by call
> to dwarf2_handle_nested_subprograms_p.
> (dwarf2_get_subprogram_pc_bounds, load_partial_dies): Likewise.
This looks fine for me!
> This is only just for comments, as there is still one question open:
> For Ada, we store the symbols for nested subprograms in the global
> context. This allows us to break on these functions even when these
> functions are not defined in the current context. Do we want to do the
> same with Pascal? Right now, I left this functionality out...
> In Ada, we have found it to be extremely convenient to not have to be
> inside the enclosing function before we can insert the breakpoint.
> When there are ambiguities (say two functions have a nested subprogram
> with the same name), the ambiguity can be resolved using the fully
> qualified name.
I believe that, at least with the Free Pascal compiler and
stabs debugging format (which is the format I worked on), all
nested subprograms where also in the global context and thus
I would not mind to do the same for pascal language.
I must confess that I stopped working for the Free Pascal compiler
more or less when the dwarf debugging format was added, and I almost don't
anything about that format...
The only thing that I can tell, is that last time I checked
Free Pascal (version 2.2.0 windows 32bit target) with -gw (dwarf debugging
I still got lots of errors while trying to load the compiler inside gdb :(
I know even less about GNU pascal compiler, but as this compiler is
base on the GNU multi-language compiler, I would except it to behave closer
GNU C++ or GNU Ada.
I must confess that I don't even know if the full specification
would work for pascal in case the same name is used globally and as
a nested procedure (I do know that you are allowed
to reuse a name defined globally as a local procedure, function or variable
inside a function, but I don't know if the
(gdb) break GlobalFuntion.LocalFunction
Feedback from both Free Pascal and GNU pascal developers
would be useful here and more generally on pascal dwarf support.
> Tested on x86-linux, no regression (but I don't have a Pascal
The pascal testsuite is ridiculously tiny (I only wrote a few
very basic tests) and there is nothing about nested functions/procedures in
So there is nothing to expect on this side.
By the way, it would probably be useful to repeat the tests
with different debugging formats.
How can this be done in your testsuite directory?
Pascal language support maintainer for GDB