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

Debug functionalilty broken in VS code on MacOS #16901

Closed
git-luke opened this issue Mar 20, 2024 · 16 comments · Fixed by #16964
Closed

Debug functionalilty broken in VS code on MacOS #16901

git-luke opened this issue Mar 20, 2024 · 16 comments · Fixed by #16964
Assignees
Labels
Broken Window Bugs / technical debt to be addressed immediately C-bug Category: bug

Comments

@git-luke
Copy link

git-luke commented Mar 20, 2024

rust-analyzer version: 0.3.1885-standalone (b6d1887 2024-03-17)
Issue also occurs on 0.3.1877-standalone (574e23e 2024-03-09)
Does not occur on previous versions.

rustc version: rustc 1.73.0 (cc66ad468 2023-10-03)

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

  • MacOS 14.3.1 with Apple M1 Pro
  • VS Code Version: 1.87.1 (Universal)
  • CodeLLDB v1.10.0
  • No configurations in launch.json:
{
    "version": "0.2.0",
    "configurations": []
}

Running any #[test] > Debug results in popup:
"Unable to start debugging. Launch options string provided by the project system is invalid. Unable to determine path to debugger. Please specify the "MIDebuggerPath" option."

  • No change in any setting other than updating the rust-analyzer extension to one of the two versions above triggers this issue.
  • No problems on rust-analyzer version: 0.3.1868-standalone (037924c 2024-03-03) or lower.

repository link (if public, optional): -

code snippet to reproduce:

#[test]
// any test

Thank you for investigating!

@git-luke git-luke added the C-bug Category: bug label Mar 20, 2024
@git-luke git-luke changed the title Debug functionalilty broken in VS code Debug functionalilty broken in VS code on MacOS Mar 20, 2024
@trueb2
Copy link

trueb2 commented Mar 21, 2024

This was confusing since there was no setting change and the error message is misleading. Downgrading the VS Code extension allowed debugging again.

  • MacOS 14.4
  • VS Code 1.87.1 (Universal)
  • CodeLLDB v1.10.0.

I can confirm as well that 0.3.1868 and earlier are working. All debugging is broken on and after v0.3.1877

@yayanyang
Copy link

The same thing happened to me.

1 similar comment
@pmq20
Copy link

pmq20 commented Mar 25, 2024

The same thing happened to me.

@Veykril Veykril added the Broken Window Bugs / technical debt to be addressed immediately label Mar 25, 2024
@roife
Copy link
Contributor

roife commented Mar 25, 2024

This issue cannot be reproduced on my machine (M3 Max, macOS 14.3.1). If the problem was introduced by v0.3.1877, could it be related to commit a01e4f8 (#16719)?

@akrylysov
Copy link

akrylysov commented Mar 28, 2024

Seeing same issue and I can confirm that downgrading to v0.3.1868 solves it.

@NateAGeek
Copy link

Agree, somehow downgrading to v0.3.1868 resolved it.

@roife
Copy link
Contributor

roife commented Mar 28, 2024

Oh, I'm able to reproduce this issue now. This problem only occurs when users have the C++ plugin installed. (This explains why I couldn't reproduce it before.)

@rustbot claim

@lnicola
Copy link
Member

lnicola commented Mar 28, 2024

This might be #16719. The C/C++ extension seems to work for me on Linux, but indeed, I get an empty launch.json.

@lnicola
Copy link
Member

lnicola commented Mar 28, 2024

Actually no: I reverted #16719 and get the same behavior:

  • F5: doesn't work: "program 'enter program name, ...'" does not exist
  • Debug lens on main: works, doesn't create launch.json
  • rust-analyzer: Debug command: takes a couple of tries ("looking for runnables"), then works, still doesn't create launch.json

@roife
Copy link
Contributor

roife commented Mar 28, 2024

In #16719, the order of the debugger changed, prioritizing "ms-vscode.cpptools", which resulted in the error. However, debugging with codelldb still works fine even without generating a launch.json file.

@lnicola
Copy link
Member

lnicola commented Mar 28, 2024

Oh 🤦. I didn't expect anyone to have multiple debugging extensions, but it makes sense with the C++ one.

@roife
Copy link
Contributor

roife commented Mar 28, 2024

The C++ extension seems unable to debug Rust projects on Mac. This doesn't seem to be an issue related to multiple debugging extensions, as it doesn't work even when codelldb is not installed.

@roife
Copy link
Contributor

roife commented Mar 28, 2024

The C++ extension seems unable to debug Rust projects on Mac.

OK, I've found the issue with the inability to use C++ extension on Mac: currently, Apple Silicon cannot utilize GDB (due to Apple's restrictions on Kernel 😢), hence on macOS, we can only use lldb.

@lnicola
Copy link
Member

lnicola commented Mar 28, 2024

Somewhat related we should probably configure the extensions to use rust-gdb and rust-lldb, but I'm not sure those are in PATH for everyone.

bors added a commit that referenced this issue Mar 28, 2024
fix: use lldb when debugging with C++ extension on MacOS

See #16901 (comment)

This PR resolves the issue of being unable to debug using the C++ extension on macOS. By using special configurations for the `MIMode` on macOS, it enables the C++ extension to connect to lldb when debugging (without affecting other platforms).
@lnicola
Copy link
Member

lnicola commented Mar 28, 2024

A nightly release with the fix is now available, in case anyone wants to test it.

@git-luke
Copy link
Author

A nightly release with the fix is now available, in case anyone wants to test it.

Thanks a lot @lnicola and @roife.
I just tested with rust-analyzer version: 0.4.1901-standalone (29a8e65 2024-03-28) and can confirm debugging is working again :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Broken Window Bugs / technical debt to be addressed immediately C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants