views:

143

answers:

2

I can detect when a variable changes, but it changes so often that its no use - what I want is to detect the moment that a variable becomes zero.

Thanks,

+2  A: 

That's not possible in Visual Studio. Visual Studio supports a number of debugging features in that particular area but I don't think you can combine them into a feature to get what you want

  • Data Changing Breakpoints: break when a value changes (only supported in native C++)
  • Conditionally breakpoints: break when the IP crosses the breakpoint and a particular condition is satisfied.

What you could do though is wrap all writes to your variable into a setter function. Then use a conditional breakpoint to break when the value changes to 0. I think this is the closest you're going to get to the feature you want.

JaredPar
Thanks very much.. By the way, what does IP stand for?
Mick
IP = Instruction Pointer. Essentially the line of code currently executing.
JaredPar
+1  A: 

You have to use one of these debuggers

1 - http://www.microsoft.com/whdc/DevTools/Debugging/default.mspx

2 - The Good Old SoftICE, if you can find it anywhere

3 - http://www.sysersoft.com/updatelog.html

Also check new version OllyDbg (it says it supports hardware breakpoints)

Malkocoglu
Syser Win32 Debugger seems to have hardware breakpoints, I did not try but it is free...
Malkocoglu
Is SoftICE free?
Mick
It is not free. It is a discontinued product. You should ask Compuware about it...
Malkocoglu