db-core-debugging

A workflow for investigating database crashes from core dump files, which are saved snapshots of a program's memory after a crash. It uses GDB, a debugger, to inspect threads and call stacks.

In plain words
What is it for?
Loading a database core dump, checking the debugging environment, locating crash threads, examining stack traces, and investigating signals such as SIGSEGV or SIGABRT.
Why use it?
It organizes crash analysis and helps identify the failing thread, function, and likely cause when a database server stops unexpectedly.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/cerdore/gdb-cli/database-core-debugging
Any agent
npx skills add Cerdore/gdb-cli --skill database-core-debugging
Clone the repo
git clone --depth 1 https://github.com/Cerdore/gdb-cli

Made for: Claude Code, Codex.

Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,388 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00064 $0.01388
Opus 5 $0.00032 $0.00694
Sonnet 5 $0.00013 $0.00278
Haiku 4.5 $0.00006 $0.00139

Measured 2d ago against content hash 6d0eddbb5985, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

db-core-debugging scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.omc/drafts/database-core-debugging/SKILL.md · 132 lines

How it starts

The opening of the file, as written. The whole thing — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.

DB Core Debugging Skill

自动化分析 Database core dump 文件的工作流程。

核心工作流

Step 0: 环境检查

gdb-cli env-check
  • gdb-cli 命令不存在 → 安装:pip install git+http://gitlab.internal.example.com/tools/gdb_cli.git
  • 核对 GDB 版本:el7/el8 需要 9.0+,el9/Rocky 需要 15+
  • 核对 GDB Python 支持:gdb -batch -ex "python print('ok')"

Step 1: 加载 core dump(渐进式超时重试)

大型 DB binary(6.1G+)加载时间不可预测,采用渐进式超时:

第 1 次:gdb-cli load -b <binary> -c <core> --timeout 120  (2分钟)
若超时 → 第 2 次:gdb-cli load -b <binary> -c <core> --timeout 300  (5分钟)
若仍超时 → 第 3 次:gdb-cli load -b <binary> -c <core> --timeout 600  (10分钟)
仍失败 → 报错并提示可能原因

加载失败排查:

  • 不要把 server.debug 当二进制用 → 正确用法:gdb-cli load -b server -c core.xxx
  • debuginfo 缺失 → 把 server.debug 文件 copy 到 server 二进制同一目录下
  • 二进制不匹配 → 确认 arm/x86 架构一致、版本完全匹配
  • 跨机器动态库问题 → 使用 --sysroot--solib-prefix 参数
  • GDB 版本问题 → 使用 --gdb-path 指定正确版本
  • core 文件不完整 → 检查磁盘空间,对比进程内存占用

Step 2: 状态概览

gdb-cli status -s <session_id>

确认:模式(core)、binary 路径、线程数、当前帧信息。

Step 3: 崩溃线程定位

gdb-cli threads -s <SID> --limit 50

找到信号线程(通常是 thread 1,收到 SIGSEGV/SIGABRT)。

Step 4: 堆栈分析

gdb-cli bt -s <SID> --thread <crash_thread> --limit 30

从崩溃帧(frame 0)向上遍历调用链,识别关键函数。

Step 4.5: 源码关联分析(可选)

如果 bt 输出包含源文件信息:

  1. 尝试在本地工作目录查找对应源码文件
  2. 使用 Read 工具读取崩溃位置前后 20 行代码
  3. 结合代码逻辑理解崩溃上下文

Step 5: 变量与上下文检查

# 崩溃帧的函数参数
gdb-cli args -s <SID> --thread <crash_thread> --frame 0

# 崩溃帧的局部变量
gdb-cli locals-cmd -s <SID> --thread <crash_thread> --frame 0

# 深入查看关键变量(需先切换上下文)
gdb-cli thread-switch -s <SID> <crash_thread>
gdb-cli frame -s <SID> 0
gdb-cli eval-cmd -s <SID> "this->member_name_"
gdb-cli eval-cmd -s <SID> "*ptr"

Step 6: 深入诊断

根据崩溃类型选择诊断手段:

崩溃类型 诊断命令
空指针解引用 eval-cmd 检查指针值,ptype 查看类型
内存越界 memory 检查周边内存,registers 查看地址寄存器
非法指令 disasm 查看崩溃点汇编,registers 查看 rip
栈溢出 registers 查看 rsp,memory 检查栈边界
断言失败 eval-cmd 查看断言条件中的变量值

Step 7: 根因推断 + 输出结论

Read the full file on GitHub · 132 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 132 lines · 64 tokens per session scan A 6d0eddbb5985

Subscribe to this mod's changes

db-core-debugging is a skill published in the GitHub repository Cerdore/gdb-cli (33 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 64 tokens to every session and 1,388 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…

openai/codex · 114 tokens

imagegen

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…

openai/codex · 113 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens