Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions resources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,17 @@ if (MSVC_IDE)
visualstudio/stllist.natvis
visualstudio/stlvector.natvis
visualstudio/unicodestring.natvis
visualstudio/wwlib/hash.natvis
visualstudio/wwlib/hashtemplate.natvis
visualstudio/wwlib/listnode.natvis
visualstudio/wwlib/mpsc_intrusive_queue.natvis
visualstudio/wwlib/multilist.natvis
visualstudio/wwlib/sharebuf.natvis
visualstudio/wwlib/simplevec.natvis
visualstudio/wwlib/slist.natvis
visualstudio/wwlib/uarray.natvis
visualstudio/wwlib/vector.natvis
visualstudio/wwlib/widestring.natvis
visualstudio/wwlib/wwstring.natvis
)
endif()
15 changes: 10 additions & 5 deletions resources/visualstudio/asciistring.natvis
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- m_data points to a ref counted AsciiStringData header, and the characters follow
directly behind it. No length is stored, so it is counted like getLength does. -->
<Type Name="AsciiString">
<DisplayString Condition="m_data != nullptr">{(const char *)(&amp; m_data[1]),s8}</DisplayString>
<DisplayString Condition="m_data == nullptr">""</DisplayString>
<DisplayString Condition="m_data == 0">""</DisplayString>
<DisplayString>{(const char *)(m_data + 1),s8}</DisplayString>
<StringView Condition="m_data != 0">(const char *)(m_data + 1),s8</StringView>
<Expand>
<Item Name="[data]" Optional="true" Condition="m_data != nullptr">m_data</Item>
<Item Name="[str]" Optional="true" Condition="m_data != nullptr">(const char *)(&amp; m_data[1])</Item>
<Item Name="[length]" ExcludeView="simple">m_data == 0 ? 0 : (int)strnlen((const char *)(m_data + 1), m_data-&gt;m_numCharsAllocated)</Item>
<Item Name="[capacity]" Condition="m_data != 0" ExcludeView="simple">(int)m_data-&gt;m_numCharsAllocated</Item>
<Item Name="[refs]" Condition="m_data != 0" ExcludeView="simple">(int)m_data-&gt;m_refCount</Item>
<Item Name="[str]" Condition="m_data != 0">(const char *)(m_data + 1),s8</Item>
</Expand>
</Type>
</AutoVisualizer>
</AutoVisualizer>
15 changes: 10 additions & 5 deletions resources/visualstudio/unicodestring.natvis
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- m_data points to a ref counted UnicodeStringData header, and the characters follow
directly behind it. No length is stored, so it is counted like getLength does. -->
<Type Name="UnicodeString">
<DisplayString Condition="m_data != nullptr">{(const wchar_t *)(&amp; m_data[1]),su}</DisplayString>
<DisplayString Condition="m_data == nullptr">""</DisplayString>
<DisplayString Condition="m_data == 0">""</DisplayString>
<DisplayString>{(const wchar_t *)(m_data + 1),su}</DisplayString>
<StringView Condition="m_data != 0">(const wchar_t *)(m_data + 1),su</StringView>
<Expand>
<Item Name="[data]" Optional="true" Condition="m_data != nullptr">m_data</Item>
<Item Name="[str]" Optional="true" Condition="m_data != nullptr">(const wchar_t *)(&amp; m_data[1])</Item>
<Item Name="[length]" ExcludeView="simple">m_data == 0 ? 0 : (int)wcsnlen((const wchar_t *)(m_data + 1), m_data-&gt;m_numCharsAllocated)</Item>
<Item Name="[capacity]" Condition="m_data != 0" ExcludeView="simple">(int)m_data-&gt;m_numCharsAllocated</Item>
<Item Name="[refs]" Condition="m_data != 0" ExcludeView="simple">(int)m_data-&gt;m_refCount</Item>
<Item Name="[str]" Condition="m_data != 0">(const wchar_t *)(m_data + 1),su</Item>
</Expand>
</Type>
</AutoVisualizer>
</AutoVisualizer>
36 changes: 36 additions & 0 deletions resources/visualstudio/wwlib/hash.natvis
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- Buckets hold the head of a chain that is threaded through HashableClass::NextHash,
so the entries are gathered with a bucket loop wrapped around a chain loop. -->
<Type Name="HashTableClass">
<DisplayString>{{ buckets={HashTableSize} }}</DisplayString>
<Expand>
<Item Name="[buckets]" ExcludeView="simple">HashTableSize</Item>
<CustomListItems>
<Variable Name="bucket" InitialValue="0"/>
<Variable Name="entry" InitialValue="(HashableClass *)0"/>
<Loop>
<Break Condition="bucket &gt;= HashTableSize"/>
<Exec>entry = HashTable[bucket]</Exec>
<Loop>
<Break Condition="entry == 0"/>
<Item>entry</Item>
<Exec>entry = entry-&gt;NextHash</Exec>
</Loop>
<Exec>bucket = bucket + 1</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>

