M3: dual backend (probe-rs + OpenOCD) + AI crash diagnosis (0.3.0) - #4
Merged
Conversation
…agnose_fault M3 slice 1: DebugBackend trait unifies probe-rs and OpenOCD (GDB RSP) behind one MCP tool set. Memory/target-control/breakpoint tools route through the backend; flash/RTT stay probe-rs-only. Add diagnose_fault aggregating SCB fault registers into one compact structured evidence bundle. connect gains backend/openocd_address args. 23 tools; unit tests for RSP codec and fault decode. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Update SKILL.md and README (en/zh): add Backends section (probe-rs default, OpenOCD experimental via GDB RSP, not yet hardware-validated), diagnose_fault tool, and diagnose_fault step in the MCP workflow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
probe-rs backend returns a full DWARF backtrace via probe-rs own unwinder (DebugInfo::unwind); OpenOCD backend reads the Cortex-M exception stack frame and maps faulting PC / caller LR to source lines via DebugInfo::get_source_location. Compact JSON frames. DebugInfo (!Send) is confined to synchronous blocks to keep the tool future Send. Pure EXC_RETURN decode is unit-tested. Docs updated (SKILL, README en/zh). 24 tools. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ackend Spins up a local TCP server speaking minimal GDB RSP and drives OpenOcdBackend end-to-end (connect, read/write memory, register read, status, monitor halt/run, breakpoints) — verifies the RSP protocol wiring without any hardware. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drives OpenOcdBackend against a running openocd GDB server and prints each op (connect/halt/status/read/reg/run). Used to validate the RSP wiring on real hardware (ESP32-S3 via openocd-esp32). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Real ESP32-S3 smoke (openocd-esp32) confirmed the OpenOCD backend: connect/halt/run/status/read_memory work; core_reg returns 0 on Xtensa (ARM gdb reg numbers). Document the required gdb_memory_map disable openocd flag (else it rejects the gdb connection) and the Xtensa register limitation; add a TODO in reg_number. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…sions) Add: Fetch authoritative info yourself (tiered sources: target self-description > ELF/DWARF > datasheet method > ARM arch registers) and Know your versions (probe-rs / openocd fork+flags / probe firmware). The skill points to sources of truth instead of embedding static chip tables — aligns with the flagship-model, save-context, do-not-over-teach philosophy. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…stic) esp32-s3 Xtensa exposes no register map in the GDB target description, but openocd resolves register names. Read PC/SP/LR by candidate names (pc; sp|a1; lr|ra|a0) via monitor reg <name> and parse the value, instead of hardcoded ARM gdb register numbers. Fixes core_reg returning 0 on Xtensa. parse_reg_value + updated mock unit-tested. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rdware openocd returns monitor (qRcmd) output as a single hex-encoded packet (no O prefix, no trailing OK). Our monitor() returned it raw, so core_reg parsing failed on the ESP32-S3. Hex-decode the final qRcmd result. Mock updated to the real openocd reply form (a regression the O-packet mock previously masked). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Update the stale ARM-reg-number note now that core_reg reads by name via monitor reg and PC/SP/LR are verified correct on real ESP32-S3. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bump version to 0.3.0, sync Cargo.lock, add CHANGELOG. OpenOCD backend validated on real ESP32-S3; probe-rs backend and diagnose_fault/unwind reuse probe-rs tested code. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…h diagnosis) Update README intro / What It Provides / Architecture (en+zh) and Cargo.toml description + keywords to reflect the dual backend (probe-rs/OpenOCD), Xtensa/ESP32, and crash-diagnosis tools. Earlier edits only touched the Backends section and tool tables. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Document openocd as an alternative to a probe-rs probe, and add a Crash Diagnosis section showing the halt -> diagnose_fault -> unwind_exception flow with its Cortex-M scope and debug-info requirement. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a dual debug backend behind a single
DebugBackendtrait —probe-rs(default, native) andopenocd(via the GDB Remote Serial Protocol) — plus AI-facing crash diagnosis. The AI sees one tool set; the backend is chosen atconnect. 24 tools total. Bumps to0.3.0.What's in it
src/backend/:DebugBackendtrait +ProbeRsBackend+OpenOcdBackend(minimal GDB-RSP client inrsp.rs).diagnose_fault: aggregates the Cortex-M SCB fault registers (CFSR/HFSR/MMFAR/BFAR/SHCSR/CPUID) + PC/SP/LR into one compact structured evidence bundle.unwind_exception: full DWARF backtrace on probe-rs; Cortex-M exception-frame read + source mapping on OpenOCD.CHANGELOG.md, and anopenocd_smokeexample.Validation
clippy -D warningsclean,cargo doc -D warningsclean,cargo packagebuilds.Honest caveat
diagnose_fault/unwind_exceptionand the probe-rs path are unit-tested and reuse probe-rs's own tested DWARF/register code, but have not yet been run on a physical Cortex-M crash. Follow-up: a Cortex-M hardware smoke (0.3.1).Merge
Clean fast-forward from
main, no conflicts.🤖 Generated with Claude Code