| name | core-dumps |
| description | Core dump analysis skill for production crash triage. Use when loading core files in GDB or LLDB, enabling core dump generation on Linux/macOS, mapping symbols with debuginfo or debuginfod, or extracting backtraces from crashes without re-running the program. Activates on queries about core files, ulimit, coredumpctl, debuginfod, crash triage, or analyzing segfaults from production binaries. |
Core Dumps
Purpose
Guide agents through enabling, collecting, and analysing core dumps for post-mortem crash investigation without rerunning the buggy program.
Triggers
- "My program crashed in production — how do I analyse the core?"
- "How do I enable core dumps on Linux?"
- "I have a core file but no symbols / source"
- "How do I use debuginfod to get symbols for a core?"
- "coredumpctl show me the crash"
Workflow
1. Enable core dumps (Linux)
ulimit -c unlimited
* soft core unlimited
* hard core unlimited
ulimit -c
sudo sysctl -w kernel.core_pattern=/tmp/core-%e-%p-%t
kernel.core_pattern=/tmp/core-%e-%p-%t
kernel.core_uses_pid=1
2. systemd/coredumpctl (modern Linux)
If systemd manages core dumps (common on Ubuntu 20+, Fedora, Arch):
coredumpctl list
coredumpctl info
coredumpctl gdb
coredumpctl gdb 12345
coredumpctl dump -o myapp.core PID
Core storage location: /var/lib/systemd/coredump/.
3. Enable core dumps (macOS)
ulimit -c unlimited
ls /cores/
4. Analyse a core with GDB
gdb ./prog core.12345
gdb ./prog-with-symbols core.12345
(gdb) bt
(gdb) bt full
(gdb) info registers
(gdb) frame 2
(gdb) info locals
(gdb) print ptr
(gdb) thread apply all bt full
5. Analyse a core with LLDB
lldb ./prog -c core.12345
lldb
(lldb) target create ./prog --core core.12345
(lldb) bt
(lldb) thread backtrace all
(lldb) frame select 2
(lldb) frame variable
6. Missing symbols: debuginfod
debuginfod serves debug symbols from a central server, mapping build IDs to DWARF data.
sudo apt install debuginfod
export DEBUGINFOD_URLS="https://debuginfod.ubuntu.com https://debuginfod.elfutils.org"
gdb ./prog core
debuginfod-find debuginfo <build-id>
debuginfod-find source <build-id> /path/to/file.c
7. Missing symbols: manual approach
readelf -n ./prog | grep Build
(gdb) set debug-file-directory /usr/lib/debug
eu-readelf -n ./prog
find /usr/lib/debug -name "*.debug" | xargs eu-readelf -n 2>/dev/null | grep <build-id>
8. Strip binaries and keep symbols
Best practice: build with symbols, strip for distribution, keep an unstripped copy.
gcc -g -O2 -o prog main.c
objcopy --only-keep-debug prog prog.debug
objcopy --strip-debug prog prog.stripped
objcopy --add-gnu-debuglink=prog.debug prog.stripped
9. Quick triage from core without full debug session
gdb -batch -ex 'bt full' -ex 'thread apply all bt full' ./prog core 2>&1 | tee crash.txt
gdb -batch -ex 'info registers' ./prog core
gdb -batch -ex 'info signal' ./prog core
For a full cheatsheet covering core pattern tokens, coredumpctl, GDB/LLDB commands, debuginfod servers, and strip/symbol workflows, see references/cheatsheet.md.
Related skills
- Use
skills/debuggers/gdb for full GDB session details
- Use
skills/debuggers/lldb for LLDB-based analysis
- Use
skills/runtimes/sanitizers to catch the bug before it reaches production
- Use
skills/binaries/elf-inspection for readelf, build IDs, and binary inspection