visual studio breakpoint dependency hierarchy

A serious amount of time during software development is spent with debugging. Visual Studio makes the task of debugging native applications already a lot more comfortable but as with all things there is still room for improvement.

One feature that I was missing of late was the concept of hierarchical breakpoints.
Often during debugging I want the debugger to break in some method or function but only coming from an specific path.

To give you an example:

void some_function() {
/* breakpoint here */
}
 
void some_other_function() {
/* breakpoint here */
    some_function();
}
 
int main(int argc, char* argv[])
{
    some_function();
    some_other_function();
    return 0;
}

What I’d like to do now is to break in “some_function” but only coming from “some_other_function”.
In this easy example I could happily press F5 a couple of times and be done with it. I could also use the breakpoints hit-counter to accomplish that goal.
But for more complex software this quickly becomes unpractical.

Luckily for me Visual Studio provides an rich extension framework.

breakpoints

You see two breakpoints in the image above. By Draging’n'Droping the breakpoint in line 7 on the one in line 11 the one in line 7 got disabled. Once the program hits line 11 during a debug run the AddIn will in turn enable all child breakpoints (the one in line 7 in this case).

tutorial

We have created a quick tutorial video here.

download

You can download the project (source only) from sourceforge. Drop me a visit at ohloh if you like the software.


About this entry