radare2 icon indicating copy to clipboard operation
radare2 copied to clipboard

Symbols in /usr/lib/debug aren't automatically loaded

Open lucianposton opened this issue 8 years ago • 12 comments

See https://github.com/radare/radare2/issues/4888 for context.

Several linux systems split debug symbols from executables and installs them under /usr/lib/debug/ e.g. /usr/path/to/bin/cmd has symbols at /usr/lib/debug/usr/path/to/bin/cmd. radare2 1.6.0 doesn't appear to load these symbols. The symbols for calls are missing, attemping to seek, s, to a function fails, etc. On the other hand, gdb automatically loads the symbols from these files.

lucianposton avatar Oct 09 '17 04:10 lucianposton

Also, ob /usr/lib/debug/usr/path/to/bin/cmd doesn't appear to manually load the symbols either.

lucianposton avatar Oct 09 '17 05:10 lucianposton

Code from https://github.com/radare/radare2/blob/master/libr/core/linux_heap_glibc.c#L213 should be generalized for using anywhere in RBin.

XVilka avatar Oct 09 '17 09:10 XVilka

same goes for jemalloc

On 9 Oct 2017, at 11:55, Anton Kochkov [email protected] wrote:

Code from https://github.com/radare/radare2/blob/master/libr/core/linux_heap_glibc.c#L213 https://github.com/radare/radare2/blob/master/libr/core/linux_heap_glibc.c#L213 should be generalized for using anywhere in RBin.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/radare/radare2/issues/8666#issuecomment-335112659, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3-llQjNNx1umEoctrJh5SM4LFJ_A_Lks5sqe2OgaJpZM4Px_vA.

radare avatar Oct 09 '17 10:10 radare

In the meantime, is there a workaround to manually load symbols in version 2.0.0?

o /usr/lib/debug/usr/path/to/bin/cmd doesn't work. After issuing the preceding command, there is no error output, no new files are listed by o, and no symbols appear to have been loaded.

lucianposton avatar Oct 09 '17 20:10 lucianposton

@lucianposton I care too know as well. Did you find a solution?

tbarabosch avatar Oct 17 '17 08:10 tbarabosch

.!rabin2 -r ....

But you can use the ob subcommands too

radare avatar Oct 17 '17 09:10 radare

I care too know as well. Did you find a solution?

Nope. The ob command didn't load any symbols as far as I could tell.

I haven't yet tried the .!rabin2 -r ... suggestion above.

lucianposton avatar Oct 18 '17 01:10 lucianposton

Ob by itself doesnt do anything. Check the help message

On 18 Oct 2017, at 03:41, lucianposton [email protected] wrote:

I care too know as well. Did you find a solution?

Nope. The ob command didn't load any symbols as far as I could tell.

I haven't yet tried the .!rabin2 -r ... suggestion above.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

radare avatar Oct 18 '17 09:10 radare

oops. I meant to say o /usr/lib/debug/usr/path/to/bin/cmd didn't load the symbols, and ob, which is supposed to list opened files, did lis anything new after o.

lucianposton avatar Oct 18 '17 15:10 lucianposton

Nope, o opens a binary, replacing the current one, so nope

Ob doesnt lists the opened files. It lists the bin objects and u can use it to load the bin info of that bin on top of the current opened file

Also, historically this has been done via .!rabin2... since the very first versions of r1.

Which distro are u using to have test this?

On 18 Oct 2017, at 17:52, lucianposton [email protected] wrote:

oops. I meant to say o /usr/lib/debug/usr/path/to/bin/cmd didn't load the symbol, and ob, which is supposed to list opened files, did lis anything new after o.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

radare avatar Oct 18 '17 20:10 radare

related to the dmi issue

radare avatar Dec 24 '17 17:12 radare

A workaround I've found is to recombine the executable and debug info into a single file.

Can be done with eu-unstrip from elfutils:

eu-unstrip /usr/bin/cmd /usr/lib/debug/usr/bin/cmd -o cmd.dbg

agausmann avatar Oct 11 '23 02:10 agausmann