Sign in to follow this  
Dave Eberly

VS 2010, autoexp.dat, and templates

Recommended Posts

I use autoexp.dat to control the summary display of class objects in a debugger watch window. For example, I have in the [AutoExpand] section

Wm5::Vector2<*>=x=<mTuple[0],g>, y=<mTuple[1],g>


where * denotes a template parameter. This works fine, but I do not see in the rules section of autoexp.dat how to write a similar expression for classes with two or more template parameters. For example, I have Wm5::Tuple<int DIM, typename REAL> with data member 'REAL mTuple[DIM]'. I want the debugger to display members for small dimensions, say 2, so I tried

Wm5::Tuple<2,*>=x=<mTuple[0]>, y=<mTuple[1]>


The debugger shows only the default (the pointer value for mTuple), so this must not be the correct syntax.

Anyone know how to make this system work for templates with two or more parameters?

Share this post


Link to post
Share on other sites
I believe that you can do this with a visualizer, but that information is notoriously difficult to come by. I would take a look here and here first, then try Google again with something like "autoexp.dat Visualizer" :/

Share this post


Link to post
Share on other sites
Quote:
Original post by Zipster
I believe that you can do this with a visualizer, but that information is notoriously difficult to come by. I would take a look here and here first, then try Google again with something like "autoexp.dat Visualizer" :/


I had searched using Google and found the virtualdub.org links. At least the searches I used found information, but not quite what I want. I looked into using a visualizer and examined the std::vector visualizer code already in autoexp.dat. That visualizer knows how many elements to display in the summary, because it uses _Mylast - _Myfirst. In my case, the number of elements is the integer DIM (the first template parameter) and I do not know how to access that (or even whether I can access that) using the scripting language that autoexp.dat uses. As you say, the information is hard to come by. Given the power of autoexp.dat, you would think that there is some well-known documentation somewhere.

I was hoping for something simpler than tracking down undocumented stuff or spending time learning how to write an add-in. I'll Google again and look at your links. Thanks.

Share this post


Link to post
Share on other sites
Quote:
Original post by Zipster
I believe that you can do this with a visualizer, but that information is notoriously difficult to come by. I would take a look here and here first, then try Google again with something like "autoexp.dat Visualizer" :/


I looked at the virtualdub.org link you posted. One of the responses ("If your template(s) look anything like this:") mentions this "solution".

template< class Elem, int size >
class TA {
public:
Elem data[ size ];
};

TA<*,*>{
preview (#(
"(",
#array(
expr: $e.data[$i],
size: $T2
),
")"
))
children (
#array(
expr: $e.data[$i],
size: $T2
)
)
}



This did not look right to me, because the article has an example that uses $T1 in a context that indicates it expands to a type, not to the value of the type (as in an int template parameter). I tried this example and it does not work as advertised. The article's author also mentions "sizeof" is not supported in the scripting language. The article was posted in July 2006 with an update in 2007, but I have not investigated to see whether the scripting language has more power to it now.

Share this post


Link to post
Share on other sites
I must have screwed up the visualizer somehow, because things were failing that should have worked. The example I said did not work in fact does (once you type in the scripting code correctly). Thanks, zipster. The visualdub.org link was very useful.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this