I see a segmentation fault like this segfault at 157e8250 ip 157e8250 sp bfa3fdfb
how do I map the this address to the corresponding code where the fault occurs?
you should add the "-g" option of gcc
use gnu tool "addr2line", like,
# addr2line -e a.out 0x80484c8 -f
-e: executable file name
-f: generate function name
Use the addr2line utility from the GNU binutils suite. For example, this prints out the filename, line number, and function name (demangling it if it's a C++ function) for the faulting address 0x157e8250:
addr2line -e my_executable_file -C -f 0x157e8250
You can also pass on any number of addresses in the command line, e.g. if you have a stack trace of only instruction addresses.
Make sure you compile your program with the -g
compiler option to generate debugging symbols, otherwise addr2line
will not be able to symbolicate anything for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With