我可以使Visual Studio在用户定义的C ++异常时中断吗? [英] Can I make Visual Studio break on a user-defined C++ exception?

查看:93
本文介绍了我可以使Visual Studio在用户定义的C ++异常时中断吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个引发许多(处理的)异常的应用程序。我特别想谈一谈异常类型。

I have an application that throws many (handled) exceptions. There is one type of exception in particular that I would like to break on.

是否可以使调试器针对特定的用户定义异常而中断?我不明白为什么这不可能,因为它确实知道抛出的异常的类型。

Is it possible to make the debugger break on a specific user-defined exception? I don't see why this wouldn't be possible, since it does know the type of the exception that was thrown.

我可以通过设置断点来解决此问题。

I can work around this by setting a breakpoint in the exception's constructor, but it would be nice to know how to do it the 'correct' way.

推荐答案

如果在异常的构造函数中,则最好以正确的方式进行操作。

If you go to the Debug menu and choose Exceptions... (or press Ctrl+Alt+E), you'll get a dialog:

您需要点击添加... 按钮,输入您的自定义类型名称,并确保已选中新异常类型旁边的复选框。

You'll need to click the Add... button, enter your custom type name, and make sure that the checkbox by your new exception type is selected.

这篇关于我可以使Visual Studio在用户定义的C ++异常时中断吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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