[Lazarus] How to debug DB errors.

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] How to debug DB errors.

Free Pascal - Lazarus mailing list
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


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to debug DB errors.

Free Pascal - Lazarus mailing list
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.



--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to debug DB errors.

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Wednesday 30 May 2018 16:24:30 Donald Ziesig via Lazarus wrote:

> 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
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to debug DB errors.

Free Pascal - Lazarus mailing list
On Wed, 30 May 2018 16:46:52 +0200
Martin Schreiber via Lazarus <[hidden email]> wrote:

>[...]
> Run the application in the IDE and activate the 'Stop on exception' option in
> IDE.

This is default.

Mattias


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to debug DB errors.

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On 05/30/2018 10:42 AM, Joost van der Sluis via Lazarus wrote:

> 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

--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to debug DB errors.

Free Pascal - Lazarus mailing list
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.
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to debug DB errors.

Free Pascal - Lazarus mailing list
On 05/30/2018 12:05 PM, Joost van der Sluis via Lazarus wrote:
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



--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to debug DB errors.

Free Pascal - Lazarus mailing list
On Wednesday 30 May 2018 18:44:12 Donald Ziesig via Lazarus 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
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How to debug DB errors.

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
Op 30-05-18 om 18:44 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

>> 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.
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus