#When debugging variable is optimized away and not available

1 messages · Page 1 of 1 (latest)

simple wyvern
#

I'm debugging with MSVC on Windows, there are random variables whose values don't get shown. It says "variable is optimized away and not available". Can I completely disable this optimization? If I try to repl the value, it says the same.

Im building in debug mode.

wispy pine
#

are they consts?

simple wyvern
#

Or other global variables sometimes.

#

Not 100% sure in all cases though.

wispy pine
#

consts can probably be fixed by making them var and discarding the mutability with _ = &myvar;

#

is it all parameters or just parameters holding structs? if it's just structs, making them *const Struct might fix them

#

there's still stuff missing from zig debug info, it's slowly getting worked on

simple wyvern
#

If I have to change the code, that defeats the point of debugging because I can't just step through my program, I have to change the code and recompile, and get back to that state before recompiling.

#

Do others just not use the debugger?

#

Maybe I'm missing something, because I thought that's what everyone is doing.

wispy pine
#

debug info might be better on linux

#

if you're on windows you can try using wsl and see if there's an improvement

#

I don't use a debugger so I don't know why I'm answering this, someone else probably has more information