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.


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to