<Type Name="HashTableIteratorClass">
<DisplayString Condition="CurrentEntry == 0">{{ done }}</DisplayString>
<DisplayString>{*CurrentEntry}</DisplayString>
Comment thread
xezon marked this conversation as resolved.
<Expand>
<Item Name="[current]">CurrentEntry</Item>
<Item Name="[next]" ExcludeView="simple">NextEntry</Item>
<Item Name="[bucket]" ExcludeView="simple">Index</Item>
<Item Name="[table]" ExcludeView="simple">Table</Item>
</Expand>
</Type>
</AutoVisualizer>
36 changes: 36 additions & 0 deletions resources/visualstudio/wwlib/hashtemplate.natvis
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- Hash holds one handle per bucket into Table, and the chain is threaded through
Table[handle].Next. Both use the class's NIL sentinel, which is -1. -->
<Type Name="HashTemplateClass&lt;*,*&gt;">
<DisplayString>{{ buckets={(int)Size} }}</DisplayString>
<Expand>
<Item Name="[buckets]" ExcludeView="simple">(int)Size</Item>
<CustomListItems>
<Variable Name="bucket" InitialValue="0"/>
<Variable Name="handle" InitialValue="-1"/>
<Loop>
<Break Condition="bucket &gt;= (int)Size"/>
<Exec>handle = Hash[bucket]</Exec>
<Loop>
<Break Condition="handle == -1"/>
<Item Name="{Table[handle].Key}">Table[handle].Value</Item>
<Exec>handle = Table[handle].Next</Exec>
</Loop>
<Exec>bucket = bucket + 1</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>

<Type Name="HashTemplateIterator&lt;*,*&gt;">
<DisplayString Condition="Handle == -1">{{ done }}</DisplayString>
<DisplayString>{HashTable.Table[Handle].Value}</DisplayString>
<Expand>
<Item Name="[key]" Condition="Handle != -1">HashTable.Table[Handle].Key</Item>
<Item Name="[value]" Condition="Handle != -1">HashTable.Table[Handle].Value</Item>
<Item Name="[bucket]" ExcludeView="simple">HashIndex</Item>
<Item Name="[table]" ExcludeView="simple">HashTable</Item>
</Expand>
</Type>
</AutoVisualizer>
64 changes: 64 additions & 0 deletions resources/visualstudio/wwlib/listnode.natvis
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- GenericList embeds two sentinel nodes by value. FirstNode.NextNode is the first
real entry, and LastNode is recognised by having no NextNode of its own. -->
<Type Name="GenericList">
<DisplayString Condition="FirstNode.NextNode-&gt;NextNode == 0">{{ size=0 }}</DisplayString>
<DisplayString>{{ GenericList }}</DisplayString>
<Expand>
<CustomListItems>
<Variable Name="node" InitialValue="FirstNode.NextNode"/>
<Loop>
<Break Condition="node == 0 || node-&gt;NextNode == 0"/>
<Item>node</Item>
<Exec>node = node-&gt;NextNode</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>

<!-- List's template argument is already a pointer type, so the item cast is ($T1)
rather than ($T1 *). This only works because GenericNode must be the first base
of the linked object, which is what the class comment in LISTNODE.h requires. -->
<Type Name="List&lt;*&gt;">
<DisplayString Condition="FirstNode.NextNode-&gt;NextNode == 0">{{ size=0 }}</DisplayString>
<DisplayString>{{ List }}</DisplayString>
<Expand>
<CustomListItems>
<Variable Name="node" InitialValue="FirstNode.NextNode"/>
<Loop>
<Break Condition="node == 0 || node-&gt;NextNode == 0"/>
<Item>($T1)node</Item>
<Exec>node = node-&gt;NextNode</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>

