Rust debugging on Windows depends heavily on the toolchain that produced your executable. CodeLLDB, the debugger bundled with the MCP Rust adapter, expects DWARF debug symbols. Rust binaries built with the GNU toolchain (x86_64-pc-windows-gnu) produce DWARF information, while the default MSVC toolchain emits PDB symbols that LLDB cannot fully interpret.
This guide covers how to identify the toolchain behind a binary, the practical impact of each option, and the quickest way to switch toolchains when you need full debugging support.
| Toolchain | Debug Symbols | Works With CodeLLDB? | Typical Experience |
|---|---|---|---|
GNU (x86_64-pc-windows-gnu) |
DWARF | ✅ Full support | Breakpoints, stepping, and variable inspection behave as expected. |
MSVC (x86_64-pc-windows-msvc) |
PDB | Breakpoints and stepping work, but string/collection variables often appear as <unavailable> or corrupted. |
Recommendation: Build Rust projects for debugging with the GNU toolchain. Use the MSVC toolchain only when you specifically need MSVC compatibility.
Use the bundled CLI command to inspect any executable before starting a session:
mcp-debugger check-rust-binary target/debug/hello_world.exeThe command inspects nearby PDB files, CodeView (RSDS) markers, and import tables to infer the toolchain. Typical output:
Binary Analysis: C:\projects\rust\target\debug\hello_world.exe
=========================================
Toolchain: MSVC
Debug Format: PDB
PDB Present: YES
RSDS Marker: YES
Runtime Dependencies:
- vcruntime140.dll
- ucrtbase.dll
Debugging Compatibility:
- ⚠️ Limited support (control flow only)
To enable full debugging, rebuild with GNU toolchain:
rustup target add x86_64-pc-windows-gnu
cargo clean
cargo +stable-gnu build
When the command reports Toolchain: GNU, the executable is ready for full CodeLLDB support.
- Install the GNU target for the stable toolchain:
rustup target add x86_64-pc-windows-gnu
- (Optional) Install the pre-built GNU toolchain for convenience:
rustup toolchain install stable-gnu
- Build with the GNU target:
cargo clean cargo +stable-gnu build
The resulting binaries (in target/debug by default) contain DWARF debug info. Re-run mcp-debugger check-rust-binary to confirm.
Tip: For scripts or CI, set
RUSTFLAGS="-C debuginfo=2"to ensure full debug symbols even if profiles are customised.
When the MCP Rust adapter detects an MSVC build:
- Breakpoints and stepping still work because CodeLLDB can control the process.
- Variable inspection becomes unreliable: strings, vectors, async state machines, and complex structs typically appear as
<variable not available>or show corrupted memory. - Session startup emits a structured warning (
MSVC_TOOLCHAIN_DETECTED) with instructions to continue with limited support or rebuild with GNU.
These issues stem from LLDB's partial support for Microsoft's PDB format. There is currently no safe or redistributable alternative debugger we can bundle, so focusing on the GNU toolchain provides the best overall experience.
Yes, but expect limited inspection. The adapter logs a warning and lets you continue if you accept the degraded experience (RUST_MSVC_BEHAVIOR=continue).
VS Code's C++ extension ships Microsoft's cppvsdbg adapter, which understands PDB files. If you must stay on MSVC, debug within VS Code instead of MCP.
No. On non-Windows platforms Rust defaults to the GNU-compatible toolchains that produce DWARF symbols, so CodeLLDB works out of the box.
Yes. Many teams build release artifacts with MSVC but keep a GNU build profile just for debugging. cargo build --target x86_64-pc-windows-gnu is usually sufficient.
mcp-debugger check-rust-binary— CLI entry point- Rust toolchain book — Installing and managing toolchains
- CodeLLDB project — Upstream debugger documentation
For other platform-specific notes, follow updates in README.md or the issue tracker.