一键导入
debugger
Embedded debugging skill using CmBacktrace + GDB for crash log analysis, symbolication, GDB session management, and Cortex-M hardfault analysis
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Embedded debugging skill using CmBacktrace + GDB for crash log analysis, symbolication, GDB session management, and Cortex-M hardfault analysis
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Universal Embedded Knowledge Framework for Ankh Agent - recognizes embedded frameworks, maps domains, and applies native-first patterns
Universal Embedded Knowledge Framework for AI Coding Agents - recognizes embedded frameworks, maps domains, and applies native-first patterns
Universal Embedded Knowledge Framework for Hermes Agent - recognizes embedded frameworks, maps domains, and applies native-first patterns
基于 SOC 职业分类
| name | debugger |
| description | Embedded debugging skill using CmBacktrace + GDB for crash log analysis, symbolication, GDB session management, and Cortex-M hardfault analysis |
| trigger | **/*.c, **/*.h, **/*.elf, **/*.map, **/*.log, crash log, hardfault, gdb session |
This skill covers embedded debugging using CmBacktrace and GDB for Cortex-M based MCUs. It provides structured workflows for crash log collection, address symbolication, GDB session management, and hardfault analysis.
Activate this skill when the user mentions:
debug, crash, hardfault, cmbacktrace, gdbbacktrace, stack overflow, fault analysisaddr2line, Cortex-M fault registers, OpenOCD, J-Linkcall stack, crash log, verify call stack"I need to debug a crash on an embedded Cortex-M system. I have a CmBacktrace crash log / GDB session log. Can you help me analyze it and identify the root cause?"
.elf file used for symbolicationExtract from the crash log:
For each address in the call stack:
arm-none-eabi-addr2line -e firmware.elf -f <address>
This converts raw addresses to function_name + file:line_number.
info registers with crash log registersbacktrace / bt output to verify call stack matchesx/100x <sp> to dump stack memory around stack pointerOutput the analysis in the requested format:
cmbacktrace_report.mdgdb_session_report.mdWARNING: Read-only commands only on live hardware.
When connected to live hardware via J-Link, OpenOCD, or ST-Link:
info registers, backtrace, x/100x <addr>, print <var> disassemble, info breakpoints, info threadsset, delete, break, continue, run, step on production systemsFor post-mortem analysis (crash logs, ELF files, offline analysis):
arm-none-eabi-addr2line, arm-none-eabi-objdump freelycmbacktrace_report.md)# CmBacktrace Crash Analysis Report
## Device Information
- MCU: STM32F407VG (Cortex-M4)
- Firmware: firmware.elf
- Toolchain: ARM GCC 10.3.1
## Fault Information
- Fault Type: HardFault
- Timestamp: 2024-01-15 14:23:45
## Register Dump
| Register | Value |
|----------|-------|
| R0 | 0x20001234 |
| R1 | 0x00000000 |
| ... | ... |
## Call Stack (Symbolicated)
| # | Address | Location |
|---|---------|----------|
| 0 | 0x08001234 | main.c:125 `app_main` |
| 1 | 0x08003456 | sensor.c:89 `sensor_read` |
## Fault Analysis
- Root cause: Stack overflow in `sensor_read()` (sensor.c:89)
- Recommendation: Increase stack size for sensor task
## Raw Crash Log
<include raw log>
gdb_session_report.md)# GDB Session Analysis Report
## Session Info
- Target: STM32F407VG via J-Link
- ELF: firmware.elf
- GDB Command Log: gdb_session.log
## Register Correlation
| GDB Value | Crash Log Value | Match |
|-----------|-----------------|-------|
| R0 = 0x20001234 | R0 = 0x20001234 | ✓ |
## Backtrace Comparison
| Frame | GDB | Crash Log | Status |
|-------|-----|-----------|--------|
| #0 | main.c:125 | main.c:125 | ✓ |
| #1 | sensor.c:89 | sensor.c:89 | ✓ |
## Stack Analysis
- Stack pointer (MSP): 0x20003FFC (valid RAM range)
- Stack content near SP: [normal values, no corruption detected]
## Conclusions
- Call stack verified: matches crash log exactly
- No evidence of stack corruption
- Root cause confirmed: NULL pointer dereference in sensor_read()
domains/debugging/cmbacktrace.md — CmBacktrace library usagedomains/debugging/hardfault.md — Cortex-M fault exception handlingdomains/debugging/gdb.md — GDB commands and configurationdomains/debugging/crash_log_analysis.md — Crash log parsingdebug/cmbacktrace_workflow.md — Step-by-step CmBacktrace workflowdebug/templates/cmbacktrace_report.md — Report templatedebug/templates/gdb_session_report.md — GDB report templatedebug/gdb_safety_policy.md — Safety rules for live debuggingdebug/gdb_commands/stm32_hardfault.gdb — GDB script for HardFault analysis