How to use addr2line tool to get a backtrace

The Aerospike Knowledge Base has moved to https://support.aerospike.com. Content on https://discuss.aerospike.com is being migrated to either https://support.aerospike.com or https://docs.aerospike.com. Maintenance on articles stored in this repository ceased on December 31st 2022 and this article may be stale. If you have any questions, please do not hesitate to raise a case via https://support.aerospike.com.

How to use addr2line tool to get a backtrace

Context

Use of the addr2line tool to convert stacktrace addresses into code lines in order to troubleshoot a server crash. If running on a different node than the one that crashed, ensure that the OS and the Aerospike Server Version are the same as the crashed node.

Method

Save stacktrace to a file

grep 'stacktrace' aerospike.log >  MY_STACKTRACE_FILE.txt

Example Stack trace

May 13 2020 16:09:00 GMT: WARNING (as): (signal.c:187) SIGSEGV received, aborting Aerospike Enterprise Edition build 4.8.0.4 os el7
May 13 2020 16:09:00 GMT: WARNING (as): (fault.c:1178) stacktrace: registers: rax 0000000007121f60 rbx 00007fdb3d59be78 rcx 00007f96d5400000 rdx 0000000000001000 rsi 00007f96d5400000 rdi 00007f96d5400000 rbp 00007f96d5401f78 rsp 00007f966e9fa1a0 r8 00007f96d543f000 r9 00007f96d5401f60 r10 000000000000000d r11 0000000000001fe0 r12 00007f97675e7180 r13 00007f966e9fb100 r14 00000019deae8ba0 r15 ffffffffffffffff rip 00000000007961be
May 13 2020 16:09:00 GMT: WARNING (as): (fault.c:1192) stacktrace: found 14 frames: 0x6f664b 0x4f289f 0x7f976b1617e0 0x7961be 0x7b7faf 0x78c4e5 0x5bd245 0x5be9ab 0x5d6765 0x5f1d65 0x5f55a5 0x5d4e6b 0x7f976b15740b 0x7f9769f97e7f offset 0x0
.
.
.

Run addr2line to retrieve the backtrace on the individual frames

addr2line -i -C -f -e /usr/bin/asd $(grep -Eo '\[\0x[0-9A-Za-z]{6,}\]' MY_STACKTRACE_FILE.txt |tr -d '[' | tr -d ']' | tr '\n' ' ') > MY_BACKTRACE_CASEXXXX.txt

OR Run addr2line on the list of frames printed directly

addr2line -e /usr/bin/asd -i -f -C 0x6f664b 0x4f289f 0x7f976b1617e0 0x7961be 0x7b7faf 0x78c4e5 0x5bd245 0x5be9ab 0x5d6765 0x5f1d65 0x5f55a5 0x5d4e6b 0x7f976b15740b 0x7f9769f97e7f

Keywords

crash gdb stacktrace infoline backtrace bt coredump addr2line

Timestamp

June 2020