Home Dashboard Directory Help
Search

Problem with debugger visualizer $Tn macros substitution for linked list elements by Arkady Shapkin


Status: 

Closed
 as Duplicate Help for as Duplicate


6
0
Sign in
to vote
Type: Bug
ID: 757151
Opened: 8/5/2012 5:07:22 PM
Access Restriction: Public
0
Workaround(s)
view
1
User(s) can reproduce this bug

Description

I've create debugger visualizer for boost::unordered_map<*, *>, but I can't correctly cast list element to std::pair because $Tn macros differs for container and items
https://github.com/KindDragon/CPPDebuggerVisualizers/blob/master/Visualizers/boost_Unordered.natvis

I've create debugging visualizer for testing:
<Type Name="boost::unordered::unordered_map<*,*>">
    <DisplayString>{{ size={table_.size_} }}</DisplayString>
    <Expand>
        <Synthetic Name="T1">
         <DisplayString>{"$T1"}</DisplayString>
        </Synthetic>
        <Synthetic Name="T2">
         <DisplayString>{"$T2"}</DisplayString>
        </Synthetic>
        <LinkedListItems>
            <Size>table_.size_</Size>
            <HeadPointer>table_.buckets_[table_.bucket_count_].next_</HeadPointer>
            <NextPointer>next_</NextPointer>
            <!--ValueNode>*((std::pair<$T1 const ,$T2>*)this - 1)</ValueNode-->
            <ValueNode>"T1: $T1; T2: $T2"</ValueNode>
        </LinkedListItems>
    </Expand>
</Type>

It show me that T1 and T2 somehow differ types for list elements. How that possible?
Test variable boost::unordered_map<unsigned int, std::list<int>> uml
-        uml    { size=2 }    boost::unordered::unordered_map<unsigned int,std::list<int,std::allocator<int> >,boost::hash<unsigned int>,std::equal_to<unsigned int>,std::allocator<std::pair<unsigned int const ,std::list<int,std::allocator<int> > > > >
        T1    "unsigned int"    
        T2    "std::list<int,std::allocator<int> >"    
+        [0]    "T1: std::string; T2: int"    char[82]
+        [1]    "T1: std::string; T2: int"    char[82]

I've found some comments about that problem:
https://svn.boost.org/trac/boost/ticket/4209#comment:9
Details
Sign in to post a comment.
Posted by Microsoft on 12/19/2012 at 12:52 PM
Thank you for your feedback. We have determined that the problem in question is indeed a bug in our handling of natvis files and are considering fixing this for a future release. In the meantime, you should know that the bug gets triggered when you have a natvis entry for a template class that uses a node type which is not a template class. Given this, you may be able to work around the issue by changing the code so that the list node is a template class which inherits the parent object's template parameters, rather than a non-template class, requiring $T3 to bind to the 3rd parameter type of the parent object. - Visual Studio Debugger Team
Posted by Arkady Shapkin on 8/6/2012 at 5:09 PM
In this comment https://svn.boost.org/trac/boost/ticket/4209#comment:9 problem described more detailed. Problem only when one of template parameters is template class.
Posted by Microsoft on 8/5/2012 at 11:01 PM
Thank you for submitting feedback on Visual Studio 11 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by Microsoft on 8/5/2012 at 5:53 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.