/rust:debuggingfrom rust
Use when debugging a Rust program, test, or proc macro at runtime, covering debug info profiles, CodeLLDB sessions, panic and abort stops, values and expressions, breakpoints on Rust names, async tasks, undefined behavior checks, and optimized builds
Ships in rust. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Covers Rust programs, test binaries, and code rustc loads, under CodeLLDB with rustc's formatters. Use tool:debugging for the method, session answers, hangs, and crash reports. Use rust:testing for test runs.
[REFERENCES]:
Debug info of a profile decides what a stop reads:
| [INDEX] | [PROFILE] | [STOP_READS] |
|---|---|---|
| [01] | dev, test under nightly Cargo | Files and lines, no locals or types |
| [02] | dev, test under stable Cargo | Locals, parameters, and types |
| [03] | debug | Locals, parameters, and types |
| [04] | release | Symbols alone, see references/optimized.md |
Built-in profile debug inherits dev with debug = true and writes into dev's folder, so target/debug/<bin> is whichever profile built last:
cargo build --profile debug builds it once, and build.profile = "debug" in .cargo/config.toml makes cargo build and cargo test take itcargo nextest takes it as --cargo-profile debug, as its own --profile names a nextest profileProgram and test binary paths come from Cargo, as target-dir, build-dir layouts, and profiles move them:
cargo build --profile debug -p <package> --bin <bin> --message-format=json | jq -r 'select(.reason == "compiler-artifact" and .executable != null) | .executable'
cargo nextest list --cargo-profile debug -p <package> --message-format json -E 'test(=<test>)' | jq -r '."rust-suites"[] | select(any(.testcases[]; ."filter-match".status == "matches")) | "\(."binary-path") \(.cwd)"'
Stops of a build without variable info read alike: frames named without their crate path (main in place of <crate>::main), no local row, and evaluate answering Expression evaluation in Rust not supported with use of undeclared identifier. Rebuild under debug and launch again.
| [INDEX] | [QUESTION] | [ROUTE] |
|---|---|---|
| [01] | Why a program takes a path or holds a value | Launch [03] |
| [02] | Why one test fails or hangs | Test binary [03] |
| [03] | What a running program does | Attach [03] |
| [04] | Where a panic or abort starts | Launch, stop of [04] |
| [05] | What Rust cannot catch foreign exceptions, aborting hides | Objective-C throw [04] |
| [06] | Which task waits, or why a task never resumes | Async [07] |
| [07] | Whether unsafe code or shared state is at fault | Read references/checks.md |
| [08] | Why an optimized or installed build reads wrong | Read references/optimized.md |
| [09] | Why a build script, proc macro, or lint library misbehaves | Read references/compiler.md |
Programs launch by the path Cargo printed, cwd the package folder, and env {"RUST_BACKTRACE": "1"}:
Loading Rust formatters from <sysroot>/lib/rustlib/etc names the toolchain that prints values/rustc/<hash> of the project's rustc to its rust-srcTest binaries launch from the binary-path and cwd nextest listed, args ["--exact", "<test>", "--nocapture"]:
running 1 test, and running 0 tests -> pass the name nextest listedrust_panic, the test's frame named <crate>::<module>::<test>, and output holds left: and right:NEXTEST_*) run under nextest's wrapper, as it lifts capture and time limits for one test:cargo nextest run --cargo-profile debug -p <package> -E 'test(=<test>)' --debugger "rust-lldb --batch -o 'breakpoint set -n rust_panic' -o run -o 'thread backtrace -c 30' --"
PASS or FAIL there reports the debugger's exit, never the test's.
Attaches take the program's own pid, never cargo or a runner parent, read by ps -o pid,ppid,command -p <pid>, and resume pause stops it with system frames above the program's.
Sessions arm exception filter rust_panic:
__rustc::rust_panic, the hook's message already in output<crate>:: frame below core::panicking, indexing, and assert_failed framescatch_unwind, a test harness, or a task runtime, and a returned Err never stopsbreakpoints exceptions [] lets a panic unwind to exit code 101unsafe precondition(s) violated) print thread caused non-unwinding panic. aborting. and stop on signal SIGABRTread threads lists other threadsRUST_BACKTRACE (1, full) governs panic output, RUST_LIB_BACKTRACE overrides it for Backtrace::capture, and each process reads them onceObjective-C exceptions abort a Rust program with fatal runtime error: Rust cannot catch foreign exceptions, aborting and no Rust frame naming them. Launch with functions objc_exception_throw, and at the stop repl po $x0 prints the exception's reason ($rdi on x86_64), frame 1 names its method, and a <crate>:: frame below called it.
Locals print through rustc's formatters: size=<n> for collections, strong=<n>, weak=<n> for Rc and Arc, Some(<value>) and <Variant>(<fields>) for enums. Reads past a summary take these calls:
read value opens one: [<index>] entries of a collection, child value of a smart pointer, [raw] its own layoutevaluate takes CodeLLDB's simple expressions: paths, fields, indexing (names[1]), arithmetic, comparisonsnote = Some((3, 4)), read value opens child 0 at each level and evaluate /py $note[0][0] returns 3Syntax error, members Attribute '<name>' is not defined, and *<rc> <error: invalid value object>/nat <expression> runs LLDB's C++ evaluator over fields and casts, and Rust syntax beyond them fails{<expression>} holes take simple expressions, and logpoint text arrives as [console] outputstep_out answers the returned value as local [return value]repl takes ?<expression> for one CodeLLDB expression beside LLDB commands.
Rust names and lines bind as frames print them:
<crate>::<module>::<fn>, or an instantiation (<crate>::<fn>::<u32>)/re ^<crate>::<fn> binds every instantiation and closure of a functionmain binds the C entry point first, and <crate>::main binds the Rust one aloneprintln!, format!, vec!) bind a location per expansion part and stop at each, and next leaves the lineasync fn lines stop where a caller builds the future, and body statements stop when a task polls itstep_in skips std, core, and alloc frames, as CodeLLDB sets target.process.thread.step-avoid-regexprepl settings set target.process.thread.step-avoid-regexp '' lets step_in enter themAsync code runs as futures a runtime polls:
.await land in <crate>::<fn>::{closure#0} on a runtime worker thread, with locals kept across the await and _task_contexttokio::runtime::task::harness::poll_future), so read top frames of one thread.await replaces a step over itHandle::dump, awaited inside its runtime under tokio::time::timeout, lists every task with its await chain for the program to printHandle::dump exists on Linux in builds with --cfg tokio_unstable, tokio feature taskdump, and split-debuginfo = "off"Could not find LLDB data formatters -> launch again under the program's toolchain
"settings": {"_adapterSettings": {"scriptConfig": {"lang": {"rust": {"toolchain": "<toolchain>"}}}}}external, no source -> another rustc built the program, strings <program> | rg -o -m1 '/rustc/[0-9a-f]{40}' names its hash
"settings": {"sourceMap": {"/rustc/<hash>": "<sysroot of that toolchain>/lib/rustlib/src/rust"}}pending with Resolved locations: 0 -> name differs from the printed path, take the /re formexternal, no source -> [profile.<profile>.package.<crate>] debug = "full", rebuildreferences/checks.md before blaming the optimizercargo nextest run -p <package> -E 'test(=<test>)' passes outside the debuggerreferences/checks.md that found itWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub bsamiee/rasm --plugin rust3 skills in this plugin
/codingUse when writing or reviewing Rust, covering functional design with algebraic types, results, traits, and async effects/testingUse when writing, editing, fixing, strengthening, pruning, or grading Rust tests, covering flaky tests, fixtures, rstest, proptest, insta, nextest, doubles, real services, and cargo-mutantsOther plugins' skills for the same job