Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-02

Recovering info from a backtrace with an external debug file

7 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luiz Americo Pereira Camara

Hi,

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?

Thanks in advance

Luiz

Unknown author
to Luiz Americo Pereira Camara
Luiz Americo Pereira Camara wrote 10 lines
Hi, 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?

my first eWAG gut response is to distribute the DBG file with the executable...

NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list* unless private contact is specifically requested and granted.
Luiz Americo Pereira Camara
to Unknown author

2016-02-10 23:59 GMT-03:00 :

Show quoted text 12 lines
On 02/10/2016 09:47 PM, Luiz Americo Pereira Camara wrote: > > How to get the line number, method names of the backtrace using the > external > debug file? > my first eWAG gut response is to distribute the DBG file with the executable...

Thanks

But that will not help, the backtrace will still be generated without info, just address

Luiz

Martin
to Luiz Americo Pereira Camara: I compiled a program with -Xg (generating an external debug info file *.dbg) And deployed…
Luiz Americo Pereira Camara wrote 11 lines
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.

Luca Olivetti
to Martin

El 11/02/16 a les 04:12, Martin ha escrit:

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

That should be "info line *0x54320".

Bye

Luca
Luiz Americo Pereira Camara
to Luiz Americo Pereira Camara: 2016-02-10 23:59 GMT-03:00 : Thanks But that will not help, the backtrace will still be…

2016-02-11 0:06 GMT-03:00 Luiz Americo Pereira Camara <

Show quoted text 24 lines
: 2016-02-10 23:59 GMT-03:00 : > On 02/10/2016 09:47 PM, Luiz Americo Pereira Camara wrote: > >> >> How to get the line number, method names of the backtrace using the >> external >> debug file? >> > > my first eWAG gut response is to distribute the DBG file with the > executable... > > Thanks But that will not help, the backtrace will still be generated without info, just address

My apologies.

After some testing, i found that when the dbg file is in the same dir as the executable, the calltrace is show with lineinfo. Seems that fpc generates code to find the debug info.

Luiz

Luiz Americo Pereira Camara
to Martin: I don't know how to do it with an external dbg file. (though gdb might be able do to that)

2016-02-11 0:12 GMT-03:00 Martin :

Show quoted text 19 lines
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.

Thanks.

Much helpful

Luiz