Sign in Join

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

Mailing lists / fpc-pascal / 2003-07

FPC Debugging (with SQLite)

13 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

James Mills

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

Without the source and line numbers ? (I think perhaps the SQLite library is interferring with the debug symbols in the program? I'm not sure).

Any ideas ?

cheers
James

- - James Mills Zero Defect Software Engineers Group - ZDSEG

Reply by email

Pierre Muller
to James Mills: I found a solution to this problem by using a break point on the address in gdb (didn't…
James Mills wrote 18 lines
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.

Reply by email

James Mills
to James Mills: I have a problem with the SQLite library (www.sqlite.org). I believe Michael helped me…
James Mills wrote 14 lines
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).

However I would still like to know why the backtrace wasn't there to begin with... Normally it is :)

cheers
James

Show quoted text 18 lines
Without the source and line numbers ? (I think perhaps the SQLite library is interferring with the debug symbols in the program? I'm not sure). Any ideas ? cheers James -- - - James Mills Zero Defect Software Engineers Group - ZDSEG _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
- - James Mills Zero Defect Software Engineers Group - ZDSEG

Reply by email

Matt Emson
to James Mills: I have a problem with the SQLite library (www.sqlite.org). I believe Michael helped me…

Eric will have written that unit for BeOS, so I would ask if anyone tested it for other platforms.... Had a look on BeShare and he's not online, but that is certainly a question that needs to be addressed first.

Matt

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

Show quoted text 19 lines
Without the source and line numbers ? (I think perhaps the SQLite library is interferring with the debug symbols in the program? I'm not sure). Any ideas ? cheers James -- - - James Mills Zero Defect Software Engineers Group - ZDSEG _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

James Mills
to Matt Emson
Matt Emson wrote
Eric will have written that unit for BeOS, so I would ask if anyone tested it for other platforms.... Had a look on BeShare and he's not online, but that is certainly a question that needs to be addressed first.

I know he wrote it. I regularly speak to him on MSN. There was a problem with using it, for some reason he didn't need to use the cMem unit back when he wrote the unit. But he had used a very old version of sqlite at the time. I guess the SQLite library has changed dramatically since 2.7...

I have tested it on Linux, and the only modification to the unit necessary (I think) is that you have to use the cMem unit.

It works quite well and I'll continue to use this for my programs that require an embedded database vs. mysql server.

cheers
James

Show quoted text 43 lines
Matt > 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 > > Without the source and line numbers ? (I think perhaps the SQLite > library is interferring with the debug symbols in the program? I'm not > sure). > > Any ideas ? > > cheers > James > > -- > - > - James Mills > Zero Defect Software Engineers Group - ZDSEG > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
- - James Mills Zero Defect Software Engineers Group - ZDSEG

Reply by email

Matt Emson
to James Mills
Show quoted text 5 lines
I know he wrote it. I regularly speak to him on MSN. There was a problem with using it, for some reason he didn't need to use the cMem unit back when he wrote the unit. But he had used a very old version of sqlite at the time. I guess the SQLite library has changed dramatically since 2.7...

I think that was more to do with whoever ported SQLLite to BeOS rather than him actually wanting to use an older version ;-)

Matt

Reply by email

James Mills
to Matt Emson
Matt Emson wrote 8 lines
> I know he wrote it. I regularly speak to him on MSN. There was a problem > with using it, for some reason he didn't need to use the cMem unit back > when he wrote the unit. But he had used a very old version of sqlite at > the time. I guess the SQLite library has changed dramatically since > 2.7... I think that was more to do with whoever ported SQLLite to BeOS rather than him actually wanting to use an older version ;-)

How so ? It's been fixed there was no problem with his unit other than the fact that, with the current version of SQLite the cMem unit was needed in order because of the way SQLite uses memory.

cheers
James

Show quoted text 8 lines
Matt _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
- - James Mills Zero Defect Software Engineers Group - ZDSEG

Reply by email

Matt Emson
to James Mills
How so ?

James, he did *not* port this app to BeOS, some one else did. He wrote a Pascal interface to the version that that developer had ported to BeOS (you're following me right ;-). He therefore had no option but to use the version ported under BeOS, unless he ported a newer version himself, right? So therefore, he was only able to do the interface as per the version available to him. Therefore my comment. Do you understand? No trickery involved.

Looking at the BeBits page, (http://www.bebits.com/app/3156), 2.7.1 was the last port made (circa November 2002).

It's been fixed there was no problem with his unit other than the fact that, with the current version of SQLite the cMem unit was needed in order because of the way SQLite uses memory.

Cool. Let him know ;-)

Reply by email

Matt Emson
to James Mills: How so ? It's been fixed there was no problem with his unit other than the fact that,…

Actually, got it to compile and run under Delphi with only about 2 or 3 changes.

Change all ref's to 'strings' to 'sysutils', and there is an assignment to 'OnData' that must read:

OnData := SQLOnData;

rather than

OnData := @SQLOnData;

Other than that it compiles and runs.

One question, why is StrAlloc in Strings??? It should be in Sysutils for Delphi compatibility. I thought the main FPC thrust was now for Delphi compatibility over Turbo Pascal?!?!

Matt

Earlier message 46 lines
----- Original Message ----- From: "James Mills" To: Sent: Monday, July 07, 2003 12:49 PM Subject: Re: [fpc-pascal]FPC Debugging (with SQLite) > On Mon, Jul 07, 2003 at 12:29:10PM +0100, Matt Emson wrote: > > > I know he wrote it. I regularly speak to him on MSN. There was a problem > > > with using it, for some reason he didn't need to use the cMem unit back > > > when he wrote the unit. But he had used a very old version of sqlite at > > > the time. I guess the SQLite library has changed dramatically since > > > 2.7... > > > > I think that was more to do with whoever ported SQLLite to BeOS rather than > > him actually wanting to use an older version ;-) > > How so ? It's been fixed there was no problem with his unit other than > the fact that, with the current version of SQLite the cMem unit was > needed in order because of the way SQLite uses memory. > > cheers > James > > > > > Matt > > > > > > > > _______________________________________________ > > fpc-pascal maillist - > > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > -- > - > - James Mills > Zero Defect Software Engineers Group - ZDSEG > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal >

Reply by email

James Mills
to Matt Emson: James, he did *not* port this app to BeOS, some one else did. He wrote a Pascal interface…
Matt Emson wrote 13 lines
> How so ? James, he did *not* port this app to BeOS, some one else did. He wrote a Pascal interface to the version that that developer had ported to BeOS (you're following me right ;-). He therefore had no option but to use the version ported under BeOS, unless he ported a newer version himself, right? So therefore, he was only able to do the interface as per the version available to him. Therefore my comment. Do you understand? No trickery involved. Looking at the BeBits page, (http://www.bebits.com/app/3156), 2.7.1 was the last port made (circa November 2002).

Now I'm following you. Yes I'm aware that Eric did not actually develop this unit, one of his (people) did. His/Her/It's name is unknown to me. ;)

Show quoted text 6 lines
> It's been fixed there was no problem with his unit other than > the fact that, with the current version of SQLite the cMem unit was > needed in order because of the way SQLite uses memory. Cool. Let him know ;-)

It should be released in future versions of the FCL according to Michael of FPC :) I can send you a tar.gz of the header translation and the unit though...

cheers
James

Show quoted text 9 lines
_______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
- - James Mills Zero Defect Software Engineers Group - ZDSEG

Reply by email

James Mills
to Matt Emson: Actually, got it to compile and run under Delphi with only about 2 or 3 changes. Change…
Matt Emson wrote 17 lines
Actually, got it to compile and run under Delphi with only about 2 or 3 changes. Change all ref's to 'strings' to 'sysutils', and there is an assignment to 'OnData' that must read: OnData := SQLOnData; rather than OnData := @SQLOnData; Other than that it compiles and runs. One question, why is StrAlloc in Strings??? It should be in Sysutils for Delphi compatibility. I thought the main FPC thrust was now for Delphi compatibility over Turbo Pascal?!?!

Good question. However I don't really care about Delphi compatibility, as as such I think the FPC developers put it in Strings for a very logical reason. Afterall it is a String function call.

cheers
James

Show quoted text 55 lines
Matt ----- Original Message ----- From: "James Mills" To: Sent: Monday, July 07, 2003 12:49 PM Subject: Re: [fpc-pascal]FPC Debugging (with SQLite) > On Mon, Jul 07, 2003 at 12:29:10PM +0100, Matt Emson wrote: > > > I know he wrote it. I regularly speak to him on MSN. There was a problem > > > with using it, for some reason he didn't need to use the cMem unit back > > > when he wrote the unit. But he had used a very old version of sqlite at > > > the time. I guess the SQLite library has changed dramatically since > > > 2.7... > > > > I think that was more to do with whoever ported SQLLite to BeOS rather than > > him actually wanting to use an older version ;-) > > How so ? It's been fixed there was no problem with his unit other than > the fact that, with the current version of SQLite the cMem unit was > needed in order because of the way SQLite uses memory. > > cheers > James > > > > > Matt > > > > > > > > _______________________________________________ > > fpc-pascal maillist - > > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > -- > - > - James Mills > Zero Defect Software Engineers Group - ZDSEG > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
- - James Mills Zero Defect Software Engineers Group - ZDSEG

Reply by email

Matt Emson
to James Mills: Now I'm following you. Yes I'm aware that Eric did not actually develop this unit, one of…
Show quoted text 5 lines
On Mon, Jul 07, 2003 at 03:26:41PM +0100, Matt Emson wrote: Now I'm following you. Yes I'm aware that Eric did not actually develop this unit, one of his (people) did. His/Her/It's name is unknown to me. ;)

Um... well, AFAIK Eric did write the PASCAL unit, but some other person ported the C code that makes up the SQLite library to BeOS. The two acts are quite seperate.

Anyway....

Strings.pas is legacy, from TurboPascal days, where as the modern 'SysUtils' is a unit that contains almost all of the utility functions that exist. I'd much rather use a single unit and let the compiler strip the unwanted symbols rather than have to include 5+ units to cover String, integer, variant etc functionality. Maybe that's just me though <g>

Matt

Reply by email

Olivier Coursière
to Matt Emson: James, he did *not* port this app to BeOS, some one else did. He wrote a Pascal interface…

Hi all !

Show quoted text 19 lines
> How so ? James, he did *not* port this app to BeOS, some one else did. He wrote a Pascal interface to the version that that developer had ported to BeOS (you're following me right ;-). He therefore had no option but to use the version ported under BeOS, unless he ported a newer version himself, right? So therefore, he was only able to do the interface as per the version available to him. Therefore my comment. Do you understand? No trickery involved. Looking at the BeBits page, (http://www.bebits.com/app/3156), 2.7.1 was the last port made (circa November 2002).

Under BeOS, the port is really easy : sqlite compile nearly out of the box from official sqlite sources. I have succesfully compiled sqlite 2.8.3 two or three weeks ago (during the last thread about sqlite in this list). Only one change was needed. I had only change sqliteOsSleep's implementation to use snooze instead of usleep, not available in Be's headers.

In fact, Eric's version is a quick port of TSQLIte component (available at http://www.torry.net/db_directsql.htm) from Delphi and Windows to FPC and BeOS (mainly removing Windows only functions and dynamic loading). That is why his unit works under Linux. Maybe Delphi users and FPC users under Windows should use TSQLite component directly.

Now, there is also a DBExpress driver available for Delphi users (and maybe kylix's one with some work ?).

Show quoted text 6 lines
> It's been fixed there was no problem with his unit other than > the fact that, with the current version of SQLite the cMem unit was > needed in order because of the way SQLite uses memory. Cool. Let him know ;-)

Under BeOS, this unit is not necessary as far as i know (but not well tested, only trivials samples). If someone have some code that show this problem (and the improved wrapper), i can test them under BeOS.

Bye

Olivier

Reply by email