Skip to content

Windows

vadimcn edited this page Dec 4, 2024 · 14 revisions

Debug Information Formats

On Windows, there are two ABIs in common use, each with a specific native debug information format: the "MSVC" ABI, used by Microsoft toolchains with the PDB debug information format, and the "GNU" ABI, which originated from Unix toolchains like GCC and LLVM, utilizing the DWARF debug information format.

LLDB supports both formats; however, PDB support remains inferior to DWARF and may be buggy, potentially causing debugger crashes. For this reason, using DWARF (and therefore, the GNU ABI) is recommended whenever possible.

Debugging Rust on Windows

The default toolchain installed on Windows by Rustup is the x86_64-pc-windows-msvc toolchain. This toolchain does not include Rust-specific formatters for LLDB, as it is assumed that users will primarily use WinDbg or Microsoft Visual Studio's debugger for this target.

If you prefer to use CodeLLDB for debugging, you have two options:

  1. Use the x86_64-pc-windows-gnu toolchain to compile your Rust project: This option ensures full LLDB visualization support for Rust types.

  2. Compile with the x86_64-pc-windows-msvc toolchain but use LLDB formatters from x86_64-pc-windows-gnu: To use this option, install the x86_64-pc-windows-gnu toolchain via rustup toolchain install stable-x86_64-pc-windows-gnu. Then, configure CodeLLDB to load its formatters by adding the following entry to your workspace configuration: "lldb.script": { "lang.rust.toolchain": "stable-x86_64-pc-windows-gnu" }

    Note that this setup is less ideal due to differences in the debug information layout emitted by the Rust compiler for enum data types when targeting MSVC, which means enums may not be visualized correctly. However, LLDB formatters will work for standard collections like strings and vectors.

For more information on Rust toolchains for Windows, see the Rustup Installation Guide for Windows.

WSL Compatibility

CodeLLDB works in WSL2 instances but not in WSL1, as it does not implement certain syscalls required by LLDB.