调试器中的C ++单步引发异常 [英] C++ single step in debugger throws an exception

查看:181
本文介绍了调试器中的C ++单步引发异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C ++应用程序,当我尝试从一个断点单步时会抛出一个异常。例如:



1)从VS2010启动应用程序0调试器已附加。



2)设置断点。在这里似乎并不重要。



3)在应用程序中执行某些操作,以便它触发断点。



** VS2010命中断点



4)将调试器单步到下一行代码。



VS2010弹出一个消息框,此例外:



SimpleGraphSDI.exe中0x087df66f处理的异常异常:0xC0000005:访问冲突。



请注意,如果我在两个连续的代码行上设置了一个断点,并按运行从一行前进到另一行,该应用程序运行到下一行代码,没有任何问题。访问冲突仅在我使用VS2010中的单步命令时。



应用程序中的一些代码已经在VC6之后,也许更早。但是不知道这是否相关。



更新:单步执行调试器如果我启动应用程序,然后在应用程序启动后附加调试器。

解决方案

禁用RPC调试。



在Visual Studio 2010中,Visual Studio 2010 SP1工具栏选择以下步骤 -



工具 - >选项 - >调试 - > Native并取消选择启用RPC调试


I have a C++ app that will throw an exception when I try to single step from a breakpoint. For example:

1) Start app from VS2010 0 debugger is attached.

2) Set a breakpoint. It doesn't seem to matter where.

3) Do something in the app so that it hits the break point.

** VS2010 hits the break point

4) Single step the debugger to the next line of code.

VS2010 pops up a message box with this exception:

"Unhandled exception at 0x087df66f in SimpleGraphSDI.exe: 0xC0000005: Access violation."

Note that if I set a breakpoint on two consecutive lines of code, and press run to advance from one line to another, the app "runs" to the next line of code with no issues. The access violation is only when I use the single step command from VS2010.

Some code in the app has been around since VC6 and maybe earlier. However do not know if this is relevant.

UPDATE: The exception when single stepping the debugger does not occur if I start the app, and then attach the debugger after the app has started.

解决方案

A work around for this problem is to disable RPC debugging.

In the Visual Studio 2010, Visual Studio 2010 SP1 toolbar select below steps -

Tools->Options->Debugging->Native and deselect "Enable RPC debugging"

这篇关于调试器中的C ++单步引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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