From: "Daniël Mantione" <daniel.mantione@freepascal.org>
To: FPC Core Developer List <core@freepascal.org>
Cc: gpc@gnu.de, gdb-patches@sourceware.org
Subject: Re: [Core] [RFA/DWARF2] Handle nested subprograms in CU pc bound calculation
Date: Thu, 02 Oct 2008 10:36:00 -0000 [thread overview]
Message-ID: <alpine.DEB.1.00.0810021109140.13206@idefix.wisa.be> (raw)
In-Reply-To: <00a101c9246e$22ebc8d0$68c35a70$@u-strasbg.fr>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2991 bytes --]
Op Thu, 2 Oct 2008, schreef Pierre Muller:
> Daniel, did you really try to compile this?
> Both Free Pascal 1.0.10 and 2.2.0 fail to compile
> on the 'main_procedure.a:=1;' line.
No, I didn't try to compile this.
>> So each procedure context can redefine identifiers.
>>
>> Inside sub_procedure, the symtablestack will look like:
>>
>> unit_a
>> unit_b
>> unit_c
>> my_program
>> main_procedure
>> sub_procedure
>
> The stack is correct, but the problem is that
> if main_procedure would be a function, then
> main_function would be usable inside sub_procedure
> either as a nested call by adding an explicit main_function()
> even if the function has no parameters, or to
> set the return value of main_function function.
Correct.
> Thus main_function. is not allowed
> at least not for versions <= 2.2.0.
> Did that change in 2.2.2?
No, if this identifier is hidden in a local symtable as function result,
you have to use my_program.main_function.
>> When searching for a symbol, the compiler will search the symbol tables
>> bottom to top, starting at sub_procedure, ending at unit_a, the first
>> symbol found is used. GDB would need to implement the same behaviour in
>> it's Pascal mode.
>
> The main current problem is that GDB knows nothing about
> the used or loaded units ...
I don't think it needs to. unit_a, unit_b and unit_c are valid Pascal
identifiers inside the symbol table of my_program. It should be possible
to generate debug information for these identifiers.
If GDB can handle sub_procedure as member of main_procedure, it should be
able to handle "a" as member of unit_a, this is the same situation, I
think?
> In stabs, I believe that there is no information on that...
> Does dwarf have something about this?
Stabs is too limited for this. Dwarf could handle the full Pascal
language, but it needs to be implemented in both debugger and compiler.
> Of course, we could try to demangle the assembler labels used
> to extract unit name, but I seem to remember that, at least for
> Free Pascal, that mangling scheme is version dependent, which
> will not simplify things :(
Demangling should not be done at all, since the choice of the mangled name
is at the discretion of the compiler. The ppu contains the correct mangled
name for a certain procedure, but it is not guaranteed that you can go the
other way. If the mangled name becomes too long (imagine a procedure with
100 parameters), the compiler starts using CRC checksums as mangled name,
you can never parse this.
All information the compiler has available is inside the ppu and the debug
information is generated from it. We should simply place anything GDB
needs into the debug information.
> I also vaguely remember that GPC did not, at least for a
> while, add anything to the procedure/function names
> declared in the interface part of units, as in C language.
This is correct, but making GDB support it correctly should have no
negative impacts for GPC.
Daniël
next prev parent reply other threads:[~2008-10-02 10:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-30 15:28 Joel Brobecker
2008-09-30 15:43 ` Daniel Jacobowitz
2008-09-30 16:56 ` Joel Brobecker
2008-09-30 17:05 ` Daniel Jacobowitz
2008-09-30 15:43 ` Pierre Muller
2008-09-30 17:07 ` Joel Brobecker
2008-09-30 17:39 ` Daniel Jacobowitz
2008-10-01 1:16 ` Joel Brobecker
2008-10-01 7:43 ` Pierre Muller
2008-10-01 8:33 ` [Core] " Jonas Maebe
2008-10-01 16:40 ` Joel Brobecker
2008-10-01 21:56 ` [Core] " Jonas Maebe
2008-10-02 6:45 ` Daniël Mantione
2008-10-02 9:07 ` Pierre Muller
2008-10-02 10:36 ` Daniël Mantione [this message]
2008-10-03 0:31 ` Joel Brobecker
2008-09-30 16:58 ` Joel Brobecker
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=alpine.DEB.1.00.0810021109140.13206@idefix.wisa.be \
--to=daniel.mantione@freepascal.org \
--cc=core@freepascal.org \
--cc=gdb-patches@sourceware.org \
--cc=gpc@gnu.de \
/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