[fpc-pascal] Recovering info from a backtrace with an external debug file

Martin fpc at mfriebe.de
Thu Feb 11 04:12:52 CET 2016


On 11/02/2016 02:47, Luiz Americo Pereira Camara wrote:
>
> I compiled a program with -Xg (generating an external debug info file 
> *.dbg)
>
> And deployed the executable without the debug info
>
> When an exception occurs i get a backtrace with only addresses
>
> How to get the line number, method names of the backtrace using the 
> external debug file?
>
I don't know how to do it with an external dbg file. (though gdb might 
be able do to that)

But the following works (at least if the exe is not compiled for dynamic 
relocation)

- Build an exe with debug in the exe.
- Make a copy and strip debug from the copy
- Ship the copy

Lazarus has "Leaks and Traces" in the view menu. Paste the trace, and 
then use the Button "Resolve" to load the exe with symbols. That should do.

It uses a copy of the code found in infodwrf and "whatever the name of 
the unit reading stabs". Both of them (afaik) dont do dbg files. If 
someone has info how to add that, well ....


as for gdb, you can open your exe (and if gdb finds the dbg file, then 
that should be fine.)
if gdb loaded your dbg info, then you can do something (not tested/from 
memory)

info symbol 0x54320 and it prints what is at that address. Do that for 
each address in the trace.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160211/fdd8125e/attachment.html>


More information about the fpc-pascal mailing list