条件断点的弱点 [英] weakness in conditional breakpoints

查看:159
本文介绍了条件断点的弱点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有时间提交错误,但是这是我的看法.

我可以不经意地将断点条件设置为任务:

owner = null

当我要键入

owner == null

时,尽管选中了"Condition"复选框,但调试器只接受此设置.

这将是一个改进,如果调试器作为警告或信息MessageBox或其他内容提醒用户.

我设置了许多这样的条件中断(20),并且一个错误地设置为赋值,它使传递的引用无效在使用之前先降低几层,再加上我正在检查的错误本身与某些引用意外地设置为null有关,因此这确实很痛苦,并且增加了很多浪费的时间.

感谢

I dont have time to submit a bug, but here is my view.

I can inadvertantly set a breakpoint condition to be an assignment:

owner = null

when I meant to type

owner == null

The debugger simply accepts this, despite the fact that the checkbox 'Condition' is checked.

It would be an improvement if the debugger alerted the user to this as a warning or information MessageBox or something.

I setup many conditional breaks like this (20) and one was incorrectly set as an assignment, it nulled a reference that was passed down several layers before getting used PLUS the bug itself that I am examining is connected with some reference being unexpectedly set to null, so this really was a pain and added a lot of wasted hours.

Thanks
Hugh

推荐答案

休,

我知道如何无意中输入此内容并引起混乱.但是,这是合法的表达方式,有些人可能会发现该警告很烦人.请注意,如果您在if子句中进行赋值,编译器将不会发出警告.解决此问题的一种方法是在表达式中首先指定常量,例如在c ++中,您执行S_OK == hr而不是hr == S_OK.如果您不经意地执行S_OK = hr,则会因分配不合法而出错.
希望有帮助.

Azeem Khan
VS Debugger.
Hi Hugh,

I understand how this can be entered inadvertantly and cause confusion. However it is a legal expression and some may find the warning annoying. Note that a compiler will not warn if you do an assignment in say an if clause. One way to workaround this is to specify the constant first in your expression e.g. in c++ you do S_OK == hr instead of hr == S_OK. If you inadvertently do S_OK = hr you will get an error since the assignment is not legal.
Hope that helps.

Azeem Khan
VS Debugger.


这篇关于条件断点的弱点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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