Skip to content

Always inline functions don't have correct source line information under the VS debugger #108972

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

Open
xTachyon opened this issue Mar 10, 2023 · 2 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. O-windows-msvc Toolchain: MSVC, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@xTachyon
Copy link
Contributor

xTachyon commented Mar 10, 2023

I tried this code:

#[inline]
fn f() {
    println!("f");
}
#[inline(always)]
fn g() {
    println!("g");
}

fn main() {
    f();
    g();
}

I expected to see this happen: being able to debug g under Visual Studio.

Instead, this happened: the source line information for g is attributed to the g call in main, not to the lines in g.

Meta

rustc --version --verbose:

rustc 1.68.0 (2c8cc3432 2023-03-06)
binary: rustc
commit-hash: 2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74
commit-date: 2023-03-06
host: x86_64-pc-windows-msvc
release: 1.68.0
LLVM version: 15.0.6

image

This also means that it loses the debug info for variables, making the function not debuggable at all.

Update: It also doesn't work if I set -Zinline-mir=no under nightly.

@xTachyon xTachyon added the C-bug Category: This is a bug. label Mar 10, 2023
@Noratrieb
Copy link
Member

Noratrieb commented Mar 10, 2023

probably related to #105538 (update: probably not given that disabling MIR inlining doesn't help)

@wesleywiser wesleywiser added A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) O-windows-msvc Toolchain: MSVC, Operating system: Windows labels Mar 11, 2023
@Noratrieb Noratrieb added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 5, 2023
@jestarray
Copy link

jestarray commented Aug 22, 2023

just confirming this is still an issue on rustc 1.71.1 running visual studio 2022 17.7.1. The vscode codelldb extension also seems to have this problem, but only on windows as linux is working fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. O-windows-msvc Toolchain: MSVC, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants