2
votes

When I try viewing a std::list in the Visual Studio debugger, I basically just want to see an array of all the myList.size values that list contains. In an ideal world, I could just do that by typing "MyList, x" for some x < myList.size into the Watch Window.

However, that does nothing. Instead, I must expand a ridiculous amount of variables by hand to see each value, one by one:

myList -> std::_List_val -> std::_List_nod -> _Myhead -> _Myval

And that's just for the first value in the list.

This is an awful way of debug-viewing the values in my list. Is there any way I can just see all the values in the list without worrying about the implementation details?

This question also applies to other STD containers, such as vectors. I just want to do "MyStdContainer, x" and not care about how I'm containing my variables.

Thanks!

1
You should actually be seeing std::list as if it was an array in VS debugger windows by default, in any moderately recent version of VS (I think since 2005 on?) - e.g. see technet.microsoft.com/en-us/query/aa718539. Are you using a third-party implementation of STL, by chance (e.g. STLPort)? - Pavel Minaev
Really? I definitely don't. First party implementation of STL, VS2010. - Ben Walker
Make sure you don't have "Show raw structure of objects in variable windows" checked in Tools -> Options -> Debugging -> General. - Pavel Minaev
Huh. Good guess, but I don't have it checked. I'm suspicious now that I know it's already supposed to be a default feature, will ask around. - Ben Walker

1 Answers

2
votes

Sounds like your autoexp.dat file is missing or corrupt. This is usually located in %VSINSTALLDIR%\Common7\Packages\Debugger\ and provides the information required by the debugger to visualise std:: containers.

If you find this file, the section relating to std::list begins:

;------------------------------------------------------------------------------
;  std::list from <list>
;------------------------------------------------------------------------------