crash generate dump

2019-07-18 06:55发布

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.

标签: c++ crash windbg
3条回答
Evening l夕情丶
2楼-- · 2019-07-18 07:35

You may want to look at the SetUnhandledExceptionFilter function.

查看更多
Summer. ? 凉城
3楼-- · 2019-07-18 07:51

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.

查看更多
成全新的幸福
4楼-- · 2019-07-18 07:57

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

查看更多
登录 后发表回答