Ok, I got this multi-threaded C++ program that I try to debug in Visual Studio 2008.
Sometimes (usually after a random time between one and two hours of computations), the program stops, exits debug mode after writing in the debug window :
The thread 'Win32 Thread' (0x1560) has exited with code 3 (0x3).
The thread 'Win32 Thread' (0x5fc) has exited with code 3 (0x3).
...
And so on for all the threads involved.
AFAIK exit code 3 indicates a failure of something, I'd expect VS to intercept the exception and to break on it so I could try see what is the error and what caused it.
I tried to activate all the exception-catching in visual studio Debug menu, but it didn't change anything.
Is there a way to tell VS that I want a break when this anormal exit occurs ?
My guess: you're hitting an assertion failure and the CRT cannot create the message window (for some reason). This leads to an exit(3) call. I'm not sure if that will kill all threads with that exit code. Perhaps all of your threads are failing in the same way once something goes wrong.
Try adding a _CrtSetReportMode call at the beginning of your program to force the assertion failure messages to the output window in the debugger. Then, you should see the details of the assertion failure in the debug output window before the series of thread exit messages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With