Articles in this section

How to gather backtrace from a coredump with gdb?

Context

An application could have a SegFault/SIGSEGV issue. It is a good idea to try and generate a Coredump and analyze the resulting file.

Method

1) Set the coredump file size to unlimited to enable coredump:
ulimit -c unlimited
more details on making coredump change persistent can be found here .
2) Run the program that is segfaulting:
[root@mycluster-1 /]# cd testcore/
[root@mycluster-1 testcore]# asmt -r -v -p /tmp/asmttest -n test
Aerospike Shared Memory Tool, Version 2.1.0
Copyright (C) 2022-2024 Aerospike, Inc.  All rights reserved.

asmt -r -v -p /tmp/asmttest -n test

Performing restore operation.

Segmentation fault (core dumped)

[root@mycluster-1 testcore]# ls -ltrh
total 444K
-rw------- 1 root root 580K May 31 18:03 core

 


3) Install gdb (example is for an EL8/Centos8 system)
yum install gdb

4) Run gdb with path to program binary file and the core file. (core file by default should be at the same path where program was ran)
 
gdb <Path to Binary file> <path to core file>

example:

[root@mycluster-1 testcore]# gdb /usr/bin/asmt core 
...
(gdb) 


5) Capture the backtrace from gdb
 
(gdb) bt
#0  display_files (pbfp=pbfp@entry=0xb0a8c0, ptfp=ptfp@entry=0xb0a900, psfps=psfps@entry=0x7ffd8a099670, n_psfps=n_psfps@entry=5, smfp=smfp@entry=0xb0a800, ssfps=ssfps@entry=0x7ffd8a0b9670, n_ssfps=n_ssfps@entry=2, dfps=dfps@entry=0x7ffd8a097670, n_dfps=n_dfps@entry=0)
    at src/asmt.c:4413
#1  0x00000000004082f1 in analyze_restore_candidate (fps=fps@entry=0xb0a800, n_fps=n_fps@entry=10, base_ix=base_ix@entry=3) at src/asmt.c:4214
#2  0x00000000004094c3 in analyze_restore () at src/asmt.c:3836
#3  0x0000000000401c1a in analyze () at src/asmt.c:951
#4  main (argc=<optimized out>, argv=<optimized out>) at src/asmt.c:708


6) Provide backtrace to our engineer along with binary tool or server version for further analysis. (ideally provide corefiles)
 

Applies To Earliest Version

Pre 4.9

Applies To Latest Version

Current Version
Was this article helpful?
0 out of 0 found this helpful