Boost C++ Libraries: Ticket #4209: Visualizer VS 2008 to boost::unordered_map https://svn.boost.org/trac10/ticket/4209 <p> I need to visualize the unordered_map for debug. Can you help me? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4209 Trac 1.4.3 Daniel James Wed, 12 May 2010 21:37:31 GMT <link>https://svn.boost.org/trac10/ticket/4209#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4209#comment:1</guid> <description> <p> Sorry, I don't use Visual Studio, so I can't really. In the past there was an effort to create visualizers, but I don't think they ever attempted creating one of the unordered containers, you can read about it on <a class="wiki" href="https://svn.boost.org/trac10/wiki/DebuggerVisualizers">the wiki</a>, the information there might be helpful if you wish to write one. </p> </description> <category>Ticket</category> </item> <item> <author>stl@…</author> <pubDate>Thu, 13 May 2010 06:58:10 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4209#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4209#comment:2</guid> <description> <p> See my <a class="wiki" href="https://svn.boost.org/trac10/wiki/BoostCon">BoostCon</a> 2010 presentation at <a class="ext-link" href="http://www.filetolink.com/17ad36ef"><span class="icon">​</span>http://www.filetolink.com/17ad36ef</a> . </p> <p> VC's visualizer for std::tr1::unordered_map "cheats" because it's backed by a std::list. If boost::unordered_map isn't represented like this, visualizing it may be difficult or impossible. </p> </description> <category>Ticket</category> </item> <item> <author>fernandoofj@…</author> <pubDate>Thu, 13 May 2010 19:54:09 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4209#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4209#comment:3</guid> <description> <p> I made this script below for <a class="missing wiki">AutoExp</a>.dat and this works for simple cases, however, it dont works for these cases (bold): </p> <p> <strong>boost::unordered_map&lt;unsigned int, boost::unordered_map&lt;unsigned int, int&gt;&gt; boost::unordered_map&lt;unsigned int, std::list&lt;int&gt;&gt;</strong> </p> <p> --&gt; Script &lt;-- </p> <p> boost::unordered_map&lt;*,*,*,*,*&gt;{ </p> <blockquote> <p> preview ( </p> <blockquote> <p> #( </p> <blockquote> <p> "<a class="missing wiki">, $e.table_.size_,</a>(", #array ( </p> <blockquote> <p> expr : $e.table_.buckets_[$i], size : $e.table_.bucket_count_, </p> </blockquote> <p> ) : #( </p> <blockquote> <p> #array ( </p> <blockquote> <p> expr: $e, size: $e.next_ != 0 </p> </blockquote> <p> ) : #( </p> <blockquote> <p> #list( </p> <blockquote> <p> head : $e.next_, next : next_ </p> </blockquote> <p> ) : ((std::pair&lt;$T1 const ,$T2&gt; *)(boost::unordered_detail::value_base&lt;std::pair&lt;$T1 const ,$T2&gt; &gt; *)(boost::unordered_detail::hash_node&lt;std::allocator&lt;std::pair&lt;$T1 const ,$T2&gt; &gt;,boost::unordered_detail::ungrouped&gt; *)&amp;$e) </p> </blockquote> <p> ) </p> </blockquote> <p> ),")" </p> </blockquote> <p> ) </p> </blockquote> <p> ) </p> </blockquote> <p> </p> <blockquote> <p> children ( </p> <blockquote> <p> #( </p> <blockquote> <p> [raw members]: [$c,!], #array ( </p> <blockquote> <p> expr : $e.table_.buckets_[$i], size : $e.table_.bucket_count_, </p> </blockquote> <p> ) : #( </p> <blockquote> <p> #array ( </p> <blockquote> <p> expr: $e, size: $e.next_ != 0 </p> </blockquote> <p> ) : #( </p> <blockquote> <p> #list( </p> <blockquote> <p> head : $e.next_, next : next_ </p> </blockquote> <p> ) : ((std::pair&lt;$T1 const ,$T2&gt; *)(boost::unordered_detail::value_base&lt;std::pair&lt;$T1 const ,$T2&gt; &gt; *)(boost::unordered_detail::hash_node&lt;std::allocator&lt;std::pair&lt;$T1 const ,$T2&gt; &gt;,boost::unordered_detail::ungrouped&gt; *)&amp;$e)) </p> </blockquote> </blockquote> </blockquote> </blockquote> </blockquote> <p> </p> <blockquote> <blockquote> <blockquote> <blockquote> <p> ) </p> </blockquote> <p> ) </p> </blockquote> <p> ) </p> </blockquote> <p> ) </p> </blockquote> <p> } </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 14 May 2010 11:37:12 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/4209#comment:4 https://svn.boost.org/trac10/ticket/4209#comment:4 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Daniel James</span> to <span class="trac-author">John Maddock</span> </li> </ul> Ticket John Maddock Tue, 18 May 2010 12:07:36 GMT <link>https://svn.boost.org/trac10/ticket/4209#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4209#comment:5</guid> <description> <p> Why has this been assigned to me? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 18 May 2010 19:00:16 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/4209#comment:6 https://svn.boost.org/trac10/ticket/4209#comment:6 <ul> <li><strong>owner</strong> changed from <span class="trac-author">John Maddock</span> to <span class="trac-author">Daniel James</span> </li> </ul> Ticket Daniel James Sun, 27 Jun 2010 16:51:19 GMT attachment set https://svn.boost.org/trac10/ticket/4209 https://svn.boost.org/trac10/ticket/4209 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">unordered-visualizers.dat</span> </li> </ul> <p> Visualizer for the unordered containers </p> Ticket Daniel James Sun, 27 Jun 2010 16:56:05 GMT milestone changed https://svn.boost.org/trac10/ticket/4209#comment:7 https://svn.boost.org/trac10/ticket/4209#comment:7 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.43.0</span> → <span class="trac-field-new">To Be Determined</span> </li> </ul> <p> I couldn't get that to work, so I tried writing one. I've attached what I've got so far. It crashes for uninitialized containers, I'm not sure how to work round that - maybe only display up to a maximum size? I'll try to get back to this, but it might be a while, so don't let that stop you working on it. I think it could be done a little better if I didn't use allocators to pass <code>value_type</code>, which was a bit of an odd thing to do, so I might look into changing that. </p> Ticket Daniel James Mon, 28 Feb 2011 23:09:37 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4209#comment:8 https://svn.boost.org/trac10/ticket/4209#comment:8 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> Sorry, this is beyond me. I'm not a Visual C++ user so I'm not going to be able to complete this. </p> Ticket brian.ventre@… Thu, 03 Nov 2011 16:42:46 GMT <link>https://svn.boost.org/trac10/ticket/4209#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4209#comment:9</guid> <description> <p> I started looking at this yesterday, and haven't gotten very far, but wanted to add what I have found so that others can start somewhere. </p> <p> So far, the original attached file has mostly worked for me under VS2005SP1 (only tested unordered_set &amp; unordered_map). However, as one of the earlier posters noted, it does not work for the case: </p> <pre class="wiki">boost::unordered_map&lt;int, boost::unordered_set&lt;int&gt; &gt; </pre><p> The problem is the <code>$T2</code> substitution. When VS does the text substitution in the pointer cast, it simply replaces <code>$T2</code> with the second template argument. The problem is the ambiguity with templates and the <code>&gt;&gt;</code> string. The original line is: </p> <pre class="wiki">((std::pair&lt;$T1 const ,$T2&gt; *)(boost::unordered_detail::value_base&lt;std::pair&lt;$T1 const ,$T2&gt; &gt; *)(boost::unordered_detail::hash_node&lt;std::allocator&lt;std::pair&lt;$T1 const ,$T2&gt; &gt;,boost::unordered_detail::ungrouped&gt; *)&amp;$e) </pre><p> If you have a plain map, like say <code>unordered_map&lt;int,int&gt;</code>, then this expands to: </p> <pre class="wiki">((std::pair&lt;int const ,int&gt; *)(boost::unordered_detail::value_base&lt;std::pair&lt;int const ,int&gt; &gt; *)(boost::unordered_detail::hash_node&lt;std::allocator&lt;std::pair&lt;int const ,int&gt; &gt;,boost::unordered_detail::ungrouped&gt; *)&amp;$e) </pre><p> VS is ok with this, and the visualizer works. If you have a map where the second template argument is itself a template, (like <code>unordered_map&lt;int,unordered_set&lt;int&gt; &gt;</code>), you get: </p> <pre class="wiki">((std::pair&lt;int const ,unordered_set&lt;int&gt;&gt; *)(boost::unordered_detail::value_base&lt;std::pair&lt;int const ,unordered_set&lt;int&gt;&gt; &gt; *)(boost::unordered_detail::hash_node&lt;std::allocator&lt;std::pair&lt;int const ,unordered_set&lt;int&gt;&gt; &gt;,boost::unordered_detail::ungrouped&gt; *)&amp;$e) </pre><p> VS is NOT ok with this. The problem is in the <code>&gt;&gt;</code> that results due to the plain text substitution it performs. A workaround would be to add a space after each instance of <code>$T2</code> in the original line: </p> <pre class="wiki">((std::pair&lt;$T1 const ,$T2 &gt; *)(boost::unordered_detail::value_base&lt;std::pair&lt;$T1 const ,$T2 &gt; &gt; *)(boost::unordered_detail::hash_node&lt;std::allocator&lt;std::pair&lt;$T1 const ,$T2 &gt; &gt;,boost::unordered_detail::ungrouped&gt; *)&amp;$e) </pre><p> This fixes the case where the second template argument is itself a template, but breaks the first case (where it is not). So, with all of this, you can have one or the other (templates or no templates...). </p> <p> My naive workaround (and I don't have it in front of me, sorry), is to double up the entire <code>#array</code> statement, with one version being the "with spaces" and one the "without". This means you end up with double the elements in the visualizer, half of which are always <code>(error)</code>, while the other half are correct. That gets me at least half-way there, while being more expensive with screen real-estate. </p> <p> Hope this helps anyone else who stumbles across this page. </p> </description> <category>Ticket</category> </item> <item> <author>JotaDeHace@…</author> <pubDate>Mon, 23 Apr 2012 20:20:21 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/4209 https://svn.boost.org/trac10/ticket/4209 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_1_49_0_unordered_VC10.dat</span> </li> </ul> <p> autoexp.dat entries for unordered map and set visualizers working in VC10.0 for boost 1.49.0 </p> Ticket anonymous Mon, 23 Apr 2012 20:24:38 GMT <link>https://svn.boost.org/trac10/ticket/4209#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4209#comment:10</guid> <description> <p> After much frustration trying to find working visualizers for unordered_map and unordered_set, I bit the bullet and created a couple that work for me under Visual Studio 10.0 with boost version 1.49.0. I've attached a file to this ticket with those visualizers. Hope it can save someone some of the debugging frustrations I've had with these very useful data structures. </p> <p> J.D. Herron </p> <p> email: <a class="missing wiki">JotaDeHace</a>@gmail.com </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Daniel James</dc:creator> <pubDate>Mon, 23 Apr 2012 23:31:40 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4209#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4209#comment:11</guid> <description> <p> Thanks for sharing. The data structure had changed since the older visualizers were written, which is why none of them work now. It might be a good idea to share this on the developer list, could possibly start a collection of visualizers somewhere? </p> <p> This visualizer won't work for allocators with custom pointer types, which don't use ptr_node. I'm not sure if there's anything that can be done about that. </p> <p> Also, it might break in an upcoming version, as I'm changing the way values are stored. Now that forwarding constructors are possible the hacks used to allocate aligned space might not be needed. At least that should simplify things a bit. </p> </description> <category>Ticket</category> </item> <item> <author>dlaugt@…</author> <pubDate>Tue, 25 Sep 2012 15:00:51 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4209#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4209#comment:12</guid> <description> <p> Great the file is still working for boost 1.51 with VC10. Is it possible to have the unordered_multimap and unordered_multiset versions? </p> </description> <category>Ticket</category> </item> <item> <author>dlaugt@…</author> <pubDate>Tue, 25 Sep 2012 15:22:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4209#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4209#comment:13</guid> <description> <p> It seems that single and multi are the same versions. It works fine for me. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 25 Feb 2013 01:40:59 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4209#comment:14 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4209#comment:14</guid> <description> <p> How did you make it work? I'm using boost 1.51 and VS 2010. But it shows size of container correctly but not it's contents. Did you modify dat file? </p> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4209#comment:13" title="Comment 13">dlaugt@…</a>: </p> <blockquote class="citation"> <p> It seems that single and multi are the same versions. It works fine for me. </p> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>Daniel James</dc:creator> <pubDate>Sun, 03 Mar 2013 13:20:00 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4209#comment:15 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4209#comment:15</guid> <description> <p> I don't think the relevant people are reading this. I don't know anything about Visual Studio visualizers so I can't help. You might have better luck on the boost user list, or perhaps stackoverflow or a Visual Studio forum. </p> </description> <category>Ticket</category> </item> <item> <author>teolazza@…</author> <pubDate>Thu, 07 Jul 2016 10:00:12 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4209#comment:16 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4209#comment:16</guid> <description> <p> Here is my version. I've tested it on VS2010, SP1 and with boost 1.61.0 </p> <pre class="wiki">;------------------------------------------------------------------------------ ; boost unordered collections ;------------------------------------------------------------------------------ boost::unordered::unordered_map&lt;*,*,*,*,*&gt;{ preview ( #( "[", $e.table_.size_, "](", #list( head: $e.table_.buckets_[$e.table_.bucket_count_].next_, size: $e.table_.size_, next: next_ ) : #(*((std::pair&lt;$T1 const ,$T2&gt;*)&amp;(*(boost::unordered::detail::ptr_node&lt;std::pair&lt;$T1 const ,$T2&gt; &gt; *)(&amp;$e)).value_base_)), ")" )) children( #( size: ($e.table_.size_), #list( head: $e.table_.buckets_[$e.table_.bucket_count_].next_, size: $e.table_.size_, next: next_ ) : #(*((std::pair&lt;$T1 const ,$T2&gt;*)&amp;(*(boost::unordered::detail::ptr_node&lt;std::pair&lt;$T1 const ,$T2&gt; &gt; *)(&amp;$e)).value_base_)), )) } boost::unordered::unordered_set&lt;*,*,*,*&gt;{ preview ( #( "[", $e.table_.size_, "](", #list( head: $e.table_.buckets_[$e.table_.bucket_count_].next_, size: $e.table_.size_, next: next_ ) : #(*(($T1*)&amp;((*(boost::unordered::detail::ptr_node&lt;$T1&gt;*)(&amp;$e)).value_base_))), ")" )) children( #( size: ($e.table_.size_), #list( head: $e.table_.buckets_[$e.table_.bucket_count_].next_, size: $e.table_.size_, next: next_ ) : #(*(($T1*)&amp;((*(boost::unordered::detail::ptr_node&lt;$T1&gt;*)(&amp;$e)).value_base_))), )) } </pre> </description> <category>Ticket</category> </item> </channel> </rss>