Sign in Join

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

Mailing lists / lazarus / 2018-05

How to debug DB errors.

9 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

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

Donald Ziesig

Hi Everyone,

I have been developing database apps for years and I have finally reached my limit.  Occasionally I get exceptions in the db code but the Call Stack is truncated as is shown below.  I usually just "bite the bullet" and single step through the code till I find the offending line.  This time, I got an exception after 8 hours of execution.  Is there any way that I can set this up so that I get a location in my own code?

The error message said there was a syntax error in the DBConnection object caused by the letter 's'????

#0 fpc_raiseexception at :0
#1 SQLITE3CONN$_$TSQLITE3CONNECTION_$__$$_CHECKERROR$LONGINT at :0 #2 SQLITE3CONN$_$TSQLITE3CURSOR_$__$$_CHECKERROR$LONGINT at :0 #3 ?? at :0
#4 SQLITE3CONN$_$TSQLITE3CURSOR_$__$$_PREPARE$ANSISTRING$TPARAMS at :0 #5 .Ld24 at :0
#6 ?? at :0

Thanks,

Don Ziesig

Reply by email

Joost van der Sluis
to Donald Ziesig

Op 30-05-18 om 16:24 schreef Donald Ziesig via Lazarus:

Show quoted text 7 lines
I have been developing database apps for years and I have finally reached my limit.  Occasionally I get exceptions in the db code but the Call Stack is truncated as is shown below.  I usually just "bite the bullet" and single step through the code till I find the offending line.  This time, I got an exception after 8 hours of execution.  Is there any way that I can set this up so that I get a location in my own code?

You could try to install the LazDebuggerFP package, and switch to the FPDebug debugger in your debugger-options. In a lot of cases it shows a more complete callstack.

And did you already tried to use the fcl-db package with debug-info? If you want to, go to a terminal, change to current directory to the fcl-db source (where the fpmake.pp file is). Then do:

fppkg install -o -gl

Then build your application in Lazarus, and you will have fcl-db with debug-info.

Regards,

Joost.

Reply by email

Martin Schreiber
to Donald Ziesig: I have been developing database apps for years and I have finally reached my limit. …
Donald Ziesig wrote 10 lines
Hi Everyone, I have been developing database apps for years and I have finally reached my limit.  Occasionally I get exceptions in the db code but the Call Stack is truncated as is shown below.  I usually just "bite the bullet" and single step through the code till I find the offending line.  This time, I got an exception after 8 hours of execution.  Is there any way that I can set this up so that I get a location in my own code?

Run the application in the IDE and activate the 'Stop on exception' option in IDE. I don't know how it is named in Lazarus, in MSEide it is 'Project'-'Options'-'Debugger'-'Stop on Excep.'.

Martin

Reply by email

Donald Ziesig
to Joost van der Sluis: Op 30-05-18 om 16:24 schreef Donald Ziesig via Lazarus: You could try to install the…
Joost van der Sluis wrote 28 lines
Op 30-05-18 om 16:24 schreef Donald Ziesig via Lazarus: > I have been developing database apps for years and I have finally > reached my limit.  Occasionally I get exceptions in the db code but > the Call Stack is truncated as is shown below.  I usually just "bite > the bullet" and single step through the code till I find the > offending line.  This time, I got an exception after 8 hours of > execution.  Is there any way that I can set this up so that I get a > location in my own code? You could try to install the LazDebuggerFP package, and switch to the FPDebug debugger in your debugger-options. In a lot of cases it shows a more complete callstack. And did you already tried to use the fcl-db package with debug-info? If you want to, go to a terminal, change to current directory to the fcl-db source (where the fpmake.pp file is). Then do: fppkg install -o -gl Then build your application in Lazarus, and you will have fcl-db with debug-info. Regards, Joost.

Hi Joost!

Thanks for the quick response.

I found the fpmake.pp file in /usr/share/fpcsrc/3.0.4/packages/fcl-db.  Using sudo -i, I ran:

fppkg install -o -gl

It responded "Error code 301", then "Compile successful".

I ran it again:

hp-laptop fcl-db # fppkg install -o -gl
Warning: Unexpected response status code: 301
The FPC Package tool encountered the following error: Found broken packages, run "fppkg fixbroken" first

hp-laptop fcl-db # fppkg fixbroken
Warning: Unexpected response status code: 301
Re-install packages which are dependent on just installed packages The FPC Package tool encountered the following error: Stream read error

All google searches for error 301 showed "Moved permanently" as the meaning.  Unfortunately, it doesn't show where it was looking when it got the 301 error.  Any suggestions?

Don

Reply by email

Joost van der Sluis
to Donald Ziesig

Op 30-05-18 om 17:38 schreef Donald Ziesig via Lazarus:

Show quoted text 23 lines
I found the fpmake.pp file in /usr/share/fpcsrc/3.0.4/packages/fcl-db. Using sudo -i, I ran: fppkg install -o -gl It responded "Error code 301", then "Compile successful". I ran it again: hp-laptop fcl-db # fppkg install -o -gl Warning: Unexpected response status code: 301 The FPC Package tool encountered the following error: Found broken packages, run "fppkg fixbroken" first hp-laptop fcl-db # fppkg fixbroken Warning: Unexpected response status code: 301 Re-install packages which are dependent on just installed packages The FPC Package tool encountered the following error: Stream read error All google searches for error 301 showed "Moved permanently" as the meaning.  Unfortunately, it doesn't show where it was looking when it got the 301 error.  Any suggestions?

