debug

A command-line debugging toolkit for embedded programs using J-Link or OpenOCD, tools that connect a computer to a microcontroller for inspection.

In plain words
What is it for?
Use it to collect RTT logs, set breakpoints, watch memory, read registers, or launch source-level debugging with GDB when the required hardware and tools are available.
Why use it?
It helps locate where code runs, check variable values, inspect memory and registers, and investigate causes without adding Python libraries.

Command

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 commands/jzl-maker/ea-skill/debug
Clone the repo
git clone --depth 1 https://github.com/jzl-maker/EA-SKILL
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,077 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.00000 $0.03077
Opus 5 $0.00000 $0.01538
Sonnet 5 $0.00000 $0.00615
Haiku 4.5 $0.00000 $0.00308

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

Security

Grade A, and why

debug 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 yesterday.

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.

commands/debug.md · 151 lines

How it starts

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

命令: /ea debug (调试)

功能

自主调试四件套,用于「代码跑哪了 / 变量值对不对 / 根因是什么」。双后端--backend jlink(默认)或 --backend openocd(ST-Link/DAP 用,无停机监控)。

能力 命令 底层工具 依赖
RTT 打印日志 --rtt JLinkRTTLogger.exe(channel 0) J-Link
断点定位 --bp <函数名/地址> JLink Commander SetBP + halt J-Link
内存监视 --mem <变量名/地址> JLink mem32/mem8 或 OpenOCD TCL mdw/mdh/mdb J-Link 或 OpenOCD
寄存器 --regs JLink regs 或 OpenOCD TCL reg J-Link 或 OpenOCD
源码级调试(可选) --gdb JLinkGDBServerCL + arm-none-eabi-gdb + GNU 工具链

零第三方 Python 依赖:只调用 J-Link / OpenOCD 自带可执行文件。 py 是 Windows Python launcher(python 可能是 Store 假别名,勿用)。

后端选择:有 J-Link 用默认 jlink(支持全功能);只有 ST-Link/DAP 用 --backend openocd(内存/寄存器免断点实时监控——TCL mdw 运行中直读,不 halt CPU,适合 --watch 持续采样看变量变化;--rtt/--bp/--gdb 仅 jlink 后端支持)。

调用方式

# ① 探测工具链(确认 JLink/RTTLogger/GDBServer 是否可用)
py ~/.claude/skills/ea-skill/tools/jlink-debug/scripts/jlink_debug.py --detect

# ② 启动 RTT 日志抓取(先启动 logger,再触发复位,避免错过启动消息)
py .../jlink_debug.py --rtt start --log .em/logs/rtt.log
py .../jlink_debug.py --rtt stop
py .../jlink_debug.py --rtt show --log .em/logs/rtt.log --tail 50

# ③ 断点定位:函数跑哪了?(.map 符号 → SetBP → go → halt → 报告 PC/寄存器)
py .../jlink_debug.py --bp Display_BootDoraemon --run-ms 2000
py .../jlink_debug.py --bp 0x08001d28

# ④ 内存监视:变量值是多少?(符号名或地址)
py .../jlink_debug.py --mem _TimeCount_10ms            # 默认 4×32bit
py .../jlink_debug.py --mem _TimeCount_10ms --watch 5  # 持续采样 5 次
py .../jlink_debug.py --mem 0x20020228 --count 8 --width 1

# ⑤ 读寄存器
py .../jlink_debug.py --regs

# ⑥ 源码级调试(可选,需 arm-none-eabi-gdb)
py .../jlink_debug.py --gdb --elf build/app.axf --gdb-script debug.gdb

# ⑦ ST-Link/DAP 后端:内存/寄存器免断点实时监控(OpenOCD,不 halt CPU)
py .../jlink_debug.py --backend openocd --mem _TimeCount_10ms --watch 10 --interval 0.5
py .../jlink_debug.py --backend openocd --regs
# --ocd-if stlink(默认)| cmsis-dap;--ocd-target 指定 target(默认 target/stm32f4x.cfg 通用 Cortex-M4)
# OpenOCD 自动拉起/复用(先查 6666 端口,已开则复用不打扰用户进程)

# 辅助:符号表 / 地址解析(AI 先核对映射再下断点)
py .../jlink_debug.py --list-symbols Display
py .../jlink_debug.py --resolve Display_BootDoraemon

Read the full file on GitHub · 151 lines

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. yesterday First seen · 151 lines · 0 tokens per session scan A 6d4709a15238

Subscribe to this mod's changes

debug is a command published in the GitHub repository jzl-maker/EA-SKILL (4 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,077 tokens. 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-31.