[fpc-pascal] SQLdb: problem using GDB, but do not have memleak

Martin lazarus at mfriebe.de
Tue Mar 20 15:36:46 CET 2012

On 20/03/2012 14:08, Marcos Douglas wrote:
> On Tue, Mar 20, 2012 at 9:34 AM, Martin<lazarus at mfriebe.de>  wrote:
>> On 20/03/2012 12:08, Marcos Douglas wrote:
>>> Hi,
>>> I was testing the new connector to MSSQL when I found a problem.
>>> If I compile and run in console, I have no memleak. Good. But if I put
>>> a breakpoint in AConnection.Free; and press F8, I got this:
>>> ,msg="Warning:\nCannot insert breakpoint -237.\nError accessing memory
>>> address 0x7816cd30: Input/output error.\n"
>> A negative breakpoint means internal to gdb (like a breakpoint gdb sets for
>> stepping). So when you press F8 gdb apparently can't get the correct
>> location where the step should end.
>> Are you sure your app (and package that has debug info) are compiled:
>> - with either -O0 or -O1 (no other optimization enabled)
>> - your app is NOT smartlinked
>> wiki.lazarus.freepascal.org/GDB_Debugger_Tips
> Martin,
> I recompiled FPC and Lazarus using -gl -gw2 -godwarfsets options, but
> the problem continues.
I don't know where/why it upsets gdb.

The above will allow you to step into RTL/packages.

It certainly is no error in the app, but a problem in the debug info (or 
what gdb makes of it).

There are 3 possibilities:
1) FPC writes bad debug info. You can try -gs versus -gw (stabs/dwarf).
2) The linker gets it wrong. Try -Xe
3) gdb is buggy. Which version are you on?

Do all lines get a blue dot? (except maybe "else" and empty lines)

Where to get mssqlcon ?

As workarounds:
1) Try setting a breakpoint on next command and use F9
2) Single step in assembler window (single step asm instructions)

Did you try to continue, after the error (if you are lucky, it might be 

For 64 bit, latest gdb (I have not tested it yet)


More information about the fpc-pascal mailing list