Question

I have a bunch of generic code that is used a lot, which i'd like to poke into in order to deal with a bug in a certain specific case.

So I'd like to break on a set of breakpoints only if some other breakpoint has been hit. Is there a way to do this in Visual 2005? I'm using C++ code.

Thanks!

Was it helpful?

Solution

If the trigger logic is complex enough, sometimes I find it easier to just add a DebugBreak(); call into the source.

OTHER TIPS

Please remember you can disable a breakpoint - it might be easier/more efficient/cleaner (then adding debug flags to your code and recompiling for example) to just disable the second breakpoint, wait till the first one breaks and then enable the second one in your breakpoints window - it takes just two mouse clicks each time you debug... :)

Have your first breakpoint change the value of some variable to a magic value (you can use a conditional breakpoint, with an expression which changed the variable and then returned true). Then, have the second breakpoint break when the variable is at that magic value. e.g.,

int debug_flag = 0;

First breakpoint condition:

debug_flag = 0xdeadbeef, true

Second breakpoint condition:

debug_flag == 0xdeadbeef
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top