Core Dump
Enable core dump
- Ensure that they are enabled. Run the following command. If the reply is not
unlimited
, the core dumps are disabled or limited.$ ulimit -c
- Run
ulimit -c unlimited
to enable creation of core dumps from the current shell session.$ ulimit -c unlimited
File location
- Location of core dump config file
$ cat /proc/sys/kernel/core_pattern |/usr/share/apport/apport %p %s %c %d %P %E
- Rewrite contents of
core_pattern
file so that the core is dumped to the current working directory.$ sudo bash -c 'echo core.%e.%p.%t > /proc/sys/kernel/core_pattern'
Usage
- Simple usage of GDB, to debug coredump files
$ gdb <executable_path> <coredump_file_path>
- After getting inside the GDB prompt (on execution of the above command), type
$ (gdb) where $ (gdb) bt $ (gdb) thread apply all bt
This will get the information, of the stack, where we can analayze the cause of the crash/fault.
Leave a comment