如何调试Visual C ++运行时错误 [英] How to debug a Visual C++ Runtime Error

查看:145
本文介绍了如何调试Visual C ++运行时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2008中编写一个C ++ COM对象,它是一个Internet Explorer浏览器辅助对象。最近,当IE运行时,IE已经开始频繁地弹出一个名为Microsoft Visual C ++运行时库的对话框,并显示错误消息运行时错误!并且继续说:应用程序要求运行时间以不寻常的方式终止它,请联系应用程序的支持小组获取更多信息。与通常不同,此对话框只有一个OK按钮,但没有调试按钮,所以IE然后终止,我不会像堆栈跟踪那么多,甚至一些代码可能是这样的bug的一部分。我不知道我的代码中的哪个崩溃了。



如何解决运行时错误问题?什么是运行时错误的可能原因? (可能是内存相关的错误?)我应该检查我的代码以试图消除这种崩溃有什么问题?

解决方案

当您看到该对话框时,启动VS2008 with你的COM对象项目。
然后使用菜单Debug-> Attach来处理以将调试器附加到IE进程中,该进程已加载COM对象。
然后进入进程(Debug-> break all),并获得堆栈跟踪。


I am writing a C++ COM object in Visual Studio 2008 that is an Internet Explorer Browser Helper Object. Recently, when running in IE, IE has started frequently popping up a dialog titled "Microsoft Visual C++ Runtime Library" with an error message "Runtime Error!" and going on to say that "The application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information." Unlike usual, this dialog only has an OK button but no debug button, so IE then terminates and I'm not left with so much as a stack trace or even a hint of what part of my code could have been so buggy. I'm not sure where in my code it is crashing.

How does one troubleshoot a "Runtime error" problem? What are possible causes of a runtime error? (memory related bugs perhaps?) What sort of problems should I be checking my code for to attempt to eliminate this sort of crash? I need some ideas on how to troubleshoot this one, its a bit elusive.

解决方案

When you see that dialog, start VS2008 with your COM object project. Then use the menu Debug->Attach to process to attach the debugger to the IE process which has your COM object loaded. Then break into the process (Debug->break all) and you get the stack trace.

这篇关于如何调试Visual C ++运行时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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