如何使用VS 2010调试找到崩溃的代码位置? [英] How to locate the crashed code position using VS 2010 debug?

查看:784
本文介绍了如何使用VS 2010调试找到崩溃的代码位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS2010 IDE中编写了一个MFC应用程序。我使用了一些STL容器,如vector,map等。但是在运行程序后,程序崩溃了。错误信息说map / set iterator not dereferencable!。那么我该怎么办可以找到代码导致崩溃的地方?如何找到bug?非常感谢你!



我尝试了什么:



我根据互联网的方式试了一下,但我找不到虫子!!!那么我该怎么办? do ...

I wrote a MFC application program in VS2010 IDE.I used some STL containers such as vector,map ,etc.But after ruuning my program,the program crashed.The error message said "map/set iterator not dereferencable!".So what shoud I do can find where the code caused the crash?How to locate the "bug"?Thank you very much!

What I have tried:

I had a try according to the ways fron the Internet,but I couldn't find the "bug"!!!So what should I do...

推荐答案

使用调试器。

在调试器中运行你的应用程序 - 这很简单,谷歌会找到你的指示 - 当它崩溃时,使用堆栈跟踪在代码中找到导致它崩溃的函数。

在函数顶部放置一个断点,再次放置你的应用程序。这次,当它进入功能并让你控制时它会停止。您现在可以单步执行代码,查看可变内容并了解正在发生的事情。



抱歉,我们不能为您这样做:我们不要无法访问您的代码或数据,如果我们这样做就不知道如何使用它!
Use the debugger.
Run your app in the debugger - it's pretty simple, google will find you instructions - and when it crashes, use the stack trace to locate the function in your code that made it crash.
Put a breakpoint at the top of the function, and your your app again. This time, it will stop when it enters the function and let you take control. You can now step through the code, looking at variable contents and working out what is going on.

Sorry, but we can't do that for you: we don't have access to your code or data, and wouldn't know how to use it if we did!


这篇关于如何使用VS 2010调试找到崩溃的代码位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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