**"Variable is optimized away and not available."**, how can I view those variables in vscode? #14706
-
Hi, I am trying to debug a project call is that because of the way I build? I build with P.S. Thanks for making this great app, I can't wait to learn more about it. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
Hi. This sometimes happens, e.g. on unused variables. Regardless of that, I don't think you can do much about it. Native language debuggers will always give a worse experience than those for managed languages. We don't do anything besides setting up the debugging extension. Depending on your platform, you can try another one, there's at least three: C/C++, Native Debug and CodeLLDB. |
Beta Was this translation helpful? Give feedback.
-
It seems that variable is optimized away includes variables that have no yet actually been created. Ideally such variables would not be displayed until they are actually valid. |
Beta Was this translation helpful? Give feedback.
-
Ok, after playing around with cppvsdbg and having strange issues(works about 90% of the time) I found out that codelldb requires a special gnu version for windows. E.g., codelldb requires rust--x86_64-pc-windows-gnu.msi. I installed rustup from the link from main download page(https://www.rust-lang.org/tools/install) when one needs to go https://forge.rust-lang.org/infra/other-installation-methods.html and download the windows gnu version. I think I got the info that one needs or can use a different arch:: https://stackoverflow.com/questions/48067874/how-do-i-inspect-local-variables-or-use-the-watch-window-with-rust-code-using-vs but I also found other people saying similar things about issues. I think maybe codelldb should try to determine if the gnu version is installed and warn the user if it is not.
` }` Not saying all of the above is necessary or makes sense, just how I got codelldb to work correctly when I wrote it off at first and only after I started having problems with cppvsdbg not working well. |
Beta Was this translation helpful? Give feedback.
Hi. This sometimes happens, e.g. on unused variables. Regardless of that, I don't think you can do much about it. Native language debuggers will always give a worse experience than those for managed languages.
We don't do anything besides setting up the debugging extension. Depending on your platform, you can try another one, there's at least three: C/C++, Native Debug and CodeLLDB.