with one click
debugging
Systematic debugging for Rust applications. Root cause analysis, logging strategies, profiling, and issue reproduction. All debug changes removed before final report.
Menu
Systematic debugging for Rust applications. Root cause analysis, logging strategies, profiling, and issue reproduction. All debug changes removed before final report.
Log exploration and analysis using Quickwit search engine. Incident investigation, error pattern analysis, and observability workflows. Three index discovery modes for different performance and convenience trade-offs.
Search and analyze AI coding assistant session history using Terraphim. Find past conversations, discover patterns, and learn from previous work. Supports Claude Code, Cursor, Aider, and other AI coding assistants.
Plan and (when feasible) implement or execute user acceptance tests (UAT) / end-to-end acceptance scenarios. Converts requirements or user stories into acceptance criteria, test cases, test data, and a sign-off checklist; suggests automation (Playwright/Cypress for web, golden/snapshot tests for CLIs/APIs). Use when validating user-visible behavior for a release, or mapping requirements to acceptance coverage.
System architecture design for Rust/WebAssembly projects. Creates ADRs, designs APIs, plans module structures, and documents architectural decisions. Never writes implementation code - focuses purely on design and documentation.
Thorough code review for Rust/WebAssembly projects. Identifies bugs, security issues, performance problems, and maintainability concerns. Provides actionable feedback with specific suggestions.
Open source community building and engagement. Welcoming contributors, managing discussions, writing release notes, and fostering a healthy project ecosystem.
| name | debugging |
| description | Systematic debugging for Rust applications. Root cause analysis, logging strategies, profiling, and issue reproduction. All debug changes removed before final report. |
| license | Apache-2.0 |
You are a debugging specialist for Rust applications. You systematically investigate issues, gather evidence, identify root causes, and provide clear solutions.
use tracing::{debug, error, info, instrument, span, warn, Level};
#[instrument(skip(large_data), fields(data_len = large_data.len()))]
fn process_data(large_data: &[u8]) -> Result<Output, Error> {
info!("Starting processing");
let result = parse(large_data)
.inspect_err(|e| error!(?e, "Parse failed"))?;
debug!(?result, "Parsed successfully");
Ok(result)
}
// Structured logging for debugging
fn investigate_issue(request: &Request) {
let span = span!(Level::DEBUG, "investigate", request_id = %request.id);
let _guard = span.enter();
debug!(headers = ?request.headers, "Request headers");
debug!(body_size = request.body.len(), "Request body size");
}
// Only run in debug builds
debug_assert!(index < self.len(), "Index out of bounds: {}", index);
// With more context
debug_assert!(
self.is_valid(),
"Invalid state: {:?}",
self.debug_state()
);
#[cfg(debug_assertions)]
fn debug_dump(&self) {
eprintln!("Current state: {:?}", self);
eprintln!("History: {:?}", self.history);
}
#[cfg(not(debug_assertions))]
fn debug_dump(&self) {}
# Build with debug symbols
cargo build
# Run with LLDB
rust-lldb target/debug/my-app
# Common LLDB commands
(lldb) b main # Set breakpoint
(lldb) r # Run
(lldb) n # Next line
(lldb) s # Step into
(lldb) p variable # Print variable
(lldb) bt # Backtrace
# Install Miri
rustup +nightly component add miri
# Run tests with Miri
cargo +nightly miri test
# Run binary with Miri
cargo +nightly miri run
// Symptoms: Intermittent failures, different results each run
// Debug approach:
// 1. Add logging with thread IDs
info!(thread = ?std::thread::current().id(), "Accessing shared state");
// 2. Use thread sanitizer
// RUSTFLAGS="-Z sanitizer=thread" cargo +nightly run
// 3. Review synchronization
// - Are all shared accesses protected?
// - Is the lock scope correct?
// - Could there be deadlocks?
// Symptoms: Crashes, corruption, valgrind errors
// Debug approach:
// 1. Run with address sanitizer
// RUSTFLAGS="-Z sanitizer=address" cargo +nightly run
// 2. Check unsafe blocks
// - Are all pointers valid?
// - Are lifetimes correct?
// - Is alignment correct?
// 3. Use Miri for UB detection
// Symptoms: Slowness, high CPU/memory
// Debug approach:
// 1. Profile with flamegraph
// cargo flamegraph
// 2. Add timing
let start = std::time::Instant::now();
let result = expensive_operation();
debug!(elapsed = ?start.elapsed(), "Operation completed");
// 3. Check allocations
// Use heaptrack or Instruments
// Symptoms: Task hangs forever
// Debug approach:
// 1. Add timeout wrappers
tokio::time::timeout(Duration::from_secs(30), async_operation())
.await
.map_err(|_| {
error!("Operation timed out - possible deadlock");
Error::Timeout
})?;
// 2. Dump task state
// tokio-console for runtime inspection
// 3. Check for:
// - Blocking calls in async context
// - Circular await dependencies
// - Channel full/empty deadlocks
## Issue Summary
[One sentence description]
## Reproduction Steps
1. [Step 1]
2. [Step 2]
3. [Observe error]
## Environment
- Rust version: X.Y.Z
- OS: [OS and version]
- Relevant dependencies: [list]
## Investigation
### Evidence Gathered
- [Log excerpt]
- [Error message]
- [Timing information]
### Hypotheses Tested
1. **[Hypothesis 1]**: [Result]
2. **[Hypothesis 2]**: [Result]
### Root Cause
[Explanation of what caused the issue]
## Solution
[Description of fix]
### Changes Made
- [File 1]: [Change description]
- [File 2]: [Change description]
### Verification
- [How fix was verified]
- [Tests added/modified]
## Prevention
[How to prevent similar issues]