12

I'm considering using boost::ptr_container as a result of the responses from this question. My biggest problem with the library is that I cannot view the contents of the collection in the debugger, because the MSVC debugger doesn't recognize it, and therefore I cannot see the contents of the containers. (All the data gets stored as void * internally)

I've heard MSVC has a feature called "debugger visualizers" which would allow the user to make the debugger smarter about these kinds of things, but I've never written anything like this, and I'm not hugely firmiliar with such things.

For example, compare the behavior of boost::shared_ptr with MSVC's own std::tr1::shared_ptr. In the debugger (i.e. in the Watch window), the boost version shows up as a big mess of internal variables used for implementing the shared pointer, but the MSVC version shows up as a plain pointer to the object (and the shared_ptr's innards are hidden).

How can I get started either using or implementing such a thing?

Community
  • 1
  • 1
Billy ONeal
  • 104,103
  • 58
  • 317
  • 552

4 Answers4

13

See this link which provides every debugger visualizer (through autoexp.dat) you may want :

All visualizers are available in the svn. Currently, we support the following Boost types:

  • boost::array, ptr_array, ptr_deque, ptr_list, ptr_map, ptr_multimap, ptr_set, ptr_multiset, ptr_vector
  • boost::interprocess::offset_ptr
  • boost::optional
  • boost::multi_index_container
  • boost::shared_ptr
  • boost::posix_time::ptime,
  • boost::posix_time::time_duration (two variants are available)
  • boost::regex
  • boost::variant
icecrime
  • 74,451
  • 13
  • 99
  • 111
3

Some possibly useful information on MSDN:

A codeproject sample or two:

All of them involve autoexp.dat in some way, making that an effective search term.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
  • Note that `autoexp.dat` is basically undocumented. The file itself contains some examples and rudimentary documentation, but outside of that, you're pretty much on your own. – jalf Dec 26 '10 at 11:39
  • @jalf: It can hardly be undocumented when I've provided links to the documentation, now can it? I guess there may be `autoexp.dat` syntax not covered there, but since writing an EE addin is documented, you can do pretty much anything. – Ben Voigt Dec 26 '10 at 18:05
  • The only *official* documentation is the one in the file itself. Note that the MSDN page you linked to also just says "Instructions on how to write autoexp rules are located in the file itself." ;) – jalf Dec 26 '10 at 18:18
  • @jalf: At the bottom of that MSDN page is a link here: http://msdn.microsoft.com/en-us/library/8fwk67y3.aspx, which looks like it covers all the `autoexp.dat` syntax necessary for loading a custom visualizer addin quite completely (the `autoexp.dat` part is pretty minimal). Writing the add-in on the other hand, sounds like the documentation consists almost exclusively of samples. – Ben Voigt Dec 26 '10 at 18:22
2

You can use this extension for Visual Studio 2012+, check this link. They based on visualizers from boost svn for Visual Studio 2008/2010

Extension support the following Boost types:

  • boost::shared_ptr, boost::weak_ptr, boost::intrusive_ptr, boost::shared_array, boost::scoped_ptr, boost::scoped_array
  • boost::ptr_array, boost::ptr_vector, boost::ptr_list, boost::ptr_deque, boost::ptr_map, boost::ptr_set, boost::ptr_multimap, boost::ptr_multiset
  • boost::array, boost::dynamic_bitset, boost::circular_buffer boost::unordered_map, boost::unordered_set, boost::unordered_multimap, boost::unordered_multiset
  • boost::intrusive::list, boost::intrusive::slist
  • boost::container::basic_string, boost::container::deque, boost::container::vector
  • boost::optional, boost::any, boost::variant
  • boost::filesystem::path, boost::filesystem::directory_entry, boost::filesystem::file_status
  • boost::posix_time::ptime, boost::posix_time::time_duration
  • boost::regex
  • boost::interprocess::offset_ptr
  • boost::tribool
  • boost::unique_lock
  • boost::uuids::uuid
KindDragon
  • 6,558
  • 4
  • 47
  • 75
  • This is now moved to [CPPDebuggerVisualizers](https://github.com/KindDragon/CPPDebuggerVisualizers) on GitHub, and can be installed as an extension directly in Visual Studio (as of VS2015 the free version allows installing extensions). Of course you know that since you wrote/maintain this, but just commenting for others. – Arthur Tacca Jul 09 '20 at 16:30
-1

Debugger visualizers are only available for managed code, according to http://msdn.microsoft.com/en-us/library/zayyhzts.aspx which provides more information about them.

Alexandre C.
  • 55,948
  • 11
  • 128
  • 197
  • +1 -- perhaps I'm using the wrong word then -- I'd just like the contents of a `boost::ptr_vector` to show up just like a `std::vector` does in the debugger. – Billy ONeal Dec 26 '10 at 00:53