In my company, the developers are regularly using CMapStringToStr
objects, and always the pointers have the same type, for a particular parameter, e.g.
m_mapUsers : every pointer is a CL_USER object
m_mapOthers : every pointer is a CL_OTHER object
I already have made a native visualiser for expanding the CMapStringToPtr
in a reasonable readable way, as you can see in this excerpt:
m_mapUsers
0: ["User1"] 0x12345 void*
1: ["User2"] 0x23456 void*
...
m_mapOthers
0: ["Other1"] 0x98765 void*
1: ["Other2"] 0x98764 void*
...
I'd like to have the m_mapUsers
and the m_mapOthers
entries to be recognised, in order to get a result like the following:
m_mapUsers
0: ["User1"] {user=..., group=..., ...} CL_USER
1: ["User2"] {user=..., group=..., ...} CL_USER
...
m_mapOthers
0: ["Other1"] {reason=..., code=...} CL_OTHER
1: ["Other2"] {reason=..., code=...} CL_OTHER
...
Is this possible?
The way I did this in my project is first to have a generic visualization for my linked list. This is what you already have.
<Type Name="MyLinkedList">
<Expand>
<LinkedListItems>
<HeadPointer>this</HeadPointer>
<NextPointer>next</NextPointer>
<ValueNode>pData</ValueNode>
</LinkedListItems>
</Expand>
</Type>
Then I went to the classes where I knew how to interpret the void
pointers, to which type I should cast them. So I created a Synthetic
value with the same name as the member variable, changed the HeadPointer
from this
to the name of the member variable and at last did a type cast for the ValueNode
.
<Type Name="MyClass">
<Expand>
<Synthetic Name="m_list">
<Expand>
<LinkedListItems>
<HeadPointer>m_list</HeadPointer>
<NextPointer>next</NextPointer>
<ValueNode>(TheKnownType*)pData</ValueNode>
</LinkedListItems>
</Expand>
</Synthetic>
</Expand>
</Type>
The disadvantage is that I need to copy the code to multiple places, but it works.
Depending on the types that your pointers point (for example always CObject
?) to it might also be possible to detect the type in the MyLinkedList
and depending on the right Condition
select what to display.