Am 20.02.2012 15:58, schrieb leledumbo:
I want to log the full runtime-error/exception backtrace to a file. I've
tried all methods explained
http://wiki.lazarus.freepascal.org/Logging_exceptions here  but none seems
to give the full backtrace. i.e. when compiled with -gl, instead of just the
address, I could also get "line NN of file XX.pas". How could I do it?

The resolution of file and address can only be done if your code is a) compiled with debug info and b) some code is available that can translate the debug info to the output. The first is done by "-g", while the second is done by adding the "l" option. The latter adds the unit lineinfo or lnfodwrf depending on the debug format used by the compiler.

So in summary: if you want to have full output of the backtrace, then it is wisest to use "-gl" and then one of the approaches mentioned on the wiki page (e.g. DumpExceptionBackTrace(SomeFile) ).

If you don't want to include the debug information with your application (e.g. space reasons) then compile your application using "-Xg" which will create a file "appname.dbg" which will contain the debug info (you don't need to redistribute this file). On an exception you simply log the addresses and then you can convert these addresses to line/file by using gdb and the created ".dbg" file (more details on this if you want to follow that approach).

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to