<Type Name="GenericNode">
<DisplayString Condition="NextNode == 0 || PrevNode == 0">{{ unlinked }}</DisplayString>
<DisplayString>{{ GenericNode }}</DisplayString>
<Expand>
<Item Name="[next]">NextNode</Item>
<Item Name="[prev]">PrevNode</Item>
</Expand>
</Type>

<Type Name="Node&lt;*&gt;">
<DisplayString Condition="NextNode == 0 || PrevNode == 0">{{ unlinked }}</DisplayString>
<DisplayString>{{ Node }}</DisplayString>
<Expand>
<Item Name="[next]">($T1)NextNode</Item>
<Item Name="[prev]">($T1)PrevNode</Item>
</Expand>
</Type>

<Type Name="DataNode&lt;*&gt;">
<DisplayString>{Value}</DisplayString>
<Expand>
<Item Name="[value]">Value</Item>
<Item Name="[next]" ExcludeView="simple">(DataNode&lt;$T1&gt; *)NextNode</Item>
<Item Name="[prev]" ExcludeView="simple">(DataNode&lt;$T1&gt; *)PrevNode</Item>
</Expand>
</Type>
</AutoVisualizer>
19 changes: 19 additions & 0 deletions resources/visualstudio/wwlib/mpsc_intrusive_queue.natvis
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- Push prepends, and the chain is only reversed inside Flush, so the entries below
are listed newest first, which is the reverse of the order a consumer will see. -->
<Type Name="MPSCIntrusiveQueue&lt;*&gt;">
<DisplayString Condition="m_head == 0">{{ empty }}</DisplayString>
<DisplayString>{{ MPSCIntrusiveQueue }}</DisplayString>
<Expand>
<CustomListItems>
<Variable Name="node" InitialValue="m_head"/>
<Loop>
<Break Condition="node == 0"/>
<Item>node</Item>
<Exec>node = node-&gt;next</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>
</AutoVisualizer>
103 changes: 103 additions & 0 deletions resources/visualstudio/wwlib/multilist.natvis
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- Head is an embedded sentinel and the list is circular, so the walk ends when it
comes back round to &Head rather than on a null link. -->
<Type Name="GenericMultiListClass">
<DisplayString Condition="Head.Next == &amp;Head">{{ size=0 }}</DisplayString>
<DisplayString>{{ GenericMultiList }}</DisplayString>
<Expand>
<CustomListItems>
<Variable Name="node" InitialValue="Head.Next"/>
<Loop>
<Break Condition="node == &amp;Head"/>
<Item>node-&gt;Object</Item>
<Exec>node = node-&gt;Next</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>

<!-- Must be spelled out even though GenericMultiListClass already matches by
inheritance, so that the entries come out as the list's own object type. -->
<Type Name="MultiListClass&lt;*&gt;">
<DisplayString Condition="Head.Next == &amp;Head">{{ size=0 }}</DisplayString>
<DisplayString>{{ MultiList }}</DisplayString>
<Expand>
<CustomListItems>
<Variable Name="node" InitialValue="Head.Next"/>
<Loop>
<Break Condition="node == &amp;Head"/>
<Item>($T1 *)node-&gt;Object</Item>
<Exec>node = node-&gt;Next</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>

<Type Name="RefMultiListClass&lt;*&gt;">
<DisplayString Condition="Head.Next == &amp;Head">{{ size=0 }}</DisplayString>
<DisplayString>{{ RefMultiList }}</DisplayString>
<Expand>
<CustomListItems>
<Variable Name="node" InitialValue="Head.Next"/>
<Loop>
<Break Condition="node == &amp;Head"/>
<Item>($T1 *)node-&gt;Object</Item>
<Exec>node = node-&gt;Next</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>

<!-- ListNode chains across every list the object is in, via NextList. -->
<Type Name="MultiListObjectClass">
<DisplayString Condition="ListNode == 0">{{ not in any list }}</DisplayString>
<DisplayString>{{ in list(s) }}</DisplayString>
<Expand>
<Synthetic Name="[lists]">
<DisplayString>lists this object belongs to</DisplayString>
<Expand>
<CustomListItems>
<Variable Name="node" InitialValue="ListNode"/>
<Loop>
<Break Condition="node == 0"/>
<Item>node-&gt;List</Item>
<Exec>node = node-&gt;NextList</Exec>
</Loop>
</CustomListItems>
</Expand>
</Synthetic>
</Expand>
</Type>

