This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug pascal/7327] GDB scope does not work quite right for Pascal
- From: "muller at ics dot u-strasbg.fr" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Wed, 17 Sep 2014 08:17:04 +0000
- Subject: [Bug pascal/7327] GDB scope does not work quite right for Pascal
- Auto-submitted: auto-generated
- References: <bug-7327-4717 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=7327
--- Comment #3 from Pierre Muller <muller at ics dot u-strasbg.fr> ---
Yes, I do.
In fact, if you have a code like this:
procedure Global;
var
x, y : integer;
procedure local;
var
z,t : longint;
begin
z:=x;
t:=y;
end;
begin
x:=8;
y:=11;
local;
end;
fpc -g bugzilla-7327.pas
E:\pas\gdb>gdb-7.8 bugzilla-7327.exe
GNU gdb (GDB) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from bugzilla-7327.exe...done.
(gdb) b LOCAL
Breakpoint 1 at 0x40144a: file bugzilla-7327.pas, line 12.
(gdb) r
Starting program: E:\pas\gdb\bugzilla-7327.exe
[New Thread 5604.0x1ae0]
[New Thread 5604.0x1820]
Breakpoint 1, LOCAL (parentfp=0x14cff58) at bugzilla-7327.pas:12
12 z:=x;
(gdb) p X
No symbol "X" in current context.
(gdb) f 1
#1 0x0040143a in GLOBAL () at bugzilla-7327.pas:19
19 local;
(gdb) p X
$1 = 8
Inside the IDE developped for Free Pascal,
this problem is solved by using the "hidden variable" parentfp
which points to the frame of the calling Global function.
I don't know if any language supports this correctly
directly inside GDB itself.
Note that I am not sure that the parentfp trick is really
implemented and working for all CPUs supported by Free Pascal
compiler.
I have also no idea about the status of this problem with GPC compiler.
begin
Global;
end.
--
You are receiving this mail because:
You are on the CC list for the bug.