-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Comments
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. |
We cannot control your debugger frontend, only how rustc emits debuginfo |
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. |
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? |
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. |
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: So I would say it's not a regression on Rust's side. Additionally it also happens for C++ code (though differently): I'm assuming it's just the debugger that changed how it behaves. |
Visited during wg-debugging triage. I see three issues mentioned in this thread:
Closing due to the first issue being fixed and the other issues having more specific tracking issues. |
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
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.
The text was updated successfully, but these errors were encountered: