Visual Studio 2005:出现值时中断

发布于 2024-09-25 16:39:27 字数 276 浏览 11 评论 0原文

我正在尝试简化我的调试任务,并且我有一个可以提高调试速度的想法。 假设我有一个值,比如 2.8651,在代码中出现时我不知道。 我想知道是否可以创建一个超级断点,该断点将在其中一个变量第一次获取该值时停止。 我记得我不知道哪个变量取值。 我可以通过花一些时间在调试器上知道这一点,但我很懒。 我对 VS 的 VBA 不太熟悉。我想,一个解决方案是创建一个宏,该宏将在代码执行的每一行沿着局部变量循环。当条件 localVariable == 2.8651 得到验证时,它会停止。

谢谢您的回答!

I'm trying to simplify my debugging tasks and I had an idea which could increase my debugging speed.
Suppose I have a value, say 2.8651 that appear in the code at a moment I do not know.
I'm wondering if it was possible to create a super breakpoint which would stop at the first time one of the variable takes this value.
I recall that I do not know which variable takes the value.
I could know it by spending some time on the debugger but I'm lazy.
I'm not really familiar with VBA for VS. I guess, a solution would be to create a macro which would loop along local variable at each line of the code execution. It'd stop when the condition localVariable == 2.8651 is verified.

Thank you for your answers!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

颜漓半夏 2024-10-02 16:39:27

代码块不存在超级断点。有两个选项可以实现您想要的效果:

  • 在每行上放置一个带有变量赋值的条件断点。右键单击断点,然后单击条件... 以指定断点何时中断。
  • 在代码块中放置一个单个条件断点,并检查条件中所有必需的变量。

正如您所建议的,您可以通过右键单击断点并选择“点击时...”来放置带有宏的单个断点。但是,我非常怀疑是否可以从宏控制断点,所以这是行不通的。

There's no such thing as a super breakpoint for a block of code. There are two options to achieve what you want:

  • Place a conditional breakpoint on each line with a variable assignment. Right-click the breakpoint and click Condition... to specify when it should break.
  • Place a single conditional breakpoint in the code block and check all the required variables in the condition.

As you suggested, you can place a single breakpoint with a macro, by right-clicking the breakpoint and select When Hit.... However, I highly doubt that it's possible to control the breakpoint from the macro, so this wouldn't work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文