I'm having some difficulties determining what is causing a process to exit. I have a breakpoint in some shutdown code that I'm debugging, but, after breaking in the debugger at the breakpoint and stepping once, the whole process exits immediately. Every thread reports an exit code of -1 in the output window. There are a large number of threads in the process at that time, and the code base is quite large, making searching for the culprit difficult.
I've tried installing a std::atexit
function, but this doesn't get hit. I've also tried overriding SetUnhandledExceptionFilter
, in case it is caused by a crash, and it also doesn't get hit. The project has exceptions disabled (#define _HAS_EXCEPTIONS=0
), so I cannot call std::set_terminate
or std::set_unexpected
.
Is there some other way to determine what is causing the process to exit? Some option to break in the debugger when the process is about to terminate?
#define
. SoDebug->Windows->Exception Settings
could be useful. – Wier__try/__finally
block insidemain
, and the__finally
block doesn't get hit. – Ghee