From: "Daniël Mantione" <daniel.mantione@freepascal.org>
To: FPC Core Developer List <core@freepascal.org>
Cc: Pierre Muller <muller@ics.u-strasbg.fr>,
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 06:45:00 -0000 [thread overview]
Message-ID: <alpine.DEB.1.00.0810020831550.13206@idefix.wisa.be> (raw)
In-Reply-To: <20081001163945.GI3665@adacore.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1191 bytes --]
Op Wed, 1 Oct 2008, schreef Joel Brobecker:
> The answer to the question above lies in the Pascal parser. But when
> there are homonyms, how do you specify in your program exactly which
> one you mean? And does GDB provide the same method for distinguishing
> these homonyms?
>
> (need to relearn Pascal one of these days...)
Pascal has a stack based symbol resolving (we call it the symtablestack in
the compiler). For example take for example the following program:
program my_program;
uses unit_a,unit_b,unit_c;
var a:integer;
procedure main_procedure;
var a:integer;
procedure sub_procedure;
var a:integer;
begin
a:=1;
main_procedure.a:=1;
my_program.a:=1;
unit_a.a:=1;
unit_b.a:=1;
unit_c.a:=1;
end;
begin
end;
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
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.
Daniël
next prev parent reply other threads:[~2008-10-02 6:45 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 [this message]
2008-10-02 9:07 ` Pierre Muller
2008-10-02 10:36 ` Daniël Mantione
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.0810020831550.13206@idefix.wisa.be \
--to=daniel.mantione@freepascal.org \
--cc=core@freepascal.org \
--cc=gdb-patches@sourceware.org \
--cc=gpc@gnu.de \
--cc=muller@ics.u-strasbg.fr \
/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