Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not debug, lldb #18535

Closed
nephi-dev opened this issue Nov 19, 2024 · 14 comments
Closed

Could not debug, lldb #18535

nephi-dev opened this issue Nov 19, 2024 · 14 comments
Labels
C-bug Category: bug

Comments

@nephi-dev
Copy link

nephi-dev commented Nov 19, 2024

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
rust-analyzer version: 0.3.2188-standalone (ba56d9b 2024-11-17) [c:\Users\matth.vscode\extensions\rust-lang.rust-analyzer-0.3.2188-win32-x64\server\rust-analyzer.exe]
rustc version: (eg. output of rustc -V)
rustc 1.82.0 (f6e511eec 2024-10-15)
editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable)
VSCode
relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)
...
repository link (if public, optional): (eg. rust-analyzer)
...
code snippet to reproduce:
Could not find LLDB data formatters in your Rust toolchain, and after installing it, the same message appears again

@nephi-dev nephi-dev added the C-bug Category: bug label Nov 19, 2024
@nephi-dev
Copy link
Author

it starts the debug, and another message shows, This version of LLDB has no plugin for the language "rust". Inspection of frame variables will be limited.

@lnicola
Copy link
Member

lnicola commented Nov 21, 2024

Which debugging extension are you using?

@nephi-dev
Copy link
Author

with rust-analyzer, only codelldb

@josephgruber-umbra
Copy link

josephgruber-umbra commented Nov 21, 2024

Just here to add, I’m also seeing this issue. Also using rust-analyzer/CodeLLDB

@Mettwasser
Copy link

I'm having the exact same issue.

@VincePayne42
Copy link

Also having this issue

@birne67
Copy link

birne67 commented Nov 27, 2024

Me as well.

@luppy
Copy link

luppy commented Dec 2, 2024

+1
I guess it has to be a new issue as this page was the one and only hit when I googled it.

@gbegerow
Copy link

gbegerow commented Dec 3, 2024

+1 VSCode, CodeLLDB, Rust nightly, Full Visual Studio 2022 installed.

Loading Rust formatters from C:\Users\gbegerow.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/etc
Could not find LLDB data formatters in your Rust toolchain. Consider installing the x86_64-pc-windows-gnu target by running rustup target add x86_64-pc-windows-gnu.

Maybe this is a conflict between LLDB and MSVC toolchain?

@Robo210
Copy link

Robo210 commented Dec 3, 2024

As a workaround, copying the files from the windows-gnu\lib\rustlib\etc toolchain directory to the windows-msvc\lib\rustlib\etc directory makes the warning go away.

@Veykril
Copy link
Member

Veykril commented Dec 3, 2024

That sounds like a toolchain issue, not a rust-analyzer issue. We don't do anything special for debuggers (aside from providing a runner task). Especially given it seems to work with the gnu toolchain, so to me that sounds like the msvc toolchain isn't shipping necessary files

@Veykril
Copy link
Member

Veykril commented Dec 3, 2024

Ah, https://github.com/vadimcn/codelldb/wiki/Windows#debugging-rust-on-windows talks about this, quoting:

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 add 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": "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.

I'll close this as this is not a rust-analyzer issue

@Veykril Veykril closed this as completed Dec 3, 2024
@Veykril Veykril closed this as not planned Won't fix, can't repro, duplicate, stale Dec 3, 2024
@tanveerbadar
Copy link

"lldb.script": { "lang.rust.toolchain": "x86_64-pc-windows-gnu" }

No longer works.

@Veykril
Copy link
Member

Veykril commented Feb 7, 2025

Looks like rust-lang/rust#133737 should fix this generally, so with 1.85 and forward debugging should work on msvc again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests