-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathsparse_array.natvis
More file actions
executable file
·90 lines (89 loc) · 4.37 KB
/
Copy pathsparse_array.natvis
File metadata and controls
executable file
·90 lines (89 loc) · 4.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!--
sparse_array<value_t, config_t>
Layout used by this visualizer (default handle_t == void *):
- index_tree_.root_ is the red-black "nil" sentinel; its handle is
invalid_handle (0). It stores:
* parent_handle = tree root (0 when the tree is empty)
* left_handle = most-left (in-order first range_set)
* right_handle = most-right (in-order last range_set)
- each real tree node is a sparse_range_set: a sorted array
begin[0 .. end-1] of sparse_range.
- a sparse_range covers [index, index + length); its data lives in a
memory_block at `handle`, starting at slot `offset`. Consecutive
memory_block_data slots are contiguous, so the first slot's
data[] array can be indexed as a flat value_t[length].
The Children list performs an in-order walk of the range_set tree and,
for every range, expands element-by-element to value level keyed by the
absolute index, giving a {index: value} style map.
-->
<Type Name="sparse_array<*>">
<DisplayString Condition="index_tree_.root_.right_handle == 0">{{ sparse_array, size=0 }}</DisplayString>
<DisplayString>{{ sparse_array, size={((sparse_range_set *)index_tree_.root_.right_handle)->begin[((sparse_range_set *)index_tree_.root_.right_handle)->end - 1].index + ((sparse_range_set *)index_tree_.root_.right_handle)->begin[((sparse_range_set *)index_tree_.root_.right_handle)->end - 1].length} }}</DisplayString>
<Expand>
<Item Name="[allocator]" ExcludeView="simple">(config_t &)index_tree_.root_</Item>
<Item Name="[free_length]" ExcludeView="simple">index_tree_.root_.length</Item>
<CustomListItems Condition="index_tree_.root_.parent_handle != 0">
<Variable Name="node" InitialValue="index_tree_.root_.left_handle"/>
<Variable Name="parent" InitialValue="index_tree_.root_.left_handle"/>
<Variable Name="set" InitialValue="(sparse_range_set *)0"/>
<Variable Name="rng" InitialValue="(sparse_range *)0"/>
<Variable Name="ri" InitialValue="0"/>
<Variable Name="vi" InitialValue="0"/>
<Loop>
<Break Condition="node == 0"/>
<Exec>set = (sparse_range_set *)node</Exec>
<Exec>ri = 0</Exec>
<Loop>
<Break Condition="ri >= (int)set->end"/>
<Exec>rng = set->begin + ri</Exec>
<Exec>vi = 0</Exec>
<Loop>
<Break Condition="vi >= (int)rng->length"/>
<Item Name="[{rng->index + vi}]">((memory_block *)rng->handle)->data[rng->offset].data[vi]</Item>
<Exec>vi = vi + 1</Exec>
</Loop>
<Exec>ri = ri + 1</Exec>
</Loop>
<!-- in-order successor over the red-black tree (nil == handle 0) -->
<If Condition="((sparse_range_set *)node)->right_handle != 0">
<Exec>node = ((sparse_range_set *)node)->right_handle</Exec>
<Loop>
<Break Condition="((sparse_range_set *)node)->left_handle == 0"/>
<Exec>node = ((sparse_range_set *)node)->left_handle</Exec>
</Loop>
</If>
<Else>
<Exec>parent = ((sparse_range_set *)node)->parent_handle</Exec>
<Loop>
<Break Condition="parent == 0"/>
<Break Condition="((sparse_range_set *)parent)->left_handle == node"/>
<Exec>node = parent</Exec>
<Exec>parent = ((sparse_range_set *)node)->parent_handle</Exec>
</Loop>
<Exec>node = parent</Exec>
</Else>
</Loop>
</CustomListItems>
</Expand>
</Type>
<Type Name="sparse_array<*>::sparse_range">
<DisplayString>{{ index={index}, length={length}, offset={offset} }}</DisplayString>
<Expand>
<Item Name="[index]">index</Item>
<Item Name="[length]">length</Item>
<Item Name="[offset]">offset</Item>
<Item Name="[handle]">handle</Item>
</Expand>
</Type>
<Type Name="sparse_array<*>::sparse_range_set">
<DisplayString>{{ ranges={end} }}</DisplayString>
<Expand>
<ArrayItems>
<Size>end</Size>
<ValuePointer>begin</ValuePointer>
</ArrayItems>
</Expand>
</Type>
</AutoVisualizer>