c++ - How to debug crashes that occur in release builds only -
i have weird race condition in 1 of programs causes crash in release mode , outside visual studio environment.
if launch process in release mode inside visual studio f5 (either release or debug), works.
if create release copy debug information doesn't crash.
i'm wondering how 1 debug such problem.. , why isn't crashing inside visual studio? visual studio slow down executable when launching release version of it?
the question how debug application without changing runtime behavior causes crash. answer better post-mortem diagnostics
you can improve exception handling code , if production application, should.
install custom termination handler using
std::set_terminate
if want debug problem locally, run endless loop inside termination handler , output text console notify
std::terminate
has been called. attach debugger , check call stack.in production application might want send error report home, ideally small memory dump allows analyze problem.
microsoft has structured exception handling mechanism allows catch both hardware , software exceptions. see msdn. guard parts of code using seh , use same approach in 1) debug problem. seh gives more information exception occurred use when sending error report production app.
if race condition right timing crucial , guess, attaching debugger in release mode change behavior , timing
Comments
Post a Comment