Debugging A Release

Should be a quick one, how do I debug a release?

I followed the instructions here
https://docs.microsoft.com/en-us/cpp/build/how-to-debug-a-release-build?view=msvc-160

then it says you can just debug, but how? I can't figure out how you would boot the release to debug.
It's usually fruitless to run a release build through a debugger. Line-by-line stepping doesn't work, breakpoints for the most part don't work, variable watches don't work. Unless you know how to read a disassembly and inspect memory, there's very little point.

If you have a bug that's only showing up in release, you need to find some other way to debug it. Often, print debugging is quite effective, if time-consuming.
thanks, I'll try ask a different question.
you can add instrumentation ... that is, put in a global variable(keep reading!) for a log file, and write to it where you are and what the value in question is... all over the code where it matters. Each statement should have a #ifdef on it, including the log file and all. If you define the symbol, the code goes away, its not in the build. If its there, you get a log file and can see what went awry.
This is not really useful for giant code bases, but it can debug a file or two when the release mode has problems but the debug version is not having the same symptoms or issues.

also, if the release behaves differently from the debug, it is often a variably initialize issue as debug mode often zeros or similar memory for you while release does not.
Topic archived. No new replies allowed.