[fpc-pascal]FPC Debugging (with SQLite)

Pierre Muller pierre at freepascal.org
Mon Jul 7 12:32:34 CEST 2003

At 12:35 07/07/2003, James Mills wrote:
>On Mon, Jul 07, 2003 at 08:19:38PM +1000, James Mills wrote:
>> Hi,
>> I have a problem with the SQLite library (www.sqlite.org).
>> I believe Michael helped me with the conversion of the headers and the
>> unit that Eric Jourde wrote.
>> This all works fine, however when compiling a program with the debug
>> options (-g, -gg etc), it won't produce any tracebacks of error. It
>> makes it impossible to trace down something like:
>> An unhandled exception occurred at 0x0809911D :
>>                                                List index exceeds bounds
>> (1)
>>                                                                               0x0809911D
>I found a solution to this problem by using a break point on the address
>in gdb (didn't know this till I did some digging on the break command).

You mean that inside GDB you got information
about the source position and the C structures used...

>However I would still like to know why the backtrace wasn't there to
>begin with... Normally it is :)
The problem is that GDB is reading the dynamic library
to get this information, which is not
the case for the -gl option, only the main executable debug info is read.

If you link statically to the SQLite library,
you might still not get the correct source position inside the 
library, because Free Pascal only generates stabs debugging infos,
while GCC usually uses dwarf-2 debugging format.
In that case, recompiling the library with
adding -gstabs+ to the CFLAGS option might help.

More information about the fpc-pascal mailing list