The URL to the central repository has changed from 'http' to 'https', so that's why you see the redirect. But the main repository won't help you, it is almost empty.

But in your case you can just ignore all this. Fppkg tries to recompile all packages which are depending on fcl-db. But the only change is that you added debug-info. So the recompile is not necessary.

Try to build your project, and see what happens.

(There is another repository you could try, search for your fppg.cfg (run 'fppkg listsettings') and adapt the url to the central repository to: http://fpc.cnoc.nl/repo/testing/mirrors.xml.

If you still miss any packages, ask me to add them.)

Regards,

Joost.

Reply by email

Donald Ziesig
to Joost van der Sluis
Joost van der Sluis wrote 47 lines
Op 30-05-18 om 17:38 schreef Donald Ziesig via Lazarus: > I found the fpmake.pp file in > /usr/share/fpcsrc/3.0.4/packages/fcl-db. Using sudo -i, I ran: > > fppkg install -o -gl > > It responded "Error code 301", then "Compile successful". > > I ran it again: > > hp-laptop fcl-db # fppkg install -o -gl > Warning: Unexpected response status code: 301 > The FPC Package tool encountered the following error: > Found broken packages, run "fppkg fixbroken" first > > hp-laptop fcl-db # fppkg fixbroken > Warning: Unexpected response status code: 301 > Re-install packages which are dependent on just installed packages > The FPC Package tool encountered the following error: > Stream read error > > All google searches for error 301 showed "Moved permanently" as the > meaning.  Unfortunately, it doesn't show where it was looking when it > got the 301 error.  Any suggestions? The URL to the central repository has changed from 'http' to 'https', so that's why you see the redirect. But the main repository won't help you, it is almost empty. But in your case you can just ignore all this. Fppkg tries to recompile all packages which are depending on fcl-db. But the only change is that you added debug-info. So the recompile is not necessary. Try to build your project, and see what happens. (There is another repository you could try, search for your fppg.cfg (run 'fppkg listsettings') and adapt the url to the central repository to: http://fpc.cnoc.nl/repo/testing/mirrors.xml. If you still miss any packages, ask me to add them.) Regards, Joost.

Well, the IDE recompiles, but my app is having problems with my own libraries that use *sqldb*.  The error message says that the checksum has changed.  I tried recompiling all or the dependencies, but the error does not change.

I am now going to uninstall Lazarus and FPC and re-installing it from scratch.  Hopefully that will fix it.  If not, I'll let you know.

BTW, is there any log file that I might be missing that will get me closer to the problem?

Don

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180530/889b9f02/attachment-0001.html>

Reply by email

Martin Schreiber
to Donald Ziesig
Donald Ziesig wrote
I am now going to uninstall Lazarus and FPC and re-installing it from scratch. Hopefully that will fix it. If not, I'll let you know.

If the information in the stack window is insufficient in case of an exception stop *all* used units including the Free Pascal RTL, FCL and the LCL should be compiled with -gl -O-.

If you are on a 64 bit Windows FPC version and there still is no usable stack trace compiling with 32 bit FPC may work better.

Martin

Reply by email

Joost van der Sluis
to Donald Ziesig: Well, the IDE recompiles, but my app is having problems with my own libraries that use…

Op 30-05-18 om 18:44 schreef Donald Ziesig via Lazarus:

Show quoted text 24 lines
>> I found the fpmake.pp file in >> /usr/share/fpcsrc/3.0.4/packages/fcl-db. Using sudo -i, I ran: >> >> fppkg install -o -gl >> >> It responded "Error code 301", then "Compile successful". >> >> I ran it again: >> >> hp-laptop fcl-db # fppkg install -o -gl >> Warning: Unexpected response status code: 301 >> The FPC Package tool encountered the following error: >> Found broken packages, run "fppkg fixbroken" first > But in your case you can just ignore all this. Fppkg tries to > recompile all packages which are depending on fcl-db. But the only > change is that you added debug-info. So the recompile is not necessary. > > Try to build your project, and see what happens. Well, the IDE recompiles, but my app is having problems with my own libraries that use *sqldb*.  The error message says that the checksum has changed.  I tried recompiling all or the dependencies, but the error does not change.

The compiler will tell you which .ppu's it uses. And it can not find the proper sources to recompile the .ppu. Best is just to remove the .ppu the compiler complains about, and try again. That way you know which sources you are missing and add those (or their path, or compile them and place the .ppu's in the path)

I am now going to uninstall Lazarus and FPC and re-installing it from scratch.  Hopefully that will fix it.  If not, I'll let you know.

I doubt that this will help. If you want to get rid of all (local) fppkg changes, you can just remove the ~/.fppkg directory.

Same holds for Lazarus and ~/.lazarus

BTW, is there any log file that I might be missing that will get me closer to the problem?

The compiler log is you friend, I would say. (You could add the -va compiler option in Lazarus, but this will give you way too much information) Same holds for fppkg, add '-v' or '-d' and you will get more info.

Btw: Martin's suggestion to add -O- also is also a good suggestion. So:

fppkg -o -gl -o -O-

Regards,

Joost.

Reply by email