如何使VC ++的调试器在异常时中断? [英] How do I make VC++'s debugger break on exceptions?

查看:159
本文介绍了如何使VC ++的调试器在异常时中断?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调试用C编写的DLL中的一个问题,该问题不断导致访问冲突。我正在使用Visual C ++ 2008,但是代码是直接的C。

I'm trying to debug a problem in a DLL written in C that keeps causing access violations. I'm using Visual C++ 2008, but the code is straight C.

我习惯于Delphi,如果在调试器下运行时发生异常,则该程序将立即中断调试器,并为您提供检查程序状态的机会。但是,在Visual C ++中,我得到的只是输出选项卡中的一条消息:

I'm used to Delp where if an exception occurs while running under the debugger, the program will immediately break to the debugger and it will give you a chance to examine the program state. In Visual C++, though, all I get is a message in the Output tab:

等等等等等等:访问冲突读取位置0x04410000。不间断,什么也没有。它只是将堆栈放开,直到将其放回我的Delphi EXE中为止,该EXE识别出问题并在那里提醒我,但是到那时,我已经丢失了几层调用堆栈,我不知道发生了什么。

First-chance exception at blah blah blah: Access violation reading location 0x04410000. No breaks, nothing. It just goes and unwinds the stack until it's back in my Delphi EXE, which recognizes something's wrong and alerts me there, but by that point I've lost several layers of call stack and I don't know what's going on.

我尝试了其他调试技术,但是它所做的一切都是在C宏内部嵌套循环的深处进行的,该宏被调用了500次以上,这仅是超出了一部分我的技能(或我的耐心)可以追溯。

I've tried other debugging techniques, but whatever it's doing is taking place deep within a nested loop inside a C macro that's getting called more than 500 times, and that's just a bit beyond my skill (or my patience) to trace through.

我认为必须有某种方式来获得第一机会例外,才能真正给我一个机会 来处理。我可能不知道某些第一时间例外立即中断的配置设置,但似乎并不是所有可发现的。

I figure there has to be some way to get the "first-chance" exception to actually give me a "chance" to handle it. There's probably some "break immediately on first-chance exceptions" configuration setting I don't know about, but it doesn't seem to be all that discoverable.

有人吗?知道它在哪里以及如何启用它?

Does anyone know where it is and how to enable it?

推荐答案

Debug 菜单中选择例外,然后选中您希望调试器终止的例外复选框。 访问冲突位于 Win32异常下。

From the Debug menu, select Exceptions and check the boxes of the exceptions you'd like the debugger to break on. "Access Violation" is under "Win32 Exceptions."

这篇关于如何使VC ++的调试器在异常时中断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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