MCPInstall

debug-gdb-openocd

当需要通过 OpenOCD 启动或附着 GDB 会话,调用自带脚本完成固件下载、在线调试或崩溃现场检查时使用。

Installs
563
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/leokemp223/embed-ai-tool --skill debug-gdb-openocd
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads debug-gdb-openocd automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

GDB OpenOCD 调试

适用场景

  • 用户希望通过 OpenOCD 调试 Cortex-M 类目标。
  • 工作区中已有 ELF 和与 OpenOCD 兼容的探针信息。
  • 烧录或串口监视流程表明,需要进一步查看断点、停核控制、寄存器或回溯信息。
  • 需要在调试前确认 OpenOCD 和 GDB 环境是否就绪。

必要输入

  • 一份带符号的 ELF,或包含 artifact_path 的 Project Profile。
  • OpenOCD 配置信息,或足以安全解析配置的工作区线索。
  • 可选调试模式:download-and-halt、attach-only、crash-context。
  • 可选的 GDB 可执行文件路径。

自动探测

  • 默认模式为 download-and-halt;只有用户显式要求附着调试或崩溃现场检查时才切换。
  • GDB 由脚本自动探测,优先级为:显式用户输入、Project Profile、arm-none-eabi-gdb、gdb-multiarch。
  • 探针由脚本自动探测,优先级与 flash-openocd 保持一致。
  • 做符号级调试必须有 ELF。若只有 HEX 或 BIN,应阻塞并要求提供匹配 ELF。

执行步骤

  1. 先阅读 references/debug-playbook.md 中的决策树,判断应使用条件断点、普通断点还是 OpenOCD Telnet。
  2. 再阅读 references/usage.md,确认本次是环境探测,还是执行调试会话。
  3. 若不确定环境是否就绪,先运行自带脚本 scripts/gdb_debugger.py 的 --detect 模式确认。
  4. 根据用户意图选择调试模式:download-and-halt(默认)、attach-only 或 crash-context。
  5. 使用 --elf 指定符号文件,配合 --interface + --target 或 --config 启动调试。
  6. 读取脚本输出的调试结果,重点关注寄存器状态、回溯帧和 Fault 寄存器(crash-context 模式)。
  7. 将调试配置和关键观察写回 Project Profile,并在需要时交给下游 skill。

失败分流

  • 当缺少 openocd 或兼容 GDB 时,返回 environment-missing。
  • 当没有可用的 ELF 时,返回 artifact-missing。
  • 当 OpenOCD 或 GDB 无法连接目标板时,返回 connection-failure。
  • 当 OpenOCD 配置或符号文件与目标不一致时,返回 project-config-error。
  • 当会话可以建立,但无法停核、加载或得到可信回溯时,返回 target-response-abnormal。
  • 当存在多个同样合理的探针、配置或符号文件时,返回 ambiguous-context。

平台说明

  • 自带脚本使用 Python 标准库和 subprocess 调用 openocd 和 gdb,因此调试调度路径本身是跨平台的。
  • 输出中应将 OpenOCD 与 GDB 命令分开列出,方便用户在其他 shell 或 IDE 中复现。
  • Windows 宿主机可能需要解析 .exe 后缀,但逻辑流程与其他平台一致。

输出约定

  • 输出调试模式、OpenOCD 命令、GDB 可执行文件、ELF 路径和关键观察结论。
  • 在 Project Profile 中保留 artifact_path、artifact_kind、gdb_executable、openocd_config。
  • 当复位后或继续运行后下一步是观察运行行为时,推荐 serial-monitor。

交接关系

  • 当目标恢复运行后,需要继续观察运行期日志时,将成功会话交给 serial-monitor。

FAQ

What does the debug-gdb-openocd skill do?

当需要通过 OpenOCD 启动或附着 GDB 会话,调用自带脚本完成固件下载、在线调试或崩溃现场检查时使用。

How do I install debug-gdb-openocd?

Run npx skills add https://github.com/leokemp223/embed-ai-tool --skill debug-gdb-openocd in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/debug-gdb-openocd/ (personal) or .claude/skills/debug-gdb-openocd/ (project).

Which AI agents can use debug-gdb-openocd?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is debug-gdb-openocd safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains debug-gdb-openocd?

It is published by leokemp223 in leokemp223/embed-ai-tool. It has 563 recorded installs.

More from leokemp223/embed-ai-tool

View all →

serial-monitor

leokemp223/embed-ai-tool

当需要识别正确串口、调用自带脚本抓取日志,并分析嵌入式固件运行状态时使用。

585 installs

build-keil

leokemp223/embed-ai-tool

当需要通过 Keil MDK 命令行编译嵌入式工程,调用自带脚本解析工程文件、执行构建并定位固件产物时使用。

572 installs

build-platformio

leokemp223/embed-ai-tool

当需要通过 PlatformIO 命令行编译嵌入式工程,调用自带脚本解析环境配置、执行构建并定位固件产物时使用。

568 installs

workflow

leokemp223/embed-ai-tool

当需要串联多个 skill 完成编译+烧录+监控或编译+烧录+调试等流水线任务时使用。

flash-keil

leokemp223/embed-ai-tool

当需要通过 Keil MDK 内置调试器烧录固件到目标板时使用,利用工程中已配置的调试器和 Flash 算法执行下载。

566 installs

build-cmake

leokemp223/embed-ai-tool

当需要配置或构建基于 CMake 的嵌入式固件工程,调用自带脚本执行构建并定位固件产物时使用。

564 installs

Popular code quality & workflow skills

View category →

grill-me

mattpocock/skills

A relentless interview to sharpen a plan or design.

Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

handoff

mattpocock/skills

Compact the current conversation into a handoff document for another agent to pick up.

domain-modeling

mattpocock/skills

Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.

codebase-design

mattpocock/skills

Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

diagnosing-bugs

mattpocock/skills

Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.