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 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@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to