Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I debug a win32 process that unexpectedly terminates silently?

I have a Windows application written in C++ that occasionally evaporates. I use the word evaporate because there is nothing left behind: no "we're sorry" message from Windows, no crash dump from the Dr. Watson facility...

On the one occasion the crash occurred under the debugger, the debugger did not break---it showed the application still running. When I manually paused execution, I found that my process no longer had any threads.

How can I capture the reason this process is terminating?

like image 627
Matthew Xavier Avatar asked Dec 18 '08 16:12

Matthew Xavier


2 Answers

You could try using the adplus utility in the windows debugging tool package.

adplus -crash -p yourprocessid

The auto dump tool provides mini dumps for exceptions and a full dump if the application crashes.

like image 181
chills42 Avatar answered Sep 21 '22 12:09

chills42


If you are using Visual Studio 2003 or later, you should enable the debuggers "First Chance Exception" handler feature by turning on ALL the Debug Exception Break options found under the Debug Menu | Exceptions Dialog. Turn on EVERY option before starting the debug build of the process within the debugger.

By default most of these First Chance Exception handlers in the debugger are turned off, so if Windows or your code throws an exception, the debugger expects your application to handle it.

The First Chance Exception system allows debuggers to intercept EVERY possible exception thrown by the Process and/or System.

http://support.microsoft.com/kb/105675

like image 38
Heston T. Holtmann Avatar answered Sep 18 '22 12:09

Heston T. Holtmann