[fpc-pascal]Strange indexing problem - gdb or fpc?

Pierre Muller pierre at freepascal.org
Mon Apr 22 17:49:43 CEST 2002


At 17:30 22/04/2002 , JOHN COPPENS a écrit:
>Hi Pierre.
>
>Here's the routine that gave the problems with gdb:
>
>     procedure enterreal(x: real);
>     var
>       rr: integer;
>     begin
>       if r = (rmax - 1) then
>         fatal(10)
>       else begin
>         rr := r + 1;
>         rconst[rr] := x;
>         realindex := 1;
>         while rconst[realindex] <> x do
>           inc(realindex);
>         if realindex > r then
>           r := realindex;
>       end;
>     end;  { enterreal }

gdb 5.0 does not contain pascal language support,
thus your display is based on C language that does not know about arrays
that are not zero based... If rconst is a one-based array, this
probably explains your problem.

>(This is part of the didactic Pascal-FC compiler to show concurrent
>  processes and inter-process communication - author Alan Burns. I am
>  extending this compiler to include a few more modern primitives;
>  This routine stores real constants in a table, avoiding duplicates)
>
>  I am on Linux 2.4.17, using fpc 1.0.4, gdb 5.0. 
>
>  When debugging, I get the strange results as described in the previous
>message.

Try to get the gdb 5.1 or 5.1.1 version that has integrated pascal language support
or use the source patch to gdb for 5.0 to add this pascal language support
(this will also allow you to inspect pascal sets or strings).

Accessible via the cvsweb interface
http://www.freepascal.org/develop.html#cvs
in
projects/gdbpas/v5.0/patch file.






More information about the fpc-pascal mailing list