Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
179 views
in Technique[技术] by (71.8m points)

dump - Visual C++ program crashed, but no dumpfile generated. why?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...