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

Marcos Douglas md at delfire.net
Tue Mar 20 18:00:06 CET 2012


On Tue, Mar 20, 2012 at 12:24 PM, Martin <lazarus at mfriebe.de> wrote:
> On 20/03/2012 14:52, Marcos Douglas wrote:
>>
>> On Tue, Mar 20, 2012 at 11:36 AM, Martin<lazarus at mfriebe.de>  wrote:
>>>
>>> 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:
>>>>>>
>>>>>> ERROR
>>>>>> ,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?
>>
>> I use gdb 7.3 (http://svn.freepascal.org/svn/lazarus/binaries/) only in 32
>> bit.
>>
>>> Do all lines get a blue dot? (except maybe "else" and empty lines)
>>>
>> Definitely yes.
>>
>>> -----------
>>> Where to get mssqlcon ?
>>>
>>> ----
>>
>> In trunk
>> http://svn.freepascal.org/svn/fpc/trunk/packages/fcl-db/src/sqldb/mssql/
>> But I had these sources because I tested for LacaK before merged in FPC
>> sources.
>>
>>> As workarounds:
>>> 1) Try setting a breakpoint on next command and use F9
>>> 2) Single step in assembler window (single step asm instructions)
>>
>> if I use F9 this problem does not occur.
>>
>>> Did you try to continue, after the error (if you are lucky, it might be
>>> possible)?
>>
>> Yes, I tried.
>> No is possible to continue and the negative number is going
>> incrementing two by two.
>
>
> For any kind of stepping yes.
>
> But does F9 run?
> e.g. set your own next breakpoint, and use F9

If I have 2 breakpoint:
Stop on the first... F9;
Stop on the second... F9..... no errors.

But, in the second, if I use F8.... error.

> Or try asm steps
>
> ---
> Both F8 and F7 mean the debugger must work out the address of the next
> statement (or list of possible next statements)
>
> It seems the debugger gets this address wrong, and therefore it can not set
> the breakpoint.
> Breakpoint numbers are not re-used. So that is why each time you see a new
> number.
>
> Positive numbers: breakpoints set by you
> Negative: breakpoints internally used by GDB

Anyway, thanks for the GDB tips.

Marcos Douglas



More information about the fpc-pascal mailing list