2D Matrix Watch – Introducing autoexp.dat

Deep inside your VS installation (%VS installation%\Common7\Packages\Debugger), hides a bag of goodies called autoexp.dat.
It is only semi-official, and almost entirely undocumented. Andy Pennell confesses its his fault,  but I suspect there’s more to it.  Admittedly, its still (as of VS2008) fragile, can easily crash the IDE, subject to the dreaded ‘syntax may change’ disclaimer, and generally half baked.   All that being said, its probably the best productivity-enhancer I came across in the Visual Studio universe.

Lacking official documentation, Avery – creator of the VirtualDub video editor/converter – did a spectacular  job of reverse-engineering it (1, 2) .

autoexp’s prominent feature is customization of native variables watch, both as tooltip and in watch windows. Ever wondered how STL containers are wired to the IDE?    How come STL vectors show their contents automatically, but native arrays require manual work?

vec21

Wonder no more – the wiring is done by autoexp. If that sounds even remotely useful to you, go read Avery’s posts now.  You’ll never watch arrays, lists or hash tables the same way again.

now off to a first tweak using autoexp.

Suppose you have a Direct3D-like matrix type:

struct MATRIX
{
	float        _11, _12, _13, _14;
	float        _21, _22, _23, _24;
	float        _31, _32, _33, _34;
	float        _41, _42, _43, _44;
};

and the IDE isn’t doing a very good job of helping you grok its contents:

matwatch11

Fear not!  Declare a MatrixLine type, then re-declare the matrix as a union with an array of MatrixLines:

struct MatrixLine
{float f1, f2, f3, f4; };

struct MATRIX
{
 union
 {
 struct
 {
 float        _11, _12, _13, _14;
 float        _21, _22, _23, _24;
 float        _31, _32, _33, _34;
 float        _41, _42, _43, _44;
 };
 MatrixLine line[4]; // facilitates 2d matrix visualizer in autoexp.dat
 };
};

In autoexp.dat,  under the [Visualizer] section – define a preview for each MatrixLine, and set the Matrix watch to show its MatrixLines:

MatrixLine{
	preview(#([$c.f1,f],", ",[$c.f2,f],", ",[$c.f3,f],", ",[$c.f4,f]))
	children([$c,!])
}

MATRIX{
	preview([$e,!])
	children(
            #array (
                expr: $e.line[$i],
                size: 4
					)
			)
}

and enjoy your shiny new matrix watch!

matwatch21

Advertisement
This entry was posted in Debugging, Visual Studio. Bookmark the permalink.

4 Responses to 2D Matrix Watch – Introducing autoexp.dat

  1. Pingback: Extending Error Codes - to DirectX and Beyond. « Tweaker

  2. Pingback: Stepping Over Unwanted Functions While Debugging « Tweaker

  3. Pingback: Visualizing MFC Containers in autoexp.dat « Ofek’s Visual C++ stuff

  4. Kobi Kai says:

    good oniion mate!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s