views:

115

answers:

2

I need to see the contents of a std::map variable while debugging. However, if i click on it in the Autos/Locals Tab, I see implementation specific stuff, instead of the keys and its contents which I want to look at. Is there a work-around i'm missing ?

+1  A: 

I don't have a copy of Visual Studio 2003 around to test with, but I just checked VS2008 and 2010 and both automatically display the contents of the map on hover. I vaguely remember having a lot of trouble with STL inspection in 2003, so my guess is that it's a feature that they substantially improved in the intervening years.

If it's possible for your project, you might consider upgrading to Visual C++ 2008 Express, which is free and should have most of the features you need.

Dan Story
+1  A: 

I have no VS2003 nearby at the moment. But you could try to add in "autoexp.dat" the following section (I was sure that in VS2003 there are already included sections for all standard types):

;------------------------------------------------------------------------------
;  std::map
;------------------------------------------------------------------------------

std::map<*>{
    children
    (
        #tree
        (
            head : $c._Myhead->_Parent, 
            skip : $c._Myhead, 
            size : $c._Mysize, 
            left : _Left, 
            right : _Right
        ) : $e._Myval
    )

    preview
    (
        #(
            "[", 
            $e._Mysize, 
            "](", 

            #tree
            (
                head : $c._Myhead->_Parent, 
                skip : $c._Myhead, 
                size : $c._Mysize, 
                left : _Left, 
                right : _Right
            ) : $e._Myval,

            ")"
        )
    )            
}

The structure of this file and the syntax of autoexp rules may change from one release of Visual Studio to the next. Read here more about custom visualizers for Visual Studio.

Kirill V. Lyadvinsky