[fpc-pascal] Logging full runtime-error/exception backtrace

Everton Vieira tonvieira at gmail.com
Mon Feb 20 16:42:32 CET 2012


I've tried sometimes to do directly with the -gl and the BackTraceStrFunc
and i never was able to get the info of the error, maybe my fault. With
this units that i've passed i was able to get the info of the error with
the line number and everything else within the app.

2012/2/20 Martin <lazarus at mfriebe.de>

> On 20/02/2012 14:58, leledumbo wrote:
>
>> 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<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?
>>
>>
> If you ship with debug info, then see gdbmidebugger.pp
>  function TGDBMIDebuggerCommand.Execute: Boolean;
>
>        Report :=  BackTraceStrFunc(ExceptAddr);
>        Report2 := Report;
>        Frames := ExceptFrames;
>        for I := 0 to ExceptFrameCount - 1 do begin
>          Report := Report + LineEnding + BackTraceStrFunc(Frames[I]);
>          if i < 5
>          then Report2 := Report;
>        end;
>
> -------
>
> If you do not want to ship with debug info:
>
> - compile with debug info
> - keep a copy of the file with debug info
> - use strip[.exe] to remove  the debug info from shipping version
> - dump addresses
>
> when you get the addresses, you can use gdb and the copy with debug info
> that you kept (must match 100% the shipped version)
>
> you will need a smass script calling gdb for each address
>
>
> gdb.exe -i mi project1.exe  --eval-command="info line *0x428f60"
>  --eval-command=q
>
>
>
> ______________________________**_________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.**org<fpc-pascal at lists.freepascal.org>
> http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>
>



-- 
Everton Vieira.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120220/730aedde/attachment.html>


More information about the fpc-pascal mailing list