Reputation: 5203
My application crashes occasionally at customer machine after running for 3-4 days. Is it possible to attach the application to a debugger like ADplus automatically when the application starts? This is for generating the dump file whenever the application crashes.
Upvotes: 2
Views: 600
Reputation: 4110
IMO you wouldn't have to attach to the debugger when the process starts. Windows would look for a debugger when the process terminates and the location is set AeDebug RegistryKey
On x86 computer it is \\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug
CDB
can be set as Postmortem debugger
To change the postmortem debugger to CDB, run cdb -iae or cdb -iaec KeyString. When the -iaec parameter is used, KeyString specifies a string to be appended to the end of command line used to launch the postmortem debugger. If KeyString contains spaces, it must be enclosed in quotation marks. This command will display no message if it succeeds, but will display a failure message if it fails. When CDB is the postmortem debugger, it will be activated whenever an application crashes.
I would have something like cdb -iaec ".dump /ma /u crashedapp.dmp;q"
to get a memory dump when the process terminates.
And if the OS is Vista SP1+ then registry can be configured to get a full memory dump using WER http://msdn.microsoft.com/en-us/library/bb787181(VS.85).aspx
Upvotes: 0
Reputation: 1475
You may want to look at the SetUnhandledExceptionFilter
function.
Upvotes: 1
Reputation: 14119
Since you want to use ADPlus I assume a windows only solution will do it.
In this case you could install a post mortem debugger. It will pop up as soon as your app crashes. I usually use windbg.
Upvotes: 1