title: Break in Visual Studio on process exit
body: <p>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.</p>
  
  <p>I've tried installing a <a href="http://en.cppreference.com/w/cpp/utility/program/atexit" rel="noreferrer"><code>std::atexit</code></a> function, but this doesn't get hit. I've also tried overriding <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms680634(v=vs.85).aspx" rel="noreferrer"><code>SetUnhandledExceptionFilter</code></a>, in case it is caused by a crash, and it also doesn't get hit. The project has exceptions disabled (<code>#define _HAS_EXCEPTIONS=0</code>), so I cannot call <code>std::set_terminate</code> or <code>std::set_unexpected</code>. </p>
  
  <p>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?</p>