When you can’t use gdb or valgrind, there is /lib/libSegFault.so.

by groleo

Under certain conditions I can’t get gdb or valgrind to work on my binary and I don’t want
any delays from them. And I just wanted to see where the binary segfaulted so I remembered of
/lib/libSegFault.so.


LD_PRELOAD=/lib/libSegFault.so executable
Backtrace:
/lib/libSegFault.so(+0x206f)[0x11206f]
[0x9d1400]
executable[0x805994d]
executable[0x8059a0d]
executable[0x805d043]
executable[0x8057d59]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0xae5bd6]
executable[0x8048e81]

Now I use addr2line to translate the addresses to locations in binary:

addr2line -e executable 0x805994d 0x8059a0d 0x805d043 0x8057d59
sm.c:505
sm.c:564
tmr.c:104
main.c:155

Thats it .

Advertisements