如何在程序崩溃时出现异常? [英] How to debug a program when it crashes w/out exception?

查看:188
本文介绍了如何在程序崩溃时出现异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一个程序定期崩溃,但我不知道为什么。我以调试模式运行,但没有弹出。该程序刚刚退出。我已经有其他错误,抛出异常...但不是这一个。是否有一种奇妙的方法来捕捉它或某些东西?

One of my programs crashes periodically, but I don't know why. I'm running it in debug mode, but nothing pops up. The program just suddenly exits. I've had other bugs that do throw an exception...but not this one. Is there a magical way of catching it or something?

推荐答案

大概你在Visual Studio中运行它,由于某种原因它不是停止在调试器中有一个未捕获的异常,在这种情况下,您可以尝试从Visual Studio外部捕获崩溃。请参阅来自非托管代码的System.AccessViolationException 的回答,特别是如何捕获崩溃转储

Presumably you're running it from within Visual Studio and for some reason it's not stopping in the debugger with an uncaught exception, in which case you could try catching the crash from outside of Visual Studio. See my answer at System.AccessViolationException from unmanaged code?, in particular how to capture a crash dump.

如果它只定期崩溃,但在相当短的时间内,从Sysinternals开始 procdump 。从Visual Studio外部启动您的可执行文件,然后运行:

If it only crashes periodically, but within a reasonably short period of time, start with Sysinternals procdump. Start your executable from outside Visual Studio, then run:

procdump -e <YourExecutableNameOrPid>

并等待它收获崩溃转储 - 假设由于未处理的异常而退出 - 然后加载崩溃转储到VS 2010或WinDbg。

and wait for it to harvest a crash dump - assuming it exits due to an unhandled exception - then load the crash dump into VS 2010 or WinDbg.

这篇关于如何在程序崩溃时出现异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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