Visual C++ program crashed, but no dumpfile genera

2019-01-26 18:45发布

I have a very strange situation. I'm running IOCP Server Program programmed by Visual studio 2010 in C++.

It uses 'minidump', so When there is a logical bug like pointer misuse, Program crashes with dump file so I can find out where is the crash point in codes.

Sometimes (very rarely), the program crashes and there are no dump files.

What situation makes SetUnhandledExceptionFilter() not working? Anybody knows this problem? I can't figure out.

标签: c++ dump iocp
1条回答
劳资没心,怎么记你
2楼-- · 2019-01-26 19:26

Well, of course you don't know because you don't have a minidump to look at. You should do the absolute minimum when the SetUnhandledExceptionFilter callback fires. The process is in a perilous state. It crashed. Locks might be held, the heap locks are particularly troublesome. You can't expect MiniDumpWriteDump() to succeed.

What you need is a little guard process that waits on a named event. Start it up as early as possible in your main() function and pass it your process ID. The guard process waits on both that event and your process handle. In your exception callback, just signal the event and immediately sleep for a long time. That wakes up the guard process, it calls MiniDumpWriteDump() plus whatever else is necessary to let you know about the crash. And kills your main program.

查看更多
登录 后发表回答