Generate dump with unmanaged code crash?

陌路散爱 提交于 2019-12-10 16:24:45

问题


Is there a way that I can get a full crash dump when my application crashes suddenly?

The problem is that I suspect that it's due to unmanaged code that kills the .net framework itself, and because of that, unless there's a debugger attached to the application at the moment of the crash, the application doesn't even gets a chance to handle the crash.

I can't attach a debugger and wait, because the crash happens randomly and we have many installed locations, so I'm wondering if it's possible to do this without attaching a debugger.

Edit: I'm aware of Microsoft Debugging SDK, and I also just found out about DebugDiag. I'd like to do this without having to attach to the application each time, as it's usually in the middle of a sale and I don't have time to attach the debugger and explore the stack trace. DebugDiag does seem to let me setup a rule for this, but it seems to only work on already running processes, rather than waiting for some process to launch.


回答1:


You can use adplus -crash or userdump.exe.




回答2:


debugdiag is fully scriptable. When I was having problems like this, we would have it scan for certain process names, and attach automatically.




回答3:


The best method is to edit the registry so that when crashes occur it invokes the appropriate application to generate the dump. So in your case I would get Dr. Watson to generate the crash dump.

See link

Basically edit the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug

set values

Value Name = Auto
Type = String (REG_SZ)
Data Value = 1 or 0. (Default is 1)
Value Name = Debugger
Type = String (REG_SZ)
Data Value = drwtsn32 -p %ld -e %ld -g

This will invoke Dr. Watson at the point that your app crashes. See the link in this post for further details, note that you will need to set the Auto value to 0 if you want to not have Dr. Watson be invoked in future.




回答4:


Create a General exception handler for your program. Inside the exception handler write a code to manually create a dump in the desired path.

This Link would help http://brakertech.com/howto-c-generate-dump-file-on-crash/



来源:https://stackoverflow.com/questions/265171/generate-dump-with-unmanaged-code-crash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!