<Type Name="MultiListNodeClass">
<DisplayString>{{ object={Object} }}</DisplayString>
<Expand>
<Item Name="[object]">Object</Item>
<Item Name="[list]">List</Item>
<Item Name="[next]" ExcludeView="simple">Next</Item>
<Item Name="[prev]" ExcludeView="simple">Prev</Item>
<Item Name="[next list]" ExcludeView="simple">NextList</Item>
</Expand>
</Type>

<Type Name="GenericMultiListIterator">
<DisplayString Condition="CurNode == &amp;List-&gt;Head">{{ done }}</DisplayString>
<DisplayString>{CurNode-&gt;Object}</DisplayString>
<Expand>
<Item Name="[current]" Condition="CurNode != &amp;List-&gt;Head">CurNode-&gt;Object</Item>
<Item Name="[list]">List</Item>
</Expand>
</Type>

<Type Name="MultiListIterator&lt;*&gt;">
<AlternativeType Name="RefMultiListIterator&lt;*&gt;"/>
<AlternativeType Name="PriorityMultiListIterator&lt;*&gt;"/>
<DisplayString Condition="CurNode == &amp;List-&gt;Head">{{ done }}</DisplayString>
<DisplayString>{*($T1 *)CurNode-&gt;Object}</DisplayString>
<Expand>
<Item Name="[current]" Condition="CurNode != &amp;List-&gt;Head">($T1 *)CurNode-&gt;Object</Item>
<Item Name="[list]">List</Item>
</Expand>
</Type>
</AutoVisualizer>
16 changes: 16 additions & 0 deletions resources/visualstudio/wwlib/sharebuf.natvis
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="ShareBufferClass&lt;*&gt;">
<DisplayString>{{ size={Count} }}</DisplayString>
<Expand>
<Item Name="[size]" ExcludeView="simple">Count</Item>
<Item Name="[refs]" ExcludeView="simple">NumRefs</Item>
<!-- Msg only exists in RTS_DEBUG builds. -->
<Item Name="[msg]" Optional="true" ExcludeView="simple">Msg,s</Item>
<ArrayItems>
<Size>Count</Size>
<ValuePointer>Array</ValuePointer>
</ArrayItems>
</Expand>
</Type>
</AutoVisualizer>
27 changes: 27 additions & 0 deletions resources/visualstudio/wwlib/simplevec.natvis
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="SimpleVecClass&lt;*&gt;">
<DisplayString>{{ size={VectorMax} }}</DisplayString>
<Expand>
<Item Name="[size]" ExcludeView="simple">VectorMax</Item>
<ArrayItems>
<Size>VectorMax</Size>
<ValuePointer>Vector</ValuePointer>
</ArrayItems>
</Expand>
</Type>

<!-- Must be spelled out even though SimpleVecClass already matches by inheritance,
because the live element count here is ActiveCount and not VectorMax. -->
<Type Name="SimpleDynVecClass&lt;*&gt;">
<DisplayString>{{ size={ActiveCount} }}</DisplayString>
<Expand>
<Item Name="[size]" ExcludeView="simple">ActiveCount</Item>
<Item Name="[capacity]" ExcludeView="simple">VectorMax</Item>
<ArrayItems>
<Size>ActiveCount</Size>
<ValuePointer>Vector</ValuePointer>
</ArrayItems>
</Expand>
</Type>
</AutoVisualizer>
27 changes: 27 additions & 0 deletions resources/visualstudio/wwlib/slist.natvis
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- The links and the payload both live in the GenericSLNode base as void pointers,
so each has to be cast back to the list's element type on the way out. -->
<Type Name="SList&lt;*&gt;">
<DisplayString Condition="HeadNode == 0">{{ size=0 }}</DisplayString>
<DisplayString>{{ SList }}</DisplayString>
<Expand>
<CustomListItems>
<Variable Name="node" InitialValue="HeadNode"/>
<Loop>
<Break Condition="node == 0"/>
<Item>($T1 *)node-&gt;NodeData</Item>
<Exec>node = (SLNode&lt;$T1&gt; *)node-&gt;NodeNext</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>

<Type Name="SLNode&lt;*&gt;">
<DisplayString>{*($T1 *)NodeData}</DisplayString>
<Expand>
<Item Name="[data]">($T1 *)NodeData</Item>
<Item Name="[next]">(SLNode&lt;$T1&gt; *)NodeNext</Item>
</Expand>
</Type>
</AutoVisualizer>
Loading
Loading