Sign in Join

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

Mailing lists / lazarus / 2008-10

IDE exceptions: how to get stack trace on Windows?

6 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Alexander Klenin

When using Lazarus IDE, it sometimes fails with various exceptions. In order to debug, or at least identify the source of the problems I need additional info, such as stack trace.
Is there an easy method to get that on Windows?
The way I like best is to expand exception dialog with additional "Get stack dump" button,
but maybe something like that is already implemented?

Alexander S. Klenin Insight Experts Ltd.

Reply by email

Bogusław Brandys
to Alexander Klenin

Alexander Klenin pisze:

Show quoted text 8 lines
When using Lazarus IDE, it sometimes fails with various exceptions. In order to debug, or at least identify the source of the problems I need additional info, such as stack trace. Is there an easy method to get that on Windows? The way I like best is to expand exception dialog with additional "Get stack dump" button, but maybe something like that is already implemented?

Use command line switch like :
lazarus.exe --debug-log=debug.log (or other filename)

or rebuild lazarus IDe with console window enabled

or E:\projekty\flamenco\program\bin\flamenco.exe --debug-log=debug.log

Plenty of options.

Additionally (guessing here ) there is possibility to add TApplication.OnException handler into lazarus IDE lpr and catch most of exceptions here.Nice idea.

Boguslaw

Reply by email

Bogusław Brandys
to Bogusław Brandys

Bogus?aw Brandys pisze:

Show quoted text 16 lines
Alexander Klenin pisze: > When using Lazarus IDE, it sometimes fails with various exceptions. > In order to debug, or at least identify the source of the problems I > need additional info, such as stack trace. > Is there an easy method to get that on Windows? > The way I like best is to expand exception dialog with additional "Get > stack dump" button, > but maybe something like that is already implemented? > Use command line switch like : lazarus.exe --debug-log=debug.log (or other filename) or rebuild lazarus IDe with console window enabled or E:\projekty\flamenco\program\bin\flamenco.exe --debug-log=debug.log

Sorry.Incorrect paste.Should be :
http://wiki.lazarus.freepascal.org/Creating_a_Backtrace_with_GDB

Show quoted text 12 lines
Plenty of options. Additionally (guessing here ) there is possibility to add TApplication.OnException handler into lazarus IDE lpr and catch most of exceptions here.Nice idea. Boguslaw _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Alexander Klenin
to Bogusław Brandys: Alexander Klenin pisze: Use command line switch like : lazarus.exe --debug-log=debug.log …
Bogus?aw Brandys wrote
Use command line switch like : lazarus.exe --debug-log=debug.log (or other filename)

Already tried that. Unfortunately, backtrace is not written into the log file.

Plenty of options.

Tried using GDB too, that of course works, but is very inconvenient. I ended up with running
gdb --command=C:\lazarus\run.gdb C:\lazarus\lazarus.exe where run.gdb contains:
cd c:\lazarus
break fpc_raiseexception
commands
bt
cont
end
set logging on
run

So when I get exception in lazarus, it does not freeze, but displays usual exception dialog, while backtrace gets written silently to C:\lazarus\gdb.txt file. Still I think integrated feature would be better.

TApplication.OnException handler into lazarus IDE lpr and catch most of exceptions here.Nice idea.

Yes, I was hoping there is already some hidden option for that ;-)

Alexander S. Klenin Insight Experts Ltd.

Reply by email

Alexander Klenin
to Alexander Klenin
Alexander Klenin wrote
Tried using GDB too, that of course works, but is very inconvenient.

For example, pressing F12 to show form designer leads to a SIGTRAP when lazarus is run under the gdb.
Does anyone know why it does so and how to avoid it?

Alexander S. Klenin Insight Experts Ltd.

Reply by email

Bogusław Brandys
to Alexander Klenin

Alexander Klenin pisze:

Show quoted text 8 lines
On Fri, Oct 10, 2008 at 22:41, Alexander Klenin wrote: > Tried using GDB too, that of course works, but is very inconvenient. For example, pressing F12 to show form designer leads to a SIGTRAP when lazarus is run under the gdb. Does anyone know why it does so and how to avoid it?

Well,what gdb version are you using ? I hope not based on cygwin ? Anyway using --debug-log or just --debug command line switch or rebuild with win32 console enabled is better choice.However gdb is very good in resolving strange but narrow described problems IMHO. Running IDE under gdb may be unstable because gdb does not know all Object pascal structures.

Regards
Boguslaw

Reply by email