[fpc-devel] protecting dataspace suggestion

Peter Vreman peter at freepascal.org
Mon Apr 17 18:59:39 CEST 2006


At 13:44 17-4-2006, you wrote:
> > >I don't understand the way FPC stores debug information: line info 
> etc. It
> > >seems useful to not lose this information or at least know, that it was
> > >overwritten.
> > >I got some run time errors with no line info (when compiled with -gcl
> > >option), all of them should be "unreproducible", because all of them
> > >appeared in not so small projects. If they could be caused by overwritten
> > >memory, it would be useful to know about it.
> > Debug information is never loaded into memory it is only available on 
> the disk.
> > Peter
>
>It's dubious.
>
>{$R+}
>var a,b:integer;
>begin
>move(a,b,2000);
>a:=32000;
>b:=32000;
>a:=a*b;
>end.
>
>I use win32.
>This program (16 bit integer) produces very different results with 
>different values of third parameter of move(a,b,*). System crash (OS 
>exception arises), "normal" work (no exception, no messages), and run time 
>errors 201 or 216 with line info (line 7 or 4) (this is the supposed behavior).
>
>Looking at asm source I see, that data segment contains very very much...

This is some theoritical example. Real programs should avoid globals as 
much as possible. They are also not good for threading.

Also in the debugger with some hardware watchpoints in the datasegment you 
find the culprit very quickly.


Peter




More information about the fpc-devel mailing list