Thursday, January 31, 2019

Debug a Release Build


Another post really for myself to keep a good pointer, and/or thing(s) learned.

I had a code in C++, which runs OK in Debug build, but not in Release build. Not running here I mean that it crashes, fails even in exception trapping. After all, I found out that it is due to a library implemented by a colleague, which exit when an exception happens in Release build, while passes the exception to the caller in Debug build.

Looking back, this could have been found, by stepping through the code in Debug build. Apparently I did not have such a patience, and found it only by “debugging the Release build”.

It turned out be pretty simple. Just by following the instruction found at https://docs.microsoft.com/en-us/cpp/build/reference/how-to-debug-a-release-build?view=vs-2017.

The step 6 says:
You can now debug your release build application. To find a problem, step through the code (or use Just-In-Time debugging) until you find where the failure occurs, and then determine the incorrect parameters or code.

At the beginning, it was not clear to me how??? But then realized that I just need to push the usual green arrow .