[fpc-pascal] GDB help needed please

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Aug 30 00:23:09 CEST 2012


On 30 Aug 2012, at 00:13, Graeme Geldenhuys wrote:

> -------------------------------
> Signal received. Signal: SIGSEGV, Segmentation fault.
> 
> #0  0040E1BB :0 SYSTEM_WAITFREE_FIXED$PMEMCHUNK_FIXED$POSCHUNK()
> #1  01FB8D3C :0 ??()
> #2  0040C51A :0 fpc_finalize()
> #3  00000001 :0 ??()
> #4  0040AD2A :0 SYSTEM_TOBJECT_$__CLEANUPINSTANCE()
> #5  00520D80 :0 $MDLEXERCISE$_Ld37()
> #6  00000001 :0 ??()
> #7  01F0D888 :0 ??()
> #8  00000000 :0 ??()
> -------------------------------
> 
> I've spent two days on this already and about to loose my mind. :-/ From the stacktrace above the only thing I can recognise, is the 'mdlexercise' text, which is a unit in our project. But without any line numbers it is like looking for a needle in a very large haystack.
> 
> Any GDB tips somebody can share, that could help me get GDB to reveal more debug information?

GDB can't give you a proper stack trace because memory has been corrupted (as evidenced by the crash in SYSTEM_WAITFREE_FIXED), and/or because the release RTL has been compiled with -O2 and that setting includes stack frame omissions (and FPC does not include stack frame layout information on i386). There's no line number information for the $MDLEXERCISE$_Ld37 symbol because that's a data label, not a code address, and hence there is simply no line number information for it.

The first thing you can try is to compile with -gh, hoping that it will abort in a place closer to the cause of the problem. -CRr is also a very useful debugging switch. If that doesn't help, you try running the program under Dr Memory (http://www.drmemory.org/ ) and/or recompiling the FPC 2.6.0 rtl from source without optimizations, optionally also with debug information. 


Jonas


More information about the fpc-pascal mailing list