Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-03

SQLdb: problem using GDB, but do not have memleak

21 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marcos Douglas

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"

I don't know if this problem happen just in new connector. I don't have others DBMS installed here, justo MSSQLServer so, could you test using another class to connect in other DBMS?

The code below is very simple (see http://wiki.freepascal.org/SqlDBHowto). -------------------------------------------------------------------------------- program t1;

{$mode objfpc}{$H+}

uses
heaptrc,
Classes, SysUtils, DB, sqldb,
mssqlconn; << change

var
  AConnection : TSQLConnection;
Procedure CreateConnection;
begin
  AConnection := TMSSQLConnection.Create(nil);  << change
  AConnection.Hostname := 'localhost';
  AConnection.DatabaseName := 'database';
  AConnection.UserName := 'user';
  AConnection.Password := '**********';
end;
begin
  CreateConnection;
  AConnection.Open;
  if Aconnection.Connected then
    writeln('Succesful connect!')
  else
    writeln('Error');
  AConnection.Close;
  AConnection.Free;  << breakpoint here
  writeln('done');
end.

My ENV is:
Lazarus 0.9.31 r36175 FPC 2.6.1 i386-win32-win32/win64

FPC
URL: http://svn.freepascal.org/svn/fpc/branches/fixes_2_6 Repository Root: http://svn.freepascal.org/svn/fpc Repository UUID: 3ad0048d-3df7-0310-abae-a5850022a9f2 Revision: 20521
Node Kind: directory
Schedule: normal
Last Changed Author: marco
Last Changed Rev: 20519
Last Changed Date: 2012-03-15 09:18:24 -0300 (Thu, 15 Mar 2012)

GDB
URL: http://svn.freepascal.org/svn/lazarus/binaries Repository Root: http://svn.freepascal.org/svn/lazarus Repository UUID: 4005530d-fff6-0310-9dd1-cebe43e6787f Revision: 36176
Node Kind: directory
Schedule: normal
Last Changed Author: martin
Last Changed Rev: 32524
Last Changed Date: 2011-09-27 13:23:25 -0300 (Tue, 27 Sep 2011) --------------------------------------------------------------------------------

Thanks,
Marcos Douglas

Reply by email

Martin
to Marcos Douglas
Marcos Douglas wrote 11 lines
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

Reply by email

Marcos Douglas
to Martin
Martin wrote 24 lines
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

I compile FPC using these options: UPXPROG=echo COPYTREE=echo OPT="-gl" My applications, in debbuger mode, always use -O1 option. I use smartlinked option just for release.

Marcos Douglas

Reply by email

Marcos Douglas
to Martin: A negative breakpoint means internal to gdb (like a breakpoint gdb sets for stepping). So…
Martin wrote 23 lines
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.

Marcos Douglas
PS: Guys, sorry about my mail before. It would be for other list, in Portuguese.

Reply by email

Martin
to Marcos Douglas
Marcos Douglas wrote 26 lines
On Tue, Mar 20, 2012 at 9:34 AM, Martin 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?

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 possible)?

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

http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/4.7.0-3/x86_64-w64-mingw32-gcc-4.7.0-3_rubenvb.7z/download

Reply by email

Marcos Douglas
to Martin
Martin wrote 43 lines
On 20/03/2012 14:08, Marcos Douglas wrote: > > On Tue, Mar 20, 2012 at 9:34 AM, Martin  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.

Show quoted text 5 lines

I only use 32 bit.

Marcos Douglas

Reply by email

Martin
to Marcos Douglas
Marcos Douglas wrote 63 lines
On Tue, Mar 20, 2012 at 11:36 AM, Martin wrote: > On 20/03/2012 14:08, Marcos Douglas wrote: >> On Tue, Mar 20, 2012 at 9:34 AM, Martin 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

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

Reply by email

