Skip to content

Commit 122c037

Browse files
MaulingMonkeyAmanieu
authored andcommitted
Handle new HashMap layout in CDB, MSVC, WinDbg, etc.
1 parent e3283e0 commit 122c037

File tree

1 file changed

+4
-31
lines changed

1 file changed

+4
-31
lines changed

src/etc/natvis/libstd.natvis

+4-31
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<Expand>
3131
<Item Name="[size]">base.table.items</Item>
3232
<Item Name="[capacity]">base.table.items + base.table.growth_left</Item>
33+
<Item Name="[state]">base.hash_builder</Item>
3334

3435
<CustomListItems>
3536
<Variable Name="i" InitialValue="0" />
@@ -40,7 +41,7 @@
4041
<If Condition="(base.table.ctrl.pointer[i] &amp; 0x80) == 0">
4142
<!-- Bucket is populated -->
4243
<Exec>n--</Exec>
43-
<Item Name="{base.table.data.pointer[i].__0}">base.table.data.pointer[i].__1</Item>
44+
<Item Name="{static_cast&lt;tuple&lt;$T1, $T2&gt;*&gt;(base.table.ctrl.pointer)[-(i + 1)].__0}">static_cast&lt;tuple&lt;$T1, $T2&gt;*&gt;(base.table.ctrl.pointer)[-(i + 1)].__1</Item>
4445
</If>
4546
<Exec>i++</Exec>
4647
</Loop>
@@ -53,6 +54,7 @@
5354
<Expand>
5455
<Item Name="[size]">map.base.table.items</Item>
5556
<Item Name="[capacity]">map.base.table.items + map.base.table.growth_left</Item>
57+
<Item Name="[state]">map.base.hash_builder</Item>
5658

5759
<CustomListItems>
5860
<Variable Name="i" InitialValue="0" />
@@ -63,36 +65,7 @@
6365
<If Condition="(map.base.table.ctrl.pointer[i] &amp; 0x80) == 0">
6466
<!-- Bucket is populated -->
6567
<Exec>n--</Exec>
66-
<Item>map.base.table.data.pointer[i].__0</Item>
67-
</If>
68-
<Exec>i++</Exec>
69-
</Loop>
70-
</CustomListItems>
71-
</Expand>
72-
</Type>
73-
74-
<Type Name="hashbrown::raw::RawTable&lt;*&gt;">
75-
<!-- RawTable has a nice and simple layout.
76-
items Number of *populated* values in the RawTable (less than the size of ctrl.pointer / data.pointer)
77-
growth_left Remaining capacity before growth
78-
ctrl.pointer[i] & 0x80 Indicates the bucket is empty / should be skipped / doesn't count towards items.
79-
data.pointer[i] The (K,V) tuple, if not empty.
80-
-->
81-
<DisplayString>{{ size={items} }}</DisplayString>
82-
<Expand>
83-
<Item Name="[size]">items</Item>
84-
<Item Name="[capacity]">items + growth_left</Item>
85-
86-
<CustomListItems>
87-
<Variable Name="i" InitialValue="0" />
88-
<Variable Name="n" InitialValue="items" />
89-
<Size>items</Size>
90-
<Loop>
91-
<Break Condition="n == 0" />
92-
<If Condition="(ctrl.pointer[i] &amp; 0x80) == 0">
93-
<!-- Bucket is populated -->
94-
<Exec>n--</Exec>
95-
<Item>data.pointer[i]</Item>
68+
<Item>static_cast&lt;$T1*&gt;(map.base.table.ctrl.pointer)[-(i + 1)]</Item>
9669
</If>
9770
<Exec>i++</Exec>
9871
</Loop>

0 commit comments

Comments
 (0)