Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find which program caused a core dump file

I've been going through intense program/package installation recently, so I can't tell for sure which of the newly installed programs (or old programs) caused the appearance of a core file in my home folder. It's a server, so I better find out any possible sources of instability on the machine.

like image 734
Desmond Hume Avatar asked Nov 09 '12 13:11

Desmond Hume


People also ask

How do I analyze a core dump file?

With a core file, we can use the debugger (GDB) to inspect the state of the process at the moment it was terminated and to identify the line of code that caused the problem. That's a situation where a core dump file could be produced, but it's not by default.

Where is core dump file created?

By default, all core dumps are stored in /var/lib/systemd/coredump (due to Storage=external ) and they are compressed with zstd (due to Compress=yes ). Additionally, various size limits for the storage can be configured. Note: The default value for kernel. core_pattern is set in /usr/lib/sysctl.

What is inside Coredump?

In computing, a core dump, memory dump, crash dump, storage dump, system dump, or ABEND dump consists of the recorded state of the working memory of a computer program at a specific time, generally when the program has crashed or otherwise terminated abnormally.


2 Answers

You can simply use the file program to identify them:

E.g

# file /var/core/core /var/core/core:     ELF 64-bit MSB core file SPARCV9 Version 1, from 'crs_stat.bin' 
like image 133
Benj Avatar answered Oct 02 '22 15:10

Benj


Often using the file program on the core file will show the errant executable, as explained by @Benj in the accepted answer (code from Benj's answer):

# file /var/core/core /var/core/core:     ELF 64-bit MSB core file SPARCV9 Version 1, from 'crs_stat.bin' 

However, sometimes you may get a complaint about "too many program header sections":

core.some-lib.nnnn.nnnn: ELF 64-bit LSB  core file x86-64, version 1 (SYSV), too many program header sections (1850) 

In this case, you can try some alternatives:

  • Tail the last several strings of the corefile (the app was about 25 back for me): strings core.some-lib.nnnn.nnnn | tail -50
  • Use gdb itself: gdb -c core.some-lib.nnnn.nnnn This will often tell you something like this: Core was generated by '/usr/local/bin/some-executable'
like image 44
rholmes Avatar answered Oct 02 '22 15:10

rholmes