core-dumps — Claude Code skill: crash triage from core files
Walks your agent through enabling core dumps, loading them in GDB or LLDB, and pulling a backtrace without rerunning the crashed program.
npx skills add mohitmishra786/low-level-dev-skills --skill core-dumps -a claude-codeWhat core-dumps does
The skill covers the whole path from a segfault to a readable stack. First, turning dumps on: ulimit -c unlimited for one session, entries in /etc/security/limits.conf to make it stick, and a naming scheme via kernel.core_pattern. On systemd boxes it adds coredumpctl — list recent crashes, read coredumpctl info, open the latest in GDB, export the file with coredumpctl dump. macOS gets its own section: dumps land in /cores, and launchd services need the limit set in the plist.
Then the analysis. In GDB the agent loads the binary with the core and works through bt, bt full, info registers, frame switching, and thread apply all bt full when several threads were involved. LLDB follows the same shape with target create ./prog --core core.12345 and thread backtrace all. For stripped binaries there are two routes: debuginfod with DEBUGINFOD_URLS set, or hunting the debug package by build ID read from readelf -n.
A separate section deals with build output: objcopy --only-keep-debug, then --add-gnu-debuglink so GDB finds symbols on its own. There is also a non-interactive option — gdb -batch with bt full piped into a file. Worth knowing before you start: debuginfod-find and eu-readelf come from elfutils, and coredumpctl only helps where systemd collects the dumps.
What it helps with
- turn on core dump writing on Linux and macOS
- load a core file into GDB or LLDB and read the stack
- resolve symbols for a stripped binary via debuginfod
- trace a multi-threaded crash across all threads
- export a dump from coredumpctl and hand it to a teammate
Example prompts for the agent
- The service crashed in prod and I have a core file — show me the stack in GDB
- How do I enable core dumps on Linux so they land in /tmp?
- I have a stripped binary and a core, help me get symbols through debuginfod
How to install core-dumps
1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill core-dumps -a claude-code2Manually: put the files in place
~/.claude/skills/core-dumps/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/core-dumps/
1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill core-dumps -a codex2Manually: put the files in place
.agents/skills/core-dumps/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill core-dumps -a cursor2Manually: put the files in place
.cursor/skills/core-dumps/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install mohitmishra786/low-level-dev-skills core-dumps2Manually: put the files in place
.github/skills/core-dumps/SKILL.md1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill core-dumps -a gemini-cli2Platform CLI
gemini skills install https://github.com/mohitmishra786/low-level-dev-skills --path skills/debuggers/core-dumpsManually: put the files in place
.devin/skills/core-dumps/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill core-dumps -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about core-dumps
How do I install core-dumps in Claude?
Run npx skills add mohitmishra786/low-level-dev-skills --skill core-dumps -a claude-code. The skill ends up at ~/.claude/skills/core-dumps/SKILL.md.
What does core-dumps do?
It guides the agent through enabling core dumps, collecting them, and analysing them in GDB or LLDB. No need to rerun the program — everything comes from the dump.
What do I need for symbol resolution?
Either a configured DEBUGINFOD_URLS with the debuginfod client installed, or a debug package for your distribution. The build ID comes from readelf -n.
Source text
SKILL.md · MIT
--- 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) ```bash # Per-session (lost on logout) ulimit -c unlimited # Persistent (add to /etc/security/limits.conf) * soft core unlimited * hard core unlimited # Check current limit ulimit -c # Set core pattern (where and how cores are named) # Default: 'core' in CWD — often not useful sudo sysctl -w kernel.core_pattern=/tmp/core-%e-%p-%t # %e = executable, %p = PID, %t = timestamp # Persistent (add to /etc/sysctl.d/99-core.conf) 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): ```bash # List recent crashes coredumpctl list # Show details of the latest crash coredumpctl info # Load latest crash in GDB coredumpctl gdb # Load specific PID crash coredumpctl gdb 12345 # Export core file coredumpctl dump -o myapp.core PID ``` Core storage location: `/var/lib/systemd/coredump/`. ### 3. Enable core dumps (macOS) ```bash # macOS uses /cores by default (must be root-writable) ulimit -c unlimited # Check ls /cores/ # launchd-launched services: set in plist # <key>HardResourceLimits</key> # <dict><key>Core</key><integer>9223372036854775807</integer></dict> ``` ### 4. Analyse a core with GDB ```bash # Load binary and core gdb ./prog core.12345 # If the binary was stripped, provide the unstripped copy gdb ./prog-with-symbols core.12345 # Essential first commands (gdb) bt # call stack (gdb) bt full # stack + locals (gdb) info registers # CPU state at crash (gdb) frame 2 # jump to interesting frame (gdb) info locals # local variables in frame (gdb) print ptr # inspect a pointer # All threads (multi-threaded crash) (gdb) thread apply all bt full ``` ### 5. Analyse a core with LLDB ```bash lldb ./prog -c core.12345 # Or lldb (lldb) target create ./prog --core core.12345 # Commands (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. ```bash # Install client (Debian/Ubuntu) sudo apt install debuginfod # Enable (add to ~/.bashrc or /etc/environment) export DEBUGINFOD_URLS="https://debuginfod.ubuntu.com https://debuginfod.elfutils.org" # GDB auto-fetches symbols when DEBUGINFOD_URLS is set gdb ./prog core # Manually query debuginfod-find debuginfo <build-id> debuginfod-find source <build-id> /path/to/file.c ``` ### 7. Missing symbols: manual approach ```bash # Check if binary has a build ID readelf -n ./prog | grep Build # Find the correct debug package # Debian: apt install prog-dbg or prog-dbgsym # RPM: dnf install prog-debuginfo # Point GDB to debug symbols directory (gdb) set debug-file-directory /usr/lib/debug # Or use eu-readelf to dump build ID, then find .debug file 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. ```bash # Build gcc -g -O2 -o prog main.c # Separate debug info objcopy --only-keep-debug prog prog.debug objcopy --strip-debug prog prog.stripped # Add a debuglink so GDB finds the debug file automatically objcopy --add-gnu-debuglink=prog.debug prog.stripped # Deploy prog.stripped; keep prog.debug in a symbols store indexed by build-id ``` ### 9. Quick triage from core without full debug session ```bash # Print backtrace non-interactively gdb -batch -ex 'bt full' -ex 'thread apply all bt full' ./prog core 2>&1 | tee crash.txt # Print registers gdb -batch -ex 'info registers' ./prog core # Check signal that caused crash 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](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
© mohitmishra786 · MIT · mohitmishra786/low-level-dev-skills