Martin
to Marcos Douglas: I use gdb 7.3 (http://svn.freepascal.org/svn/lazarus/binaries/) only in 32 bit.…
Marcos Douglas wrote 7 lines
> ERROR > ,msg="Warning:\nCannot insert breakpoint -237.\nError accessing memory > address 0x7816cd30: Input/output error.\n" > I use gdb 7.3 (http://svn.freepascal.org/svn/lazarus/binaries/) only in 32 bit. I only use 32 bit.

Interesting. 0x7816cd30

I usually get addresses around 0x0400000 for 32 bit. It can be changed by config. But if you have not... Check witth the disassembler where the rest of your code is.

Maybe that address is in a DLL or kernel? It still wouldn't explain why gdb would try to set a break there, but maybe why it can not.

Reply by email

Marcos Douglas
to Martin: For any kind of stepping yes. But does F9 run? e.g. set your own next breakpoint, and use…
Martin wrote 83 lines
On 20/03/2012 14:52, Marcos Douglas wrote: > > On Tue, Mar 20, 2012 at 11:36 AM, Martin  wrote: >> >> On 20/03/2012 14:08, Marcos Douglas wrote: >>> >>> On Tue, Mar 20, 2012 at 9:34 AM, Martin    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.

Show quoted text 13 lines
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

Reply by email

Marcos Douglas
to Jonas Maebe: You should use OPT="-O- -gl" if you want to debug standard FPC units. The default for…
Jonas Maebe wrote 9 lines
On 20 Mar 2012, at 14:06, Marcos Douglas wrote: I compile FPC using these options: UPXPROG=echo COPYTREE=echo OPT="-gl" You should use OPT="-O- -gl" if you want to debug standard FPC units. The default for building the entire FPC source tree is -O2. Optimizations generally have little effect on the line number information though.

Before I used OPT="-gl" and I already debug FPC units. I recompiled using OPT="-gl -gw2 -godwarfsets" after read this link: wiki.lazarus.freepascal.org/GDB_Debugger_Tips

The OPT="-O- -gl" options are better?

Marcos Douglas

Reply by email

Marcos Douglas
to Martin: Interesting. 0x7816cd30 I usually get addresses around 0x0400000 for 32 bit. It can be…
Martin wrote 20 lines
On 20/03/2012 14:52, Marcos Douglas wrote: >> >> ERROR >> ,msg="Warning:\nCannot insert breakpoint -237.\nError accessing memory >> address 0x7816cd30: Input/output error.\n" >> > I use gdb 7.3 (http://svn.freepascal.org/svn/lazarus/binaries/) only in 32 > bit. > I only use 32 bit. Interesting.  0x7816cd30 I usually get addresses around 0x0400000 for 32 bit. It can be changed by config. But if you have not... Check witth the disassembler where the rest of your code is. Maybe that address is in a DLL or kernel? It still wouldn't explain why gdb would try to set a break there, but maybe why it can not.

Well, SQLdb uses a DLL to connect. Perhaps a clue? Although some friends also tested using others drivers and got the same problem.

Marcos Douglas

Reply by email

Martin
to Marcos Douglas: I was testing the new connector to MSSQL when I found a problem. If I compile and run in…
Marcos Douglas wrote 10 lines
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"

Does the issue happen the first time you press F8, or to you have to press a 2nd time?

In other words: Is it possble the debugger pauses inside free (possible in a dll) and that when you hit F8 then, it can not step, because the dll has no debug info?

If in stopped in the DLL, it might still put the green arrow on your source => first stack with frame debug info...

Open and watch the stack window.

---
Also open the "debug output" window. Open this one before you start your app. Then copy the content.

---
If indeed gdb stops inside a dll, then F8 simply can not work

Reply by email

Sven Barth
to Marcos Douglas: Before I used OPT="-gl" and I already debug FPC units. I recompiled using OPT="-gl -gw2…
Marcos Douglas wrote 16 lines
On Tue, Mar 20, 2012 at 12:35 PM, Jonas Maebe wrote: > > On 20 Mar 2012, at 14:06, Marcos Douglas wrote: > > I compile FPC using these options: UPXPROG=echo COPYTREE=echo OPT="-gl" > > > You should use OPT="-O- -gl" if you want to debug standard FPC units. The > default for building the entire FPC source tree is -O2. Optimizations > generally have little effect on the line number information though. Before I used OPT="-gl" and I already debug FPC units. I recompiled using OPT="-gl -gw2 -godwarfsets" after read this link: wiki.lazarus.freepascal.org/GDB_Debugger_Tips The OPT="-O- -gl" options are better?

You should at least add the "-O-" to your OPT argument, because this way the optimizations are switched off which might(!) cause your debug problems.

Regards,
Sven

Reply by email

Marcos Douglas
to Martin: Does the issue happen the first time you press F8, or to you have to press a 2nd time? In…
Martin wrote 15 lines
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" > Does the issue happen the first time you press F8, or to you have to press a 2nd time?

When I press a first time... but I think some times in a 2nd time. =|

In other words: Is it possble the debugger pauses inside free (possible in a dll) and that when you hit F8 then, it can not step, because the dll has no debug info?

Yes, I think is possible...

Show quoted text 8 lines
If in stopped in the DLL, it might still put the green arrow on your source => first stack with frame debug info... Open and watch the stack window. --- Also open the "debug output" window. Open this one before you start your app. Then copy the content.

The content was copied below.

--- If indeed gdb stops inside a dll, then F8 simply can not work

====================================================

<-file-exec-and-symbols "W:/md/dev/freepascal/lib/gh/bin/dbtest.exe"> ^done
(gdb)
<-gdb-set language pascal>
^done
(gdb)
<-environment-cd .>
^done
(gdb)
<-environment-cd "W:/md/dev/freepascal/lib/gh/bin/"> ^done
(gdb)
<-data-evaluate-expression FPC_THREADVAR_RELOCATE_PROC> ^done,value="0x0"
(gdb)
<-exec-arguments >
^done
(gdb)
<-gdb-set language pascal>
^done
(gdb)
<ptype TObject>
&"ptype TObject\n"
~"type = TOBJECT = class \n"
~" public\n"
~" constructor CREATE (TOBJECT, POINTER) : TOBJECT;\n" ~" destructor ~DESTROY (TOBJECT, POINTER); virtual;\n" ~" function NEWINSTANCE (unnamedtype) : TOBJECT; virtual;\n" ~" procedure FREEINSTANCE (TOBJECT); virtual;\n" ~" function SAFECALLEXCEPTION (TOBJECT, TOBJECT, POINTER) : HRESULT; virtual;\n"
~" procedure DEFAULTHANDLER (TOBJECT, var); virtual;\n" ~" procedure FREE (TOBJECT);\n"
~" function INITINSTANCE (unnamedtype, POINTER) : TOBJECT;\n" ~" procedure CLEANUPINSTANCE (TOBJECT);\n"
~" function CLASSTYPE (unnamedtype) : TCLASS;\n" ~" function CLASSINFO (unnamedtype) : POINTER;\n" ~" function CLASSNAME (unnamedtype, SHORTSTRING) : SHORTSTRING;\n" ~" function CLASSNAMEIS (unnamedtype, SHORTSTRING) : BOOLEAN;\n" ~" function CLASSPARENT (unnamedtype) : TCLASS;\n" ~" function INSTANCESIZE (unnamedtype) : LONGINT;\n" ~" function INHERITSFROM (unnamedtype, TCLASS) : BOOLEAN;\n" ~" function STRINGMESSAGETABLE (unnamedtype) : PSTRINGMESSAGETABLE;\n" ~" function METHODADDRESS (unnamedtype, SHORTSTRING) : POINTER;\n" ~" function METHODNAME (unnamedtype, POINTER, SHORTSTRING) : SHORTSTRING;\n" ~" function FIELDADDRESS (TOBJECT, SHORTSTRING) : POINTER;\n" ~" procedure AFTERCONSTRUCTION (TOBJECT); virtual;\n" ~" procedure BEFOREDESTRUCTION (TOBJECT); virtual;\n" ~" procedure DEFAULTHANDLERSTR (TOBJECT, var); virtual;\n" ~" procedure DISPATCH (TOBJECT, var); virtual;\n" ~" procedure DISPATCHSTR (TOBJECT, var); virtual;\n" ~" function GETINTERFACE (TOBJECT, TGUID, out) : BOOLEAN;\n" ~" function GETINTERFACEBYSTR (TOBJECT, SHORTSTRING, out) : BOOLEAN;\n" ~" function GETINTERFACEWEAK (TOBJECT, TGUID, out) : BOOLEAN;\n" ~" function GETINTERFACEENTRY (unnamedtype, TGUID) : PINTERFACEENTRY;\n" ~" function GETINTERFACEENTRYBYSTR (unnamedtype, SHORTSTRING) : PINTERFACEENTRY;\n"
~" function GETINTERFACETABLE (unnamedtype) : PINTERFACETABLE;\n" ~" function UNITNAME (unnamedtype, ANSISTRING) : ANSISTRING;\n" ~" function EQUALS (TOBJECT, TOBJECT) : BOOLEAN; virtual;\n" ~" function GETHASHCODE (TOBJECT) : LONGINT; virtual;\n" ~" function TOSTRING (TOBJECT, ANSISTRING) : ANSISTRING; virtual;\n" ~"end\n"
^done
(gdb)
<ptype Exception>
&"ptype Exception\n"
~"type = EXCEPTION = class : public TOBJECT \n"
~" private\n"
~" FMESSAGE : ANSISTRING;\n"
~" FHELPCONTEXT : LONGINT;\n"
~"\n"
~" public\n"
~" constructor CREATE (EXCEPTION, POINTER, ANSISTRING) : ^EXCEPTION;\n" ~" constructor CREATEFMT (EXCEPTION, POINTER, ANSISTRING, unnamedtype, LONGINT) : ^EXCEPTION;\n"
~" constructor CREATERES (EXCEPTION, POINTER, PSTRING) : ^EXCEPTION;\n" ~" constructor CREATERESFMT (EXCEPTION, POINTER, PSTRING, unnamedtype, LONGINT) : ^EXCEPTION;\n"
~" constructor CREATEHELP (EXCEPTION, POINTER, ANSISTRING, LONGINT) : ^EXCEPTION;\n"
~" constructor CREATEFMTHELP (EXCEPTION, POINTER, ANSISTRING, unnamedtype, LONGINT, LONGINT) : ^EXCEPTION;\n"
~" constructor CREATERESHELP (EXCEPTION, POINTER, PSTRING, LONGINT) : ^EXCEPTION;\n"
~" constructor CREATERESFMTHELP (EXCEPTION, POINTER, PSTRING, unnamedtype, LONGINT, LONGINT) : ^EXCEPTION;\n"
~"end\n"
^done
(gdb)
<ptype Shortstring>
&"ptype Shortstring\n"
~"type = SHORTSTRING = record \n"
~" length : BYTE;\n"
~" st : array [1..255] of CHAR;\n"
~"end\n"
^done
(gdb)
<ptype pointer>
&"ptype pointer\n"
~"type = ^POINTER\n"
^done
(gdb)
<ptype byte>
&"ptype byte\n"
~"type = BYTE\n"
^done
(gdb)
<info file>
&"info file\n"
~"Symbols from \"w:\\md\\dev\\freepascal\\lib\\gh\\bin\\dbtest.exe\".\n" ~"Local exec file:\n"
~"\t`w:\\md\\dev\\freepascal\\lib\\gh\\bin\\dbtest.exe', file type pei-i386.\n" ~"\tEntry point: 0x471e50\n"
~"\t0x00401000 - 0x00471e90 is .text\n"
~"\t0x00472000 - 0x0048abec is .data\n"
~"\t0x0048b000 - 0x0048fb94 is .bss\n"
~"\t0x00491000 - 0x00491b34 is .idata\n"
^done
(gdb)
<-data-evaluate-expression sizeof(POINTER)>
^done,value="4"
(gdb)
<-break-insert +0>
^done,bkpt={number="12",type="breakpoint",disp="keep",enabled="y",addr="0x004016d8",func="EXECSELECT",file="dbtest.pas",fullname="w:\\md\\dev\\freepascal\\lib\\gh\\examples\\db\\mssql\\dbtest.pas",line="28",times="0",original-location="dbtest.pas:28"} (gdb)
<-break-insert main>
^done,bkpt={number="13",type="breakpoint",disp="keep",enabled="y",addr="0x004017d1",func="main",file="dbtest.pas",fullname="w:\\md\\dev\\freepascal\\lib\\gh\\examples\\db\\mssql\\dbtest.pas",line="37",times="0",original-location="main"} (gdb)
<-break-insert *4660816>
^done,bkpt={number="14",type="breakpoint",disp="keep",enabled="y",addr="0x00471e50",func="_FPC_MAINCRTSTARTUP",file="sysinitpas.pp",fullname="w:\\md\\dev\\freepascal\\compiler\\2.6.1\\rtl\\win32\\sysinitpas.pp",line="30",times="0",original-location="*4660816"} (gdb)
<-exec-run>
=thread-group-started,id="i1",pid="4220"
=thread-created,id="1",group-id="i1"
~"[New Thread 4220.0xe88]\n"
^running
*running,thread-id="all"
(gdb)
=library-loaded,id="C:\\WINDOWS\\system32\\ntdll.dll",target-name="C:\\WINDOWS\\system32\\ntdll.dll",host-name="C:\\WINDOWS\\system32\\ntdll.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\kernel32.dll",target-name="C:\\WINDOWS\\system32\\kernel32.dll",host-name="C:\\WINDOWS\\system32\\kernel32.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\oleaut32.dll",target-name="C:\\WINDOWS\\system32\\oleaut32.dll",host-name="C:\\WINDOWS\\system32\\oleaut32.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\advapi32.dll",target-name="C:\\WINDOWS\\system32\\advapi32.dll",host-name="C:\\WINDOWS\\system32\\advapi32.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\rpcrt4.dll",target-name="C:\\WINDOWS\\system32\\rpcrt4.dll",host-name="C:\\WINDOWS\\system32\\rpcrt4.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\secur32.dll",target-name="C:\\WINDOWS\\system32\\secur32.dll",host-name="C:\\WINDOWS\\system32\\secur32.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\gdi32.dll",target-name="C:\\WINDOWS\\system32\\gdi32.dll",host-name="C:\\WINDOWS\\system32\\gdi32.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\user32.dll",target-name="C:\\WINDOWS\\system32\\user32.dll",host-name="C:\\WINDOWS\\system32\\user32.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\msvcrt.dll",target-name="C:\\WINDOWS\\system32\\msvcrt.dll",host-name="C:\\WINDOWS\\system32\\msvcrt.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\ole32.dll",target-name="C:\\WINDOWS\\system32\\ole32.dll",host-name="C:\\WINDOWS\\system32\\ole32.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\imm32.dll",target-name="C:\\WINDOWS\\system32\\imm32.dll",host-name="C:\\WINDOWS\\system32\\imm32.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\lpk.dll",target-name="C:\\WINDOWS\\system32\\lpk.dll",host-name="C:\\WINDOWS\\system32\\lpk.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\usp10.dll",target-name="C:\\WINDOWS\\system32\\usp10.dll",host-name="C:\\WINDOWS\\system32\\usp10.dll",symbols-loaded="0",thread-group="i1" *stopped,reason="breakpoint-hit",disp="keep",bkptno="14",frame={addr="0x00471e50",func="_FPC_MAINCRTSTARTUP",args=[],file="sysinitpas.pp",fullname="w:\\md\\dev\\freepascal\\compiler\\2.6.1\\rtl\\win32\\sysinitpas.pp",line="30"},thread-id="1",stopped-threads="all" (gdb)
<-break-delete 13>
^done
(gdb)
<-break-delete 14>
^done
(gdb)
<-break-delete 12>
^done
(gdb)
<info program>
&"info program\n"
~"\tUsing the running image of child Thread 4220.0xe88.\n" ~"Program stopped at 0x471e50.\n"
~"It stopped at a breakpoint that has since been deleted.\n" ~"Type \"info stack\" or \"info registers\" for more information.\n" ^done
(gdb)
<info address FPC_RAISEEXCEPTION>
&"info address FPC_RAISEEXCEPTION\n"
~"Symbol \"FPC_RAISEEXCEPTION\" is at 0x40b070 in a file compiled without debugging.\n"
^done
(gdb)
<-break-insert *4239472>
^done,bkpt={number="15",type="breakpoint",disp="keep",enabled="y",addr="0x0040b070",func="fpc_raiseexception",file="W:/md/dev/freepascal/compiler/2.6.1/rtl/inc/except.inc",fullname="w:\\md\\dev\\freepascal\\compiler\\2.6.1\\rtl\\inc\\except.inc",line="191",times="0",original-location="*4239472"} (gdb)
<info address FPC_BREAK_ERROR>
&"info address FPC_BREAK_ERROR\n"
~"Symbol \"FPC_BREAK_ERROR\" is at 0x40cef0 in a file compiled without debugging.\n"
^done
(gdb)
<-break-insert *4247280>
^done,bkpt={number="16",type="breakpoint",disp="keep",enabled="y",addr="0x0040cef0",func="HANDLEERRORADDRFRAME",file="W:/md/dev/freepascal/compiler/2.6.1/rtl/inc/system.inc",fullname="w:\\md\\dev\\freepascal\\compiler\\2.6.1\\rtl\\inc\\system.inc",line="962",times="0",original-location="*4247280"} (gdb)
<info address FPC_RUNERROR>
&"info address FPC_RUNERROR\n"
~"Symbol \"FPC_RUNERROR\" is at 0x40cfe0 in a file compiled without debugging.\n"
^done
(gdb)
<-break-insert *4247520>
^done,bkpt={number="17",type="breakpoint",disp="keep",enabled="y",addr="0x0040cfe0",func="RUNERROR",file="W:/md/dev/freepascal/compiler/2.6.1/rtl/inc/system.inc",fullname="w:\\md\\dev\\freepascal\\compiler\\2.6.1\\rtl\\inc\\system.inc",line="1007",times="0",original-location="*4247520"} (gdb)
<-symbol-list-lines W:\md\dev\freepascal\lib\gh\examples\db\mssql\dbtest.pas> ^done,lines=[{pc="0x00401640",line="21"},{pc="0x0040164c",line="21"},{pc="0x00401678",line="22"},{pc="0x0040167f",line="23"},{pc="0x0040169d",line="24"},{pc="0x004016bb",line="25"},{pc="0x004016d0",line="26"},{pc="0x004016d8",line="28"},{pc="0x0040174b",line="29"},{pc="0x00401769",line="32"},{pc="0x00401785",line="34"},{pc="0x004017ad",line="34"},{pc="0x004017c0",line="36"},{pc="0x004017d1",line="37"},{pc="0x004017e8",line="38"},{pc="0x004017ff",line="39"},{pc="0x0040181d",line="41"},{pc="0x0040182c",line="45"},{pc="0x00401842",line="46"},{pc="0x00401858",line="47"},{pc="0x0040186e",line="48"},{pc="0x00401884",line="49"},{pc="0x0040188e",line="50"},{pc="0x004018b7",line="53"},{pc="0x004018c1",line="54"},{pc="0x004018c9",line="58"},{pc="0x004018df",line="59"},{pc="0x004018ef",line="60"},{pc="0x00401918",line="63"},{pc="0x00401922",line="64"},{pc="0x00401940",line="65"},{pc="0x00401960",line="66"},{pc="0x00401980",line="67"},{pc="0x004019a0",line="68"},{pc="0x004019c0",line="69"},{pc="0x004019d0",line="71"},{pc="0x004019f9",line="72"},{pc="0x004019fe",line="75"},{pc="0x00401a08",line="76"},{pc="0x00401a26",line="77"},{pc="0x00401a46",line="78"},{pc="0x00401a66",line="79"},{pc="0x00401a76",line="81"},{pc="0x00401a9f",line="82"},{pc="0x00401aa4",line="84"},{pc="0x00401ab4",line="86"},{pc="0x00401ad0",line="87"},{pc="0x00401aee",line="88"},{pc="0x00401b0e",line="89"},{pc="0x00401b2e",line="90"},{pc="0x00401b4e",line="91"},{pc="0x00401b6e",line="92"},{pc="0x00401b7d",line="94"},{pc="0x00401b96",line="97"},{pc="0x00401bbf",line="98"},{pc="0x00401bc4",line="113"},{pc="0x00401bce",line="114"},{pc="0x00401bec",line="115"},{pc="0x00401bfc",line="116"},{pc="0x00401c2a",line="118"},{pc="0x00401c34",line="119"},{pc="0x00401c4d",line="121"}] (gdb)
<info line "W:\md\dev\freepascal\lib\gh\examples\db\mssql\dbtest.pas":119> &"info line \"W:\\md\\dev\\freepascal\\lib\\gh\\examples\\db\\mssql\\dbtest.pas\":119\n" ~"Line 119 of \"dbtest.pas\" starts at address 0x401c34 <main+1140> and ends at 0x401c4d <main+1165>.\n"
^done
(gdb)
<-break-insert -f dbtest.pas:119>
^done,bkpt={number="18",type="breakpoint",disp="keep",enabled="y",addr="0x00401c34",func="main",file="dbtest.pas",fullname="w:\\md\\dev\\freepascal\\lib\\gh\\examples\\db\\mssql\\dbtest.pas",line="119",times="0",original-location="dbtest.pas:119"} (gdb)
<-break-enable 18>
^done
(gdb)
<-exec-continue>
^running
*running,thread-id="all"
(gdb)
=library-loaded,id="w:\\md\\dev\\freepascal\\lib\\gh\\bin\\dblib.dll",target-name="w:\\md\\dev\\freepascal\\lib\\gh\\bin\\dblib.dll",host-name="w:\\md\\dev\\freepascal\\lib\\gh\\bin\\dblib.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="w:\\md\\dev\\freepascal\\lib\\gh\\bin\\libiconv2.dll",target-name="w:\\md\\dev\\freepascal\\lib\\gh\\bin\\libiconv2.dll",host-name="w:\\md\\dev\\freepascal\\lib\\gh\\bin\\libiconv2.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\shell32.dll",target-name="C:\\WINDOWS\\system32\\shell32.dll",host-name="C:\\WINDOWS\\system32\\shell32.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\shlwapi.dll",target-name="C:\\WINDOWS\\system32\\shlwapi.dll",host-name="C:\\WINDOWS\\system32\\shlwapi.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\WinSxS\\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.3053_x-ww_b80fa8ca\\msvcr80.dll",target-name="C:\\WINDOWS\\WinSxS\\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.3053_x-ww_b80fa8ca\\msvcr80.dll",host-name="C:\\WINDOWS\\WinSxS\\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.3053_x-ww_b80fa8ca\\msvcr80.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\ws2_32.dll",target-name="C:\\WINDOWS\\system32\\ws2_32.dll",host-name="C:\\WINDOWS\\system32\\ws2_32.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\ws2help.dll",target-name="C:\\WINDOWS\\system32\\ws2help.dll",host-name="C:\\WINDOWS\\system32\\ws2help.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\WinSxS\\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\\comctl32.dll",target-name="C:\\WINDOWS\\WinSxS\\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\\comctl32.dll",host-name="C:\\WINDOWS\\WinSxS\\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\\comctl32.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\comctl32.dll",target-name="C:\\WINDOWS\\system32\\comctl32.dll",host-name="C:\\WINDOWS\\system32\\comctl32.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\System32\\mswsock.dll",target-name="C:\\WINDOWS\\System32\\mswsock.dll",host-name="C:\\WINDOWS\\System32\\mswsock.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\dnsapi.dll",target-name="C:\\WINDOWS\\system32\\dnsapi.dll",host-name="C:\\WINDOWS\\system32\\dnsapi.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\iphlpapi.dll",target-name="C:\\WINDOWS\\system32\\iphlpapi.dll",host-name="C:\\WINDOWS\\system32\\iphlpapi.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\mprapi.dll",target-name="C:\\WINDOWS\\system32\\mprapi.dll",host-name="C:\\WINDOWS\\system32\\mprapi.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\activeds.dll",target-name="C:\\WINDOWS\\system32\\activeds.dll",host-name="C:\\WINDOWS\\system32\\activeds.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\adsldpc.dll",target-name="C:\\WINDOWS\\system32\\adsldpc.dll",host-name="C:\\WINDOWS\\system32\\adsldpc.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\netapi32.dll",target-name="C:\\WINDOWS\\system32\\netapi32.dll",host-name="C:\\WINDOWS\\system32\\netapi32.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\wldap32.dll",target-name="C:\\WINDOWS\\system32\\wldap32.dll",host-name="C:\\WINDOWS\\system32\\wldap32.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\atl.dll",target-name="C:\\WINDOWS\\system32\\atl.dll",host-name="C:\\WINDOWS\\system32\\atl.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\rtutils.dll",target-name="C:\\WINDOWS\\system32\\rtutils.dll",host-name="C:\\WINDOWS\\system32\\rtutils.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\samlib.dll",target-name="C:\\WINDOWS\\system32\\samlib.dll",host-name="C:\\WINDOWS\\system32\\samlib.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\setupapi.dll",target-name="C:\\WINDOWS\\system32\\setupapi.dll",host-name="C:\\WINDOWS\\system32\\setupapi.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\System32\\winrnr.dll",target-name="C:\\WINDOWS\\System32\\winrnr.dll",host-name="C:\\WINDOWS\\System32\\winrnr.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\msctf.dll",target-name="C:\\WINDOWS\\system32\\msctf.dll",host-name="C:\\WINDOWS\\system32\\msctf.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\rasadhlp.dll",target-name="C:\\WINDOWS\\system32\\rasadhlp.dll",host-name="C:\\WINDOWS\\system32\\rasadhlp.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\system32\\hnetcfg.dll",target-name="C:\\WINDOWS\\system32\\hnetcfg.dll",host-name="C:\\WINDOWS\\system32\\hnetcfg.dll",symbols-loaded="0",thread-group="i1" =library-loaded,id="C:\\WINDOWS\\System32\\wshtcpip.dll",target-name="C:\\WINDOWS\\System32\\wshtcpip.dll",host-name="C:\\WINDOWS\\System32\\wshtcpip.dll",symbols-loaded="0",thread-group="i1" =thread-created,id="2",group-id="i1"
~"[New Thread 4220.0x155c]\n"
*running,thread-id="all"
*stopped,reason="breakpoint-hit",disp="keep",bkptno="18",frame={addr="0x00401c34",func="main",args=[],file="dbtest.pas",fullname="w:\\md\\dev\\freepascal\\lib\\gh\\examples\\db\\mssql\\dbtest.pas",line="119"},thread-id="1",stopped-threads="all" (gdb)
<-stack-info-depth>
^done,depth="1"
(gdb)
<-stack-list-arguments 1 0 0>
^done,stack-args=[frame={level="0",args=[]}]
(gdb)
<-stack-list-frames 0 0>
^done,stack=[frame={level="0",addr="0x00401c34",func="main",file="dbtest.pas",fullname="w:\\md\\dev\\freepascal\\lib\\gh\\examples\\db\\mssql\\dbtest.pas",line="119"}] (gdb)
<-thread-info>
^done,threads=[{id="2",target-id="Thread
4220.0x155c",frame={level="0",addr="0x7c90e514",func="ntdll!LdrAccessResource",args=[],from="C:\\WINDOWS\\system32\\ntdll.dll"},state="stopped"},{id="1",target-id="Thread 4220.0xe88",frame={level="0",addr="0x00401c34",func="main",args=[],file="dbtest.pas",fullname="w:\\md\\dev\\freepascal\\lib\\gh\\examples\\db\\mssql\\dbtest.pas",line="119"},state="stopped"}],current-thread-id="1" (gdb)
<-stack-list-arguments 1 0 0>
^done,stack-args=[frame={level="0",args=[]}]
(gdb)
<-stack-list-locals 1>
^done,locals=[]
(gdb)
<-data-evaluate-expression $fp>
^done,value="0x16eff94"
(gdb)
<-exec-next>
^running
*running,thread-id="1"
(gdb)
*running,thread-id="all"
=library-unloaded,id="w:\\md\\dev\\freepascal\\lib\\gh\\bin\\dblib.dll",target-name="w:\\md\\dev\\freepascal\\lib\\gh\\bin\\dblib.dll",host-name="w:\\md\\dev\\freepascal\\lib\\gh\\bin\\dblib.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\WinSxS\\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.3053_x-ww_b80fa8ca\\msvcr80.dll",target-name="C:\\WINDOWS\\WinSxS\\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.3053_x-ww_b80fa8ca\\msvcr80.dll",host-name="C:\\WINDOWS\\WinSxS\\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.3053_x-ww_b80fa8ca\\msvcr80.dll",thread-group="i1" =library-unloaded,id="w:\\md\\dev\\freepascal\\lib\\gh\\bin\\libiconv2.dll",target-name="w:\\md\\dev\\freepascal\\lib\\gh\\bin\\libiconv2.dll",host-name="w:\\md\\dev\\freepascal\\lib\\gh\\bin\\libiconv2.dll",thread-group="i1" ~"Cannot remove breakpoints because program is no longer writable.\nFurther execution is probably impossible.\n" *stopped,reason="end-stepping-range",frame={addr="0x00401c4d",func="main",args=[],file="dbtest.pas",fullname="w:\\md\\dev\\freepascal\\lib\\gh\\examples\\db\\mssql\\dbtest.pas",line="121"},thread-id="1",stopped-threads="all" ~"warning: Error removing breakpoint -108\n"
(gdb)
<-stack-info-depth>
^done,depth="1"
(gdb)
<-stack-list-arguments 1 0 0>
^done,stack-args=[frame={level="0",args=[]}]
(gdb)
<-stack-list-frames 0 0>
^done,stack=[frame={level="0",addr="0x00401c4d",func="main",file="dbtest.pas",fullname="w:\\md\\dev\\freepascal\\lib\\gh\\examples\\db\\mssql\\dbtest.pas",line="121"}] (gdb)
<-thread-info>
^done,threads=[{id="2",target-id="Thread
4220.0x155c",frame={level="0",addr="0x7c90e514",func="ntdll!LdrAccessResource",args=[],from="C:\\WINDOWS\\system32\\ntdll.dll"},state="stopped"},{id="1",target-id="Thread 4220.0xe88",frame={level="0",addr="0x00401c4d",func="main",args=[],file="dbtest.pas",fullname="w:\\md\\dev\\freepascal\\lib\\gh\\examples\\db\\mssql\\dbtest.pas",line="121"},state="stopped"}],current-thread-id="1" (gdb)
<-stack-list-arguments 1 0 0>
^done,stack-args=[frame={level="0",args=[]}]
(gdb)
<-stack-list-locals 1>
^done,locals=[]
(gdb)
<-data-evaluate-expression $fp>
^done,value="0x16eff94"
(gdb)
<-exec-next>
^error,msg="Warning:\nCannot insert breakpoint -110.\nError accessing memory address 0x7816cd30: Input/output error.\n"
(gdb)
<-break-delete 18>
^done
(gdb)
<kill>
&"kill\n"
=thread-exited,id="2",group-id="i1"
=thread-exited,id="1",group-id="i1"
=thread-group-exited,id="i1"
^done
(gdb)
<info program>
&"info program\n"
~"The program being debugged is not being run.\n"
^done
(gdb)
<-break-delete 15>
^done
(gdb)
<-break-delete 16>
^done
(gdb)
<-break-delete 17>
^done
(gdb)
<-file-exec-and-symbols >
=library-unloaded,id="C:\\WINDOWS\\system32\\ntdll.dll",target-name="C:\\WINDOWS\\system32\\ntdll.dll",host-name="C:\\WINDOWS\\system32\\ntdll.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\kernel32.dll",target-name="C:\\WINDOWS\\system32\\kernel32.dll",host-name="C:\\WINDOWS\\system32\\kernel32.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\oleaut32.dll",target-name="C:\\WINDOWS\\system32\\oleaut32.dll",host-name="C:\\WINDOWS\\system32\\oleaut32.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\advapi32.dll",target-name="C:\\WINDOWS\\system32\\advapi32.dll",host-name="C:\\WINDOWS\\system32\\advapi32.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\rpcrt4.dll",target-name="C:\\WINDOWS\\system32\\rpcrt4.dll",host-name="C:\\WINDOWS\\system32\\rpcrt4.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\secur32.dll",target-name="C:\\WINDOWS\\system32\\secur32.dll",host-name="C:\\WINDOWS\\system32\\secur32.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\gdi32.dll",target-name="C:\\WINDOWS\\system32\\gdi32.dll",host-name="C:\\WINDOWS\\system32\\gdi32.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\user32.dll",target-name="C:\\WINDOWS\\system32\\user32.dll",host-name="C:\\WINDOWS\\system32\\user32.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\msvcrt.dll",target-name="C:\\WINDOWS\\system32\\msvcrt.dll",host-name="C:\\WINDOWS\\system32\\msvcrt.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\ole32.dll",target-name="C:\\WINDOWS\\system32\\ole32.dll",host-name="C:\\WINDOWS\\system32\\ole32.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\imm32.dll",target-name="C:\\WINDOWS\\system32\\imm32.dll",host-name="C:\\WINDOWS\\system32\\imm32.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\lpk.dll",target-name="C:\\WINDOWS\\system32\\lpk.dll",host-name="C:\\WINDOWS\\system32\\lpk.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\usp10.dll",target-name="C:\\WINDOWS\\system32\\usp10.dll",host-name="C:\\WINDOWS\\system32\\usp10.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\shell32.dll",target-name="C:\\WINDOWS\\system32\\shell32.dll",host-name="C:\\WINDOWS\\system32\\shell32.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\shlwapi.dll",target-name="C:\\WINDOWS\\system32\\shlwapi.dll",host-name="C:\\WINDOWS\\system32\\shlwapi.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\ws2_32.dll",target-name="C:\\WINDOWS\\system32\\ws2_32.dll",host-name="C:\\WINDOWS\\system32\\ws2_32.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\ws2help.dll",target-name="C:\\WINDOWS\\system32\\ws2help.dll",host-name="C:\\WINDOWS\\system32\\ws2help.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\WinSxS\\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\\comctl32.dll",target-name="C:\\WINDOWS\\WinSxS\\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\\comctl32.dll",host-name="C:\\WINDOWS\\WinSxS\\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\\comctl32.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\comctl32.dll",target-name="C:\\WINDOWS\\system32\\comctl32.dll",host-name="C:\\WINDOWS\\system32\\comctl32.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\System32\\mswsock.dll",target-name="C:\\WINDOWS\\System32\\mswsock.dll",host-name="C:\\WINDOWS\\System32\\mswsock.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\dnsapi.dll",target-name="C:\\WINDOWS\\system32\\dnsapi.dll",host-name="C:\\WINDOWS\\system32\\dnsapi.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\iphlpapi.dll",target-name="C:\\WINDOWS\\system32\\iphlpapi.dll",host-name="C:\\WINDOWS\\system32\\iphlpapi.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\mprapi.dll",target-name="C:\\WINDOWS\\system32\\mprapi.dll",host-name="C:\\WINDOWS\\system32\\mprapi.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\activeds.dll",target-name="C:\\WINDOWS\\system32\\activeds.dll",host-name="C:\\WINDOWS\\system32\\activeds.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\adsldpc.dll",target-name="C:\\WINDOWS\\system32\\adsldpc.dll",host-name="C:\\WINDOWS\\system32\\adsldpc.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\netapi32.dll",target-name="C:\\WINDOWS\\system32\\netapi32.dll",host-name="C:\\WINDOWS\\system32\\netapi32.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\wldap32.dll",target-name="C:\\WINDOWS\\system32\\wldap32.dll",host-name="C:\\WINDOWS\\system32\\wldap32.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\atl.dll",target-name="C:\\WINDOWS\\system32\\atl.dll",host-name="C:\\WINDOWS\\system32\\atl.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\rtutils.dll",target-name="C:\\WINDOWS\\system32\\rtutils.dll",host-name="C:\\WINDOWS\\system32\\rtutils.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\samlib.dll",target-name="C:\\WINDOWS\\system32\\samlib.dll",host-name="C:\\WINDOWS\\system32\\samlib.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\setupapi.dll",target-name="C:\\WINDOWS\\system32\\setupapi.dll",host-name="C:\\WINDOWS\\system32\\setupapi.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\System32\\winrnr.dll",target-name="C:\\WINDOWS\\System32\\winrnr.dll",host-name="C:\\WINDOWS\\System32\\winrnr.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\msctf.dll",target-name="C:\\WINDOWS\\system32\\msctf.dll",host-name="C:\\WINDOWS\\system32\\msctf.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\rasadhlp.dll",target-name="C:\\WINDOWS\\system32\\rasadhlp.dll",host-name="C:\\WINDOWS\\system32\\rasadhlp.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\system32\\hnetcfg.dll",target-name="C:\\WINDOWS\\system32\\hnetcfg.dll",host-name="C:\\WINDOWS\\system32\\hnetcfg.dll",thread-group="i1" =library-unloaded,id="C:\\WINDOWS\\System32\\wshtcpip.dll",target-name="C:\\WINDOWS\\System32\\wshtcpip.dll",host-name="C:\\WINDOWS\\System32\\wshtcpip.dll",thread-group="i1" ^done
(gdb)
====================================================

Marcos Douglas

Reply by email

Martin
to Marcos Douglas
Marcos Douglas wrote 33 lines
On Tue, Mar 20, 2012 at 6:27 PM, Martin 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" >> > Does the issue happen the first time you press F8, or to you have to press a > 2nd time? When I press a first time... but I think some times in a 2nd time. =| > In other words: Is it possble the debugger pauses inside free (possible in a > dll) and that when you hit F8 then, it can not step, because the dll has no > debug info? Yes, I think is possible... > If in stopped in the DLL, it might still put the green arrow on your source > => first stack with frame debug info... > > Open and watch the stack window. > > --- > Also open the "debug output" window. Open this one before you start your > app. Then copy the content. The content was copied below. > --- > If indeed gdb stops inside a dll, then F8 simply can not work

Ok, I looked through it. Nott much of a result. Except there is no way to fix it, other to get the GDB developers to fix it in GDB.

Though you might want to try gdb 7.0.50 from mingw. It seems that 7.3 and 7.4 have some sort of regression in thread handling (on a different and rather rare issue) (Not sure where 7.1 stands). Or go for 7.4 (I can send it to you with the required libs)

So what happens seems:

* The first F8
- seems to execute (next stop is 2 lines below)
- but throws a warning:
~"warning: Error removing breakpoint -108\n"

In this step several libraries are unloaded. It appears that for an unknown reason (and something beyond my knowledge) GDB did set a temporary break in one of that dll

At that time there is also a 2nd thread involved (Lots of dll on window start threads).

{id="2",target-id="Thread 4220.0x155c",

frame={level="0",addr="0x7c90e514",func="ntdll!LdrAccessResource",args=[],from="C:\\WINDOWS\\system32\\ntdll.dll"},state="stopped"}, {id="1",target-id="Thread 4220.0xe88",

frame={level="0",addr="0x00401c34",func="main",args=[],file="dbtest.pas",fullname="w:\\.....\\dbtest.pas",line="119"},state="stopped"}]

I do not know where that temp breakpoint was meant to go, or which thread.

* Then the next F8 fails

<-exec-next>
^error,msg="Warning:\nCannot insert breakpoint -110.\nError accessing memory address 0x7816cd30: Input/output error.\n"
(gdb)

That address must be in some library. Most likely in one of those that were unloaded

Your main thread is in your code, not in a library.

------------------------------

- I do not know why GDB expects a possible end of the single step in a library
- I do not know why gdb (at least if I guess correct) tries to set a break in an unloaded lib.

Reply by email

Marcos Douglas
to Martin
Martin wrote 53 lines
On 21/03/2012 12:49, Marcos Douglas wrote: > > On Tue, Mar 20, 2012 at 6:27 PM, Martin  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" >>> >> Does the issue happen the first time you press F8, or to you have to >> press a >> 2nd time? > > When I press a first time... but I think some times in a 2nd time.  =| > >> In other words: Is it possble the debugger pauses inside free (possible >> in a >> dll) and that when you hit F8 then, it can not step, because the dll has >> no >> debug info? > > Yes, I think is possible... > >> If in stopped in the DLL, it might still put the green arrow on your >> source >> =>  first stack with frame debug info... >> >> Open and watch the stack window. >> >> --- >> Also open the "debug output" window. Open this one before you start your >> app. Then copy the content. > > The content was copied below. > >> --- >> If indeed gdb stops inside a dll, then F8 simply can not work Ok, I looked through it. Nott much of a result. Except there is no way to fix it, other to get the GDB developers to fix it in GDB. Though you might want to try gdb 7.0.50 from mingw. It seems that 7.3 and 7.4 have some sort of regression in thread handling (on a different and rather rare issue) (Not sure where 7.1 stands). Or go for 7.4 (I can send it to you with the required libs)

Can you send? I'll appreciate that, thanks.

Too my env:
Lazarus 0.9.31 r36175 FPC 2.6.1 i386-win32-win32/win64 FPC: http://svn.freepascal.org/svn/fpc/branches/fixes_2_6 GDB: http://svn.freepascal.org/svn/lazarus/binaries

Which GDB SVN do you think is the best choice?

Show quoted text 36 lines
So what happens seems: *  The first F8 - seems to execute (next stop is 2 lines below) - but throws a warning:  ~"warning: Error removing breakpoint -108\n" In this step several libraries are unloaded. It appears that for an unknown reason (and something beyond my knowledge) GDB did set a temporary break in one of that dll At that time there is also a 2nd thread involved (Lots of dll on window start threads). {id="2",target-id="Thread 4220.0x155c",  frame={level="0",addr="0x7c90e514",func="ntdll!LdrAccessResource",args=[],from="C:\\WINDOWS\\system32\\ntdll.dll"},state="stopped"}, {id="1",target-id="Thread 4220.0xe88",  frame={level="0",addr="0x00401c34",func="main",args=[],file="dbtest.pas",fullname="w:\\.....\\dbtest.pas",line="119"},state="stopped"}] I do not know where that temp breakpoint was meant to go, or which thread. * Then the next F8 fails <-exec-next> ^error,msg="Warning:\nCannot insert breakpoint -110.\nError accessing memory address 0x7816cd30: Input/output error.\n" (gdb) That address must be in some library. Most likely in one of those that were unloaded Your main thread is in your code, not in a library.

Well, I understood what you said, but I can't read the debug info like you... I didn't understand anything. =|

Show quoted text 6 lines
------------------------------ - I do not know why GDB expects a possible end of the single step in a library - I do not know why gdb (at least if I guess correct) tries to set a break in an unloaded lib.

Unfortunately, this is a work to GDB developers. =)

Thanks for all! I learned a lot.

Marcos Douglas

Reply by email

Martin
to Marcos Douglas
Marcos Douglas wrote
Which GDB SVN do you think is the best choice?

Not really sure. I have versions from 6.3 to 7.4. (for win 32). There is a testcase in the debugger/test/GDBMI directory

Most of the differences are handled by the IDE (like different text of error message)

Differences I do know:

- All versions over 7.0 have a problem with typecasting objects (stabs only) http://bugs.freepascal.org/view.php?id=19920
This is partly fixed by the IDE

- All 6.x and 7.3 / 7.4 versions (not sure about 7.1 / 7.2) have an issue with handling threads, in a rare race condition 7.0.50 does not have that issue

The issue occurs if a pause request (either hit "pause button" er modify/set/unset a breakpoint (which requires the ap to be paused and then continued)) is made, while the app is already paused. On Windows an app is paused via some windows function, opening a special thread in the app. (Not sure if the issue is triggered just by any thread, or by something else).

Normally the IDE will not send such a request to a paused app. But if the app has just hit a breakpoint, and the IDE had not yet read that notification from GDB, then it can happen....

- IIRC: Somewhere in 7.1 or 7.2 some essential suppor for using breakpoints when debugging a dll with starter app was added

- 7.4
Has some issue with "-break-insert +0"
The IDE only uses that as fallback (unless you change config), and can deal with this. So it does not currently cause any issues.

7.4 has new features, but the IDE does not support then yet... Otherwise, I haven't yet worked out where/if 7.4 differs significantly

Reply by email

Marcos Douglas
to Martin
Martin wrote 43 lines
On 21/03/2012 13:48, Marcos Douglas wrote: > > Which GDB SVN do you think is the best choice? Not really sure. I have versions from 6.3 to 7.4. (for win 32). There is a testcase in the debugger/test/GDBMI directory Most of the differences are handled by the IDE (like different text of error message) Differences I do know: - All versions over 7.0 have a problem with typecasting objects (stabs only)   http://bugs.freepascal.org/view.php?id=19920 This is partly fixed by the IDE - All 6.x and 7.3 / 7.4 versions (not sure about 7.1 / 7.2) have an issue with handling threads, in a rare race condition 7.0.50 does not have that issue The issue occurs if a pause request (either hit "pause button" er modify/set/unset a breakpoint (which requires the ap to be paused and then continued)) is made, while the app is already paused. On Windows an app is paused via some windows function, opening a special thread in the app. (Not sure if the issue is triggered just by any thread, or by something else). Normally the IDE will not send such a request to a paused app. But if the app has just hit a breakpoint, and the IDE had not yet read that notification from GDB, then it can happen.... - IIRC: Somewhere in 7.1 or 7.2 some essential suppor for using breakpoints when debugging a dll with starter app was added - 7.4 Has some issue with "-break-insert +0" The IDE only uses that as fallback (unless you change config), and can deal with this. So it does not currently cause any issues. 7.4 has new features, but the IDE does not support then yet... Otherwise, I haven't yet worked out where/if 7.4 differs significantly

Oh my... =)
There are many differences, many options to choice. Using a simple vision, I think the IDE should be use the last GDB that works fine in the major cases. What GDB version represents that?

The URL that I wrote gets the 7.3 version. That is the recommended by Lazarus Team?

Marcos Douglas

Reply by email

Martin
to Marcos Douglas

I cced to lazarus.

We should move the discussion

Marcos Douglas wrote 8 lines
Oh my... =) There are many differences, many options to choice. Using a simple vision, I think the IDE should be use the last GDB that works fine in the major cases. What GDB version represents that? The URL that I wrote gets the 7.3 version. That is the recommended by Lazarus Team?

At the moment, I think Lazarus ships 7.3.2

http://svn.freepascal.org/svn/lazarus/binaries

So far I have no plans to update to 7.4 until either:
- I find some existing problem solved in it
- I start supporting new features

However, my tests so far, have not shown any problems when using 7.4.

Reply by email