简体   繁体   中英

Generate dump with unmanaged code crash?

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.

您可以使用adplus -crashuserdump.exe

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

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.

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM