Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support separate loading debug symbols #5758

Closed
XVilka opened this issue Sep 14, 2016 · 7 comments
Closed

Support separate loading debug symbols #5758

XVilka opened this issue Sep 14, 2016 · 7 comments

Comments

@XVilka
Copy link
Contributor

XVilka commented Sep 14, 2016

For example in Gentoo with 'splitdebug' option: https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces#Stripping

r2 -d /bin/ls
Process with PID 28255 started...
= attach 28255 28255
bin.baddr 0x00400000
Assuming filepath /bin/ls
asm.bits 64
[0x7f2895c79c80]> dm
sys 120K 0x0000000000400000 - 0x000000000041e000 s -r-x /bin/ls /bin/ls
sys   8K 0x000000000061d000 - 0x000000000061f000 s -rw- /bin/ls /bin/ls
sys   4K 0x000000000061f000 - 0x0000000000620000 s -rw- unk0 unk0
sys 140K 0x00007f2895c79000 * 0x00007f2895c9c000 s -r-x /lib64/ld-2.23.so /lib64/ld-2.23.so
sys   8K 0x00007f2895e9c000 - 0x00007f2895e9e000 s -rw- /lib64/ld-2.23.so /lib64/ld-2.23.so
sys   4K 0x00007f2895e9e000 - 0x00007f2895e9f000 s -rw- unk1 unk1
sys 136K 0x00007ffd8b8ff000 - 0x00007ffd8b921000 s -rw- [stack] [stack]
sys  12K 0x00007ffd8b9ac000 - 0x00007ffd8b9af000 s -r-- [vvar] [vvar]
sys   8K 0x00007ffd8b9af000 - 0x00007ffd8b9b1000 s -r-x [vdso] [vdso]
sys   4K 0xffffffffff600000 - 0xffffffffff601000 s -r-x [vsyscall] [vsyscall]
[0x7f2895c79c80]> dmh
Warning: Is glibc mapped in memory? (see dm command)
[0x7f2895c79c80]> db main
[0x7f2895c79c80]> dc
hit breakpoint at: 4027e0
= attach 28255 1
[0x004027e0]> dm
sys 120K 0x0000000000400000 * 0x000000000041e000 s -r-x /bin/ls /bin/ls
sys   4K 0x000000000061d000 - 0x000000000061e000 s -r-- /bin/ls /bin/ls
sys   4K 0x000000000061e000 - 0x000000000061f000 s -rw- /bin/ls /bin/ls
sys   4K 0x000000000061f000 - 0x0000000000620000 s -rw- unk0 unk0
sys 1.6M 0x00007f28958df000 - 0x00007f2895a6f000 s -r-x /lib64/libc-2.23.so /lib64/libc-2.23.so
sys   2M 0x00007f2895a6f000 - 0x00007f2895c6f000 s ---- /lib64/libc-2.23.so /lib64/libc-2.23.so
sys  16K 0x00007f2895c6f000 - 0x00007f2895c73000 s -r-- /lib64/libc-2.23.so /lib64/libc-2.23.so
sys   8K 0x00007f2895c73000 - 0x00007f2895c75000 s -rw- /lib64/libc-2.23.so /lib64/libc-2.23.so
sys  16K 0x00007f2895c75000 - 0x00007f2895c79000 s -rw- unk1 unk1
sys 140K 0x00007f2895c79000 - 0x00007f2895c9c000 s -r-x /lib64/ld-2.23.so /lib64/ld-2.23.so
sys  12K 0x00007f2895e5d000 - 0x00007f2895e60000 s -rw- unk2 unk2
sys   4K 0x00007f2895e9b000 - 0x00007f2895e9c000 s -rw- unk3 unk3
sys   4K 0x00007f2895e9c000 - 0x00007f2895e9d000 s -r-- /lib64/ld-2.23.so /lib64/ld-2.23.so
sys   4K 0x00007f2895e9d000 - 0x00007f2895e9e000 s -rw- /lib64/ld-2.23.so /lib64/ld-2.23.so
sys   4K 0x00007f2895e9e000 - 0x00007f2895e9f000 s -rw- unk4 unk4
sys 136K 0x00007ffd8b8ff000 - 0x00007ffd8b921000 s -rw- [stack] [stack]
sys  12K 0x00007ffd8b9ac000 - 0x00007ffd8b9af000 s -r-- [vvar] [vvar]
sys   8K 0x00007ffd8b9af000 - 0x00007ffd8b9b1000 s -r-x [vdso] [vdso]
sys   4K 0xffffffffff600000 - 0xffffffffff601000 s -r-x [vsyscall] [vsyscall]
[0x004027e0]> dmh
Is a custom library? (LD_PRELOAD=..) Enter full path glibc: /lib/libc.so.6
Warning: Symbol main_arena could not be found. Is libc6-dbg installed?
[0x004027e0]>
@XVilka
Copy link
Contributor Author

XVilka commented Sep 14, 2016

@n4x0r

@XVilka
Copy link
Contributor Author

XVilka commented Sep 14, 2016

It's located at /usr/lib/debug/lib64/libc-2.23.so.debug, since /lib/libc.so.6 is a symlink to /lib/libc-2.23.so, so the 'prefix' is /usr/lib/debug

@radare
Copy link
Collaborator

radare commented Sep 18, 2016

This is already possible with oa command, please confirm i did this last week

@radare
Copy link
Collaborator

radare commented Sep 26, 2016

this can be done with ob and oa, but its just not done "automatically". so considered fixed, but keeping it open until someone writes a test

@radare radare modified the milestones: 1.x, 0.10.6 Sep 26, 2016
@XVilka
Copy link
Contributor Author

XVilka commented Sep 26, 2016

I know it can be done in manual mode, but it's just a few distributives, gdb does that automatically, would be nice to have that for r2. I'll fix it by myself when I have time (since nobody even cares except me), should be very easy.

@ulexec
Copy link
Contributor

ulexec commented Sep 26, 2016

Im restricted on time atm if not i would have done it already. is not that u are the only one that cares xvilka cmon :_(

@jduck
Copy link
Contributor

jduck commented Sep 27, 2016

@XVilka I care too!

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants