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

Some debugger variable display issues #70542

Closed
DeanRoddey opened this issue Mar 29, 2020 · 8 comments
Closed

Some debugger variable display issues #70542

DeanRoddey opened this issue Mar 29, 2020 · 8 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@DeanRoddey
Copy link

DeanRoddey commented Mar 29, 2020

This may be a dup but I didn't see one right off hand.

Visual Studio Code: 1.43.2
Rust 1.42.0
Toolchain: stable-x86_64-pc-windows-msvc
C/C++ VSC extension: 0.26.3
Rust RLS: 0.7.0

VSCRustCharVal

Not displaying char variables

The debugger always shows an unspecified error for the value of char variables. Presumably this is some issue getting the right symbol info to the debugger?

Optimizing even if in debug profile

[Here I think I need to retract this part of my complaint, since it appears that all of these I've seen so far are actually misleading messages, where the variable is reported as optimized out when really it's just not in scope.]

Also, despite the optimization level being zero, locals keep getting optimized away, or at least the debugger thinks they are. I have seen others complaining about this as well, both on MSVC and Gdb so it doesn't seem specific to this tool chain. You can see in the image above a local claiming to have been optimized away, even though it's a debug build with optimization at zero.

Sometimes it's enough to make debugging fairly unproductive.

@jonas-schievink jonas-schievink added A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 29, 2020
@DeanRoddey
Copy link
Author

DeanRoddey commented Mar 29, 2020

I would also throw in that the optimized variables thing is made a bit messier since it often shows that message even if it's just that the variable hasn't come into scope yet. Just not displaying variables that aren't in scope would probably be better, but the alternative would be to display a somewhat more accurate message like 'not in scope'. I'll have to keep an eye on that and see how many (maybe all) of my complaints about optimized out variables are really just out of scope scenarios.

@jonas-schievink
Copy link
Contributor

We cannot control your debugger frontend, only how rustc emits debuginfo

@jonas-schievink
Copy link
Contributor

The "variables display as optimized out" issue is #46698.

The issue with chars looks like an issue with your debugger. Please check if that works with GDB or LLDB.

@DeanRoddey
Copy link
Author

I understand you can't control the debugger, but all debuggers I've used don't display variables until/unless they are in scope. It seems a bit unlikely this one does otherwise. Presumably that is controlled by when the symbols are emitted, right?

@DeanRoddey
Copy link
Author

Going back again, it seems to me now that all of the optimized out variable errors were really misleading and they were really just not in scope. So, for now, I'm going to delete that part of my complaint since I'm not sure if I really have any legit issues of that sort now. It's possible a lot of the complaints you've gotten may be of that sort.

@CryZe
Copy link
Contributor

CryZe commented Apr 1, 2020

Alright, so this is happening for me as well. So I checked which Rust version caused this regression, and it can't be a recent regression as the same problem happens for Rust 1.20:

https://i.imgur.com/IROTwON.png

So I would say it's not a regression on Rust's side.

Additionally it also happens for C++ code (though differently):

https://i.imgur.com/nYADJWK.png

I'm assuming it's just the debugger that changed how it behaves.

@CryZe
Copy link
Contributor

CryZe commented Apr 1, 2020

What however seems weird is that the variable c suddenly appears out of nowhere while the others already exist:

https://i.imgur.com/X16ykYB.gifv

Also this time with Visual Studio directly instead of potentially flawed "third party extensions" (though the behavior is exactly the same in the extension).

@wesleywiser
Copy link
Member

wesleywiser commented Jun 19, 2023

Visited during wg-debugging triage. I see three issues mentioned in this thread:

  1. char values cannot be shows.
  2. Variables sometimes reported as optimized out
  3. Weird issues with variable scoping

Closing due to the first issue being fixed and the other issues having more specific tracking issues.

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.) 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