[fpc-pascal] weird compiler(?) problem

Martin Frb lazarus at mfriebe.de
Fri Feb 14 03:11:48 CET 2014


On 14/02/2014 01:36, Xiangrong Fang wrote:
> Hi Martin,
>
> 2014-02-14 1:14 GMT+08:00 Martin Frb <lazarus at mfriebe.de 
> <mailto:lazarus at mfriebe.de>>:
>
>     With -O2 and above the debugger does not always work.
>
>     In case of such optimization the debug info compiled into the exe
>     by fpc is not always accurate.
>
>     It is not just blue dots, inspecting variables may show random
>     data, ....
>
>     Debugging with O2 and up, if you must, requires to only look at
>     the disassembler and register window. registers can only be
>     trusted in the ttop stackframe. selecting any other may not show
>     correct info.
>
>
> I never use optimization option other than O1, I think O1 is the 
> default.  As Sven suggested, I tried turning off optimization, and 
> back on, still at O1 level.
>

Sorry, then I misunderstood you.

So where the blue dots missing, while you where at -O-? Or where they 
missing at -O1, and after you went to -O-, compiled (run), and went back 
to -O-1 they came back?

In either case, they should be there with -O- and -O1 , so if that is 
all you changed, then maybe it needed a clean build, and by changing 
settings, you triggered this clean build.

---
Strange though, because without blue dots, normally breakpoints to not 
work, but yours did (on the wrong line, but it did break).

The only other thing I can think of is, if you have symlinks to your 
files, and did open them in the IDE via different links/original. And/or 
fpc used a different symlink than the IDE.

In that cases it can happen that the IDE believes you have 2 independent 
files, while really you got just one. However breakpoints will work, 
because the error gets corrected when the IDE gives the wrong path to 
gdb, and retries with filename (no path) only. then gdb will set the 
breakpoint.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140214/e48cc1cf/attachment.html>


More information about the fpc-pascal mailing list