views:

18

answers:

1

Hi, 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!

A: 

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.

Niels van der Rest