rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.03k stars 1.56k forks source link

RA 0.3.2029 doesn't respect breakpoints #17568

Open ThomasCartier opened 1 month ago

ThomasCartier commented 1 month ago

Hi, RA 0.3.2020 respects the breakpoints but not the 2029 version when running Debug with from inlay in test module.

mod test {
#[test]

        fn test_ra() {

                println!("OK");

                println!("OK");
        }
}

A breakpoint to any statement won't stop.

VScode

Version: 1.91.0
Commit: ea1445cc7016315d0f5728f8e8b12a45dc0a7286
Date: 2024-07-01T18:52:41.959Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Linux x64 6.9.7-amd64
active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.81.0-nightly (d7f6ebace 2024-06-16)

Stepping down to 2020 solves the issue. Any new option to be aware of ?

davidbarsky commented 1 month ago

Not aware of any changes, but note that rust-analyzer does not handle debugging Rust code; it only integrates with existing debugging tools. It might be that your code is not being built with debug info.

ThomasCartier commented 1 month ago

You are right but I gelt like to report a change that happened right after the RA update and that disappeared with the downgrade. Maybe someone has an idea of what's going on..

Veykril commented 1 month ago

There was a change to the debug task here https://github.com/rust-lang/rust-analyzer/commit/cb523fc88a35731279925a418dd6828df6acde92 which broke some stuff, and another followup in https://github.com/rust-lang/rust-analyzer/blob/master/editors/code/src/debug.ts which fixed things btu this might still have changed some behavior

ThomasCartier commented 1 month ago

Just a side note, I still have the same issue with RA v2037 and codeLLDB, in vscode.

Anyone else experience this ? I would like to not be stuck in v2020.

Veykril commented 1 month ago

I think I found the issue on our side

ThomasCartier commented 1 month ago

@Veykril Just installed v2045 and the problem still occurs.

Veykril commented 1 month ago

Thanks for checking again, I'll take another look. What debugging extension are you using?

ThomasCartier commented 1 month ago

@Veykril : many thanks to you. I use codeLLDB. Every extensions are up to date on my system.

Veykril commented 1 month ago

Hmm, breakpoints do work for me on the latest release 😕

ThomasCartier commented 1 month ago

I will try with a naked vscode and see. I will report in two/three hours. Thanks a lot

ThomasCartier commented 1 month ago

Ok it works on a naked installation. I will report the setting(s) that mess everything, in case anyone else has the same issue. Then I will close this issue.

ThomasCartier commented 1 month ago

@Veykril found the culprit!

it's "rust-analyzer.runnables.extraArgs" coupled with "release".

in my setting.json I had:

"rust-analyzer.runnables.extraArgs": [
        "--release"
]

that launched the optimized version of my code when clicking the "release" inlay button above my test. Now, it seems that it is working differently and replaces:

"rust-analyzer.runnables.extraTestBinaryArgs": [
        "--show-output",
        "--nocapture"
],

which is a differing behavior from v2020. It is as if extraTestBinaryArgs was overwritten by the extraArgs. It's in the inlay button management that the issue lies.

When removing extraArgs, a click on the debug button works fine, as usual.