[fpc-pascal] Debug information again

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Jun 13 15:12:21 CEST 2012

Antonio Fortuny wrote on Wed, 13 Jun 2012:

> I can see the memory leak I have generated (read below) but no  
> refecence to the line itself. Instead I receive the reference lines  
> before and after the memory leak creation inside the rtl.

The reason is that the RTL itself is compiled with optimisations. This  
means that sometimes no stack frame is generated for such routines. As  
a result, when crawling the stack, you will not see the *caller* of  
such routines in the stack trace. The only way to work around this is  
to recompile the RTL without optimisations.

FWIW, the same problem happens with any compiler that implements stack  
frame optimisations (e.g., with gcc you'd have to use  
-fno-omit-frame-pointer to prevent this from taking place; the  
equivalent FPC parameter is -Oonostackframe).

The only solution from a distribution point of view would be to either  
disable this stack frame optimisation for released units, or to  
distribute two different RTL's (one compiled with and one compiled  
without optimisations).


More information about the fpc-pascal mailing list