Debugger Visualizer for Visual Studio

Recently, I have been playing with implementing a Visual Studio add-in that displays your data structures as graphs live as you debug.



The graph on the right shows current state of the data structure being watched. The graph updates as you step through the code.
Here is an example of more complex structure:



The layout is done using GLEE graph layout engine, which could be possibly replaced by Graphviz or something else.

As I was suspecting prior to the implementation, there is an important issue that needs to be solved: when the user does a step in the debugger, the object graph is rebuilt from scratch and the layout engine calculates new layout. However, even if the graph changes only slightly, it can sometimes affect the layout significantly and therefore confuse the user.
I am currently thinking about matching nodes from current step to the nodes from the previous step (provided the graph doesn't change that much between steps, which is typically true - and when it chages too much, we don't mind layout changes anyway). The matching of the two graphs could be used to preserve the layout until the nodes really have to move. And if they have to move, move them in a way that they preserve relative positions to each other. There is a space for some interesting algorithms here.

Current source code of the add-in is available here.

Posted by Martin Konicek on 3:01 PM 5 comments