Description
Problem
No working GDB, cannot debug rust programs.
Fresh install of rust on Windows 10 x64, running rust-gdb.exe
from the command line results in:
error: the 'rust-gdb.exe' binary, normally provided by the 'rustc' component, is not applicable to the 'stable-x86_64-pc-windows-gnu' toolchain
Steps
Either a: run rust-gdb.exe
from a command shell.
or b: launch or configure a debug session from Eclipse and observe the error message: Could not determine GDB version using command: rust-gdb --version [cause: error: the 'rust-gdb.exe' binary, normally provided by the 'rustc' component, is not applicable to the 'stable-x86_64-pc-windows-gnu' toolchain]
Notes
Though I want to eventually use Eclipse for debugging, Eclipse is nothing to do with the issue (it also happens on a fresh install on a machine with Rust, and no Eclipse), I only mention it so that other users searching for the error messages will land here too. It needs to work on the command line first, then it can be used in Eclipse.
Initially I had only the mscv
toolchain installed and the error message is similar:
error: the 'rust-gdb.exe' binary, normally provided by the 'rustc' component, is not applicable to the 'stable-x86_64-pc-windows-msvc' toolchain
However, that makes some sense, as for the msvc
toolchain there is no GDB, one must use WinDBG instead which is what VSCode uses under the hood, but for me that is not a solution as Eclipse uses GDB and is an aside to the non-working rust-gdb
for the gnu
toolchain anyway.
Output of rustup --version
:
rustup 1.24.3 (ce5817a94 2021-05-31)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.54.0 (a178d0322 2021-07-26)`
Output of rustup show
:
C:\Users\Hydra>rustup show
Default host: x86_64-pc-windows-msvc
rustup home: F:\Data\.rustup
installed toolchains
--------------------
stable-x86_64-pc-windows-gnu (default)
stable-x86_64-pc-windows-msvc
active toolchain
----------------
stable-x86_64-pc-windows-gnu (default)
rustc 1.54.0 (a178d0322 2021-07-26)
Eclipse 2021-06. Eclipse IDE for C/C++ Developers 4.20.0.20210612-1200 epp.package.cpp Eclipse Packaging Project
Corrosion: Corrosion: Rust edition in Eclipse IDE 1.2.1.202106081156 org.eclipse.corrosion.feature.feature.group Eclipse Corrosion
Other users have had this issue:
https://users.rust-lang.org/t/not-able-to-open-rust-gdb-in-windows/50331/3
https://users.rust-lang.org/t/rust-gdb-and-windows/58168
Other related references:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=119600
https://www.brycevandyk.com/debug-rust-on-windows-with-visual-studio-code-and-the-msvc-debugger/
https://sourceware.org/gdb/current/onlinedocs/gdb/Rust.html#Rust
https://bitshifter.github.io/rr+rust/index.html#1