Pause/Break debugging when any integer is of a specific value

Viewed 100

This is not about setting a single breakpoint, conditional or not.

I admit this is a bad situation but I have a large-ish, undocumented codebase in front of me. Somewhere in this code an int is, after pressing a button, set to a specific value (lets say 200).

I thought I had found the occurences where this could happen but at both those points the variables are set to the correct value (< 200).

Now, instead of spending another four hours traversing call stacks, is there a way of pausing/breaking the debugger, in the sense of how a breakpoint pauses the deugger, the moment anywhere in the program an int is set to a specific (200) value?

A different way of phrasing this would be: Can I set a conditional breakpoint on/for native types?

Example:

public class Program
{
    public static void Main()
    {
        int a = 0;
        int b = 0;
        int c = 0;

        while(a < 5)
        {
            a++;
            b++;
            c = a+b;
        }
    }
}

Lets say anytime this algorithm assigns the value '4' to any of the three ints, I would like for the debugger to pause/break.

0 Answers
Related