Visual C ++程序崩溃,但没有生成转储文件。为什么? [英] Visual C++ program crashed, but no dumpfile generated. why?

查看:489
本文介绍了Visual C ++程序崩溃,但没有生成转储文件。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很奇怪的情况。
我在C ++中运行Visual Studio 2010编程的IOCP服务器程序。

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

它使用'minidump',所以当有一个逻辑错误, ,程序崩溃与转储文件,所以我可以找到在代码中的崩溃点在哪里。

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.

什么情况使 SetUnhandledExceptionFilter()不工作?
任何人都知道这个问题?我不知道。

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

推荐答案

当然,你不知道,因为你没有minidump看着。当SetUnhandledExceptionFilter回调触发时,你应该做绝对的最小值。这个过程处于危险状态。它崩溃了。锁可能被占用,堆锁特别麻烦。你不能期望MiniDumpWriteDump()成功。

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.

你需要的是一个保护进程,等待一个命名事件。在您的main()函数中尽早启动它,并将它传递给您的进程ID。保护进程等待该事件和您的进程句柄。在你的异常回调,只是信号事件,并立即睡了很长时间。这唤醒了警卫进程,它调用MiniDumpWriteDump()加上任何其他必要的,让你知道崩溃。并杀死你的主程序。

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.

这篇关于Visual C ++程序崩溃,但没有生成转储文件。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