debug

A command for starting a GDB debugging session for embedded firmware, software that runs on devices such as microcontrollers. GDB is a debugger, while OpenOCD and probe-rs connect it to hardware.

In plain words
What is it for?
Use it to debug embedded projects, set breakpoints by address or symbol, choose a probe, and launch OpenOCD, J-Link, or probe-rs.
Why use it?
It finds the available hardware-debugging tool and firmware file, then starts the appropriate debugging setup instead of requiring those steps manually.

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/captainluzik/oh-my-embedded/debug
Clone the repo
git clone --depth 1 https://github.com/captainluzik/oh-my-embedded
Per session 13 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 869 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.00013 $0.00869
Opus 5 $0.00006 $0.00434
Sonnet 5 $0.00003 $0.00174
Haiku 4.5 $0.00001 $0.00087

Measured 2d ago against content hash 79f801cff7b5, 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 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.

commands/debug.md · 121 lines

How it starts

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

Set up and launch a GDB debug session for the current embedded project.

Arguments

$ARGUMENTS may contain:

  • A target address or symbol to break on (e.g. app_main, 0x40080000).
  • A probe type override: openocd, jlink, or probe-rs.
  • A config file path for OpenOCD (e.g. openocd.cfg).

Step 1: Detect the debug probe

Check which tools are available:

which openocd
which JLinkGDBServer
which probe-rs

Also check for config files in the project root:

  • openocd.cfg or any *.cfg file referencing a target.
  • .cargo/config.toml with runner = "probe-rs" (Rust/probe-rs projects).

If $ARGUMENTS specifies a probe type, use that. Otherwise pick the first available tool.

Step 2: Find the firmware binary

Look for the ELF file:

  • ESP-IDF: build/<project_name>.elf
  • PlatformIO: .pio/build/<env>/<project_name>.elf
  • CMake generic: build/*.elf
  • Cargo/probe-rs: target/<target-triple>/debug/<binary>

If multiple ELF files exist, list them and ask the user to confirm which one to use.

Step 3: Start the GDB server

OpenOCD

openocd -f openocd.cfg

If no openocd.cfg exists, try common board configs:

# ESP32
openocd -f board/esp32-wrover-kit-3.3v.cfg

# STM32 with ST-Link
openocd -f interface/stlink.cfg -f target/stm32f4x.cfg

# Generic CMSIS-DAP
openocd -f interface/cmsis-dap.cfg -f target/stm32f4x.cfg

Run OpenOCD in the background. Default GDB port is 3333.

J-Link

JLinkGDBServer -device <chip> -if SWD -speed 4000 -port 2331

Replace <chip> with the detected or user-specified target.

probe-rs

probe-rs gdb --chip <chip> <elf-file>

Step 4: Connect GDB

Use arm-none-eabi-gdb, xtensa-esp32-elf-gdb, or gdb-multiarch depending on the target architecture.

arm-none-eabi-gdb <elf-file> \
  -ex "target extended-remote :3333" \
  -ex "monitor reset halt" \
  -ex "load" \
  -ex "monitor reset init"

If $ARGUMENTS contains a target address or symbol, append:

  -ex "break $ARGUMENTS"
  -ex "continue"

Read the full file on GitHub · 121 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. 2d ago First seen · 121 lines · 13 tokens per session scan A 79f801cff7b5

Subscribe to this mod's changes

debug is a command published in the GitHub repository captainluzik/oh-my-embedded (23 stars, last pushed 6mo ago), licensed MIT. It adds 13 tokens to every session and 869 once invoked, about $0.0001 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 commands, from other repositories

hardware-specs

Read this before writing any code that touches peripherals, memory, Wi-Fi, camera, or audio. All GPIO and address numbers below are verified against the vendor BSP (ref/demo/ESP32-S3-CAM-OVxxxx/examples/ESP-IDF-v5.5.1/04dvpcameradisplay/components/waveshareesp32s3camovxxxx/include/bsp/esp32s3camovxxxx.h) and this…

chayuto/ws-ESP32-S3-CAM · 0 tokens

monitor

Command "monitor" from chayuto/ws-ESP32-S3-CAM, covering read serial output from the board, fix 1 — stty -hupcl + dd (works reliably), fix 2 — pyserial but set dtr/rts before open, optional: pulse rts only to reset without touching dtr and healthy read (once the dtr trap is avoided).

chayuto/ws-ESP32-S3-CAM · 0 tokens

peripherals

Use the vendor BSP waveshare/esp32s3camovxxxx for anything nontrivial. It hides the CH32V003 IO-expander quirks, I²C bus init, camera pin config, and codec addresses. Header: ref/demo/ESP32-S3-CAM-OVxxxx/examples/ESP-IDF-v5.5.1/04dvpcameradisplay/components/waveshareesp32s3camovxxxx/include/bsp/esp32s3camovxxxx.h.

chayuto/ws-ESP32-S3-CAM · 0 tokens

safe-dev

Use this flow when adding a new subsystem (new task, new driver, new Kconfig symbol). Every crash we've had in this project came from skipping one of these checks. Usage: /safe-dev .

chayuto/ws-ESP32-S3-CAM · 0 tokens

audit-wavs

Run the full offline audit pipeline on a directory of cry-detect-01 event WAVs. Produces numeric manifests, per-file spectrogram PNGs, and YAMNet FP32 oracle labels — no human listening required.

chayuto/ws-ESP32-S3-CAM · 0 tokens

build

Activate ESP-IDF v5.5.3+ and build out-of-tree. Usage: /build.

chayuto/ws-ESP32-S3-CAM · 0 tokens