diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/etc/natvis | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/etc/natvis')
-rw-r--r-- | src/etc/natvis/intrinsic.natvis | 225 | ||||
-rw-r--r-- | src/etc/natvis/liballoc.natvis | 196 | ||||
-rw-r--r-- | src/etc/natvis/libcore.natvis | 163 | ||||
-rw-r--r-- | src/etc/natvis/libstd.natvis | 120 |
4 files changed, 704 insertions, 0 deletions
diff --git a/src/etc/natvis/intrinsic.natvis b/src/etc/natvis/intrinsic.natvis new file mode 100644 index 000000000..558536fa6 --- /dev/null +++ b/src/etc/natvis/intrinsic.natvis @@ -0,0 +1,225 @@ +<?xml version="1.0" encoding="utf-8"?> +<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> + <Type Name="str"> + <DisplayString>{(char*)data_ptr,[length]s8}</DisplayString> + <StringView>(char*)data_ptr,[length]s8</StringView> + <Expand> + <Item Name="[len]" ExcludeView="simple">length</Item> + <Synthetic Name="[chars]"> + <Expand> + <ArrayItems> + <Size>length</Size> + <ValuePointer>data_ptr</ValuePointer> + </ArrayItems> + </Expand> + </Synthetic> + </Expand> + </Type> + <Type Name="slice$<*>"> + <DisplayString>{{ len={length} }}</DisplayString> + <Expand> + <Item Name="[len]" ExcludeView="simple">length</Item> + <ArrayItems> + <Size>length</Size> + <ValuePointer>data_ptr</ValuePointer> + </ArrayItems> + </Expand> + </Type> + <Type Name="tuple$<>"> + <DisplayString>()</DisplayString> + </Type> + <Type Name="tuple$<*>"> + <DisplayString>({__0})</DisplayString> + <Expand> + <Item Name="[0]">__0</Item> + </Expand> + </Type> + <Type Name="tuple$<*,*>"> + <DisplayString>({__0}, {__1})</DisplayString> + <Expand> + <Item Name="[0]">__0</Item> + <Item Name="[1]">__1</Item> + </Expand> + </Type> + <Type Name="tuple$<*,*,*>"> + <DisplayString>({__0}, {__1}, {__2})</DisplayString> + <Expand> + <Item Name="[0]">__0</Item> + <Item Name="[1]">__1</Item> + <Item Name="[2]">__2</Item> + </Expand> + </Type> + <Type Name="tuple$<*,*,*,*>"> + <DisplayString>({__0}, {__1}, {__2}, {__3})</DisplayString> + <Expand> + <Item Name="[0]">__0</Item> + <Item Name="[1]">__1</Item> + <Item Name="[2]">__2</Item> + <Item Name="[3]">__3</Item> + </Expand> + </Type> + <Type Name="tuple$<*,*,*,*,*>"> + <DisplayString>({__0}, {__1}, {__2}, {__3}, {__4})</DisplayString> + <Expand> + <Item Name="[0]">__0</Item> + <Item Name="[1]">__1</Item> + <Item Name="[2]">__2</Item> + <Item Name="[3]">__3</Item> + <Item Name="[4]">__4</Item> + </Expand> + </Type> + <Type Name="tuple$<*,*,*,*,*,*>"> + <DisplayString>({__0}, {__1}, {__2}, {__3}, {__4}, {__5})</DisplayString> + <Expand> + <Item Name="[0]">__0</Item> + <Item Name="[1]">__1</Item> + <Item Name="[2]">__2</Item> + <Item Name="[3]">__3</Item> + <Item Name="[4]">__4</Item> + <Item Name="[5]">__5</Item> + </Expand> + </Type> + <Type Name="tuple$<*,*,*,*,*,*,*>"> + <DisplayString>({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6})</DisplayString> + <Expand> + <Item Name="[0]">__0</Item> + <Item Name="[1]">__1</Item> + <Item Name="[2]">__2</Item> + <Item Name="[3]">__3</Item> + <Item Name="[4]">__4</Item> + <Item Name="[5]">__5</Item> + <Item Name="[6]">__6</Item> + </Expand> + </Type> + <Type Name="tuple$<*,*,*,*,*,*,*,*>"> + <DisplayString>({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6}, {__7})</DisplayString> + <Expand> + <Item Name="[0]">__0</Item> + <Item Name="[1]">__1</Item> + <Item Name="[2]">__2</Item> + <Item Name="[3]">__3</Item> + <Item Name="[4]">__4</Item> + <Item Name="[5]">__5</Item> + <Item Name="[6]">__6</Item> + <Item Name="[7]">__7</Item> + </Expand> + </Type> + <Type Name="tuple$<*,*,*,*,*,*,*,*,*>"> + <DisplayString>({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6}, {__7}, {__8})</DisplayString> + <Expand> + <Item Name="[0]">__0</Item> + <Item Name="[1]">__1</Item> + <Item Name="[2]">__2</Item> + <Item Name="[3]">__3</Item> + <Item Name="[4]">__4</Item> + <Item Name="[5]">__5</Item> + <Item Name="[6]">__6</Item> + <Item Name="[7]">__7</Item> + <Item Name="[8]">__8</Item> + </Expand> + </Type> + <Type Name="tuple$<*,*,*,*,*,*,*,*,*,*>"> + <DisplayString>({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6}, {__7}, {__8}, {__9})</DisplayString> + <Expand> + <Item Name="[0]">__0</Item> + <Item Name="[1]">__1</Item> + <Item Name="[2]">__2</Item> + <Item Name="[3]">__3</Item> + <Item Name="[4]">__4</Item> + <Item Name="[5]">__5</Item> + <Item Name="[6]">__6</Item> + <Item Name="[7]">__7</Item> + <Item Name="[8]">__8</Item> + <Item Name="[9]">__9</Item> + </Expand> + </Type> + <Type Name="tuple$<*,*,*,*,*,*,*,*,*,*,*>"> + <DisplayString>({__0}, {__1}, {__2}, {__3}, {__4}, {__5}, {__6}, {__7}, {__8}, {__9}, ...)</DisplayString> + <Expand> + <Item Name="[0]">__0</Item> + <Item Name="[1]">__1</Item> + <Item Name="[2]">__2</Item> + <Item Name="[3]">__3</Item> + <Item Name="[4]">__4</Item> + <Item Name="[5]">__5</Item> + <Item Name="[6]">__6</Item> + <Item Name="[7]">__7</Item> + <Item Name="[8]">__8</Item> + <Item Name="[9]">__9</Item> + <Synthetic Name="[...]"><DisplayString>...</DisplayString></Synthetic> + </Expand> + </Type> + + <!-- Directly tagged enums. $T1 is the type name --> + <Type Name="enum$<*>"> + <Intrinsic Name="tag" Expression="discriminant" /> + <DisplayString Condition="tag() == 0">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 1" Optional="true">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 2" Optional="true">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 3" Optional="true">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 4" Optional="true">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 5" Optional="true">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 6" Optional="true">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 7" Optional="true">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 8" Optional="true">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 9" Optional="true">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 10" Optional="true">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 11" Optional="true">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 12" Optional="true">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 13" Optional="true">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 14" Optional="true">{tag(),en}</DisplayString> + <DisplayString Condition="tag() == 15" Optional="true">{tag(),en}</DisplayString> + + <Expand> + <Synthetic Name="[variant]"> + <DisplayString>{tag(),en}</DisplayString> + </Synthetic> + <ExpandedItem Condition="tag() == 0">variant0</ExpandedItem> + <ExpandedItem Condition="tag() == 1" Optional="true">variant1</ExpandedItem> + <ExpandedItem Condition="tag() == 2" Optional="true">variant2</ExpandedItem> + <ExpandedItem Condition="tag() == 3" Optional="true">variant3</ExpandedItem> + <ExpandedItem Condition="tag() == 4" Optional="true">variant4</ExpandedItem> + <ExpandedItem Condition="tag() == 5" Optional="true">variant5</ExpandedItem> + <ExpandedItem Condition="tag() == 6" Optional="true">variant6</ExpandedItem> + <ExpandedItem Condition="tag() == 7" Optional="true">variant7</ExpandedItem> + <ExpandedItem Condition="tag() == 8" Optional="true">variant8</ExpandedItem> + <ExpandedItem Condition="tag() == 9" Optional="true">variant9</ExpandedItem> + <ExpandedItem Condition="tag() == 10" Optional="true">variant10</ExpandedItem> + <ExpandedItem Condition="tag() == 11" Optional="true">variant11</ExpandedItem> + <ExpandedItem Condition="tag() == 12" Optional="true">variant12</ExpandedItem> + <ExpandedItem Condition="tag() == 13" Optional="true">variant13</ExpandedItem> + <ExpandedItem Condition="tag() == 14" Optional="true">variant14</ExpandedItem> + <ExpandedItem Condition="tag() == 15" Optional="true">variant15</ExpandedItem> + </Expand> + </Type> + + <!-- Single variant enums. $T1 is the name of the enum, $T2 is the name of the variant --> + <Type Name="enum$<*, *>"> + <DisplayString>{"$T2",sb}</DisplayString> + <Expand> + <Synthetic Name="[variant]"> + <DisplayString>{"$T2",sb}</DisplayString> + </Synthetic> + <ExpandedItem>$T2</ExpandedItem> + </Expand> + </Type> + + <!-- Niche-layout enums. $T1 is the name of the enum, $T2 is the low value of the dataful + variant tag, $T3 is the high value of the dataful variant tag, $T4 is the name of + the dataful variant --> + <Type Name="enum$<*, *, *, *>"> + <Intrinsic Name="tag" Expression="discriminant" /> + <Intrinsic Name="is_dataful" Expression="tag() >= $T2 && tag() <= $T3" /> + <DisplayString Condition="is_dataful()">{"$T4",sb}({dataful_variant})</DisplayString> + <DisplayString Condition="!is_dataful()">{discriminant,en}</DisplayString> + <Expand> + <ExpandedItem Condition="is_dataful()">dataful_variant</ExpandedItem> + <Synthetic Condition="is_dataful()" Name="[variant]"> + <DisplayString>{"$T4",sb}</DisplayString> + </Synthetic> + <Synthetic Condition="!is_dataful()" Name="[variant]"> + <DisplayString>{discriminant,en}</DisplayString> + </Synthetic> + </Expand> + </Type> +</AutoVisualizer> diff --git a/src/etc/natvis/liballoc.natvis b/src/etc/natvis/liballoc.natvis new file mode 100644 index 000000000..912418fa7 --- /dev/null +++ b/src/etc/natvis/liballoc.natvis @@ -0,0 +1,196 @@ +<?xml version="1.0" encoding="utf-8"?> +<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> + <Type Name="alloc::vec::Vec<*>"> + <DisplayString>{{ len={len} }}</DisplayString> + <Expand> + <Item Name="[len]" ExcludeView="simple">len</Item> + <Item Name="[capacity]" ExcludeView="simple">buf.cap</Item> + <ArrayItems> + <Size>len</Size> + <ValuePointer>buf.ptr.pointer.pointer</ValuePointer> + </ArrayItems> + </Expand> + </Type> + <Type Name="alloc::collections::vec_deque::VecDeque<*>"> + <DisplayString>{{ len={tail <= head ? head - tail : buf.cap - tail + head} }}</DisplayString> + <Expand> + <Item Name="[len]" ExcludeView="simple">tail <= head ? head - tail : buf.cap - tail + head</Item> + <Item Name="[capacity]" ExcludeView="simple">buf.cap</Item> + <CustomListItems> + <Variable Name="i" InitialValue="tail" /> + + <Size>tail <= head ? head - tail : buf.cap - tail + head</Size> + <Loop> + <If Condition="i == head"> + <Break/> + </If> + <Item>buf.ptr.pointer.pointer[i]</Item> + <Exec>i = (i + 1 == buf.cap ? 0 : i + 1)</Exec> + </Loop> + </CustomListItems> + </Expand> + </Type> + <Type Name="alloc::collections::linked_list::LinkedList<*>"> + <DisplayString>{{ len={len} }}</DisplayString> + <Expand> + <LinkedListItems> + <Size>len</Size> + <HeadPointer>*(alloc::collections::linked_list::Node<$T1> **)&head</HeadPointer> + <NextPointer>*(alloc::collections::linked_list::Node<$T1> **)&next</NextPointer> + <ValueNode>element</ValueNode> + </LinkedListItems> + </Expand> + </Type> + <Type Name="alloc::string::String"> + <DisplayString>{(char*)vec.buf.ptr.pointer.pointer,[vec.len]s8}</DisplayString> + <StringView>(char*)vec.buf.ptr.pointer.pointer,[vec.len]s8</StringView> + <Expand> + <Item Name="[len]" ExcludeView="simple">vec.len</Item> + <Item Name="[capacity]" ExcludeView="simple">vec.buf.cap</Item> + <Synthetic Name="[chars]"> + <DisplayString>{(char*)vec.buf.ptr.pointer.pointer,[vec.len]s8}</DisplayString> + <Expand> + <ArrayItems> + <Size>vec.len</Size> + <ValuePointer>(char*)vec.buf.ptr.pointer.pointer</ValuePointer> + </ArrayItems> + </Expand> + </Synthetic> + </Expand> + </Type> + + <!-- + The display string for Rc, Arc, etc is optional because the expression cannot be evaluated + if the pointee is unsized (i.e. if `ptr.pointer` is a fat pointer). + + There are also two versions for the reference count fields, one for sized and one for + dyn pointees. + + Rc<[T]> and Arc<[T]> are handled separately altogether so we can actually show + the slice values. + --> + <!-- alloc::rc::Rc<T> --> + <Type Name="alloc::rc::Rc<*>"> + <DisplayString Optional="true">{ptr.pointer->value}</DisplayString> + <Expand> + <!-- thin --> + <ExpandedItem Optional="true">ptr.pointer->value</ExpandedItem> + <Item Name="[Reference count]" Optional="true">ptr.pointer->strong</Item> + <Item Name="[Weak reference count]" Optional="true">ptr.pointer->weak</Item> + + <!-- dyn --> + <Item Name="[Reference count]" Optional="true">ptr.pointer.pointer->strong</Item> + <Item Name="[Weak reference count]" Optional="true">ptr.pointer.pointer->weak</Item> + </Expand> + </Type> + + <!-- alloc::rc::Rc<[T]> --> + <Type Name="alloc::rc::Rc<slice$<*> >"> + <DisplayString>{{ len={ptr.pointer.length} }}</DisplayString> + <Expand> + <Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item> + <Item Name="[Reference count]">ptr.pointer.data_ptr->strong</Item> + <Item Name="[Weak reference count]">ptr.pointer.data_ptr->weak</Item> + <ArrayItems> + <Size>ptr.pointer.length</Size> + <!-- We add +2 to the data_ptr in order to skip the ref count fields in the RcBox --> + <ValuePointer>($T1*)(((size_t*)ptr.pointer.data_ptr) + 2)</ValuePointer> + </ArrayItems> + </Expand> + </Type> + + <!-- alloc::rc::Weak<T> --> + <Type Name="alloc::rc::Weak<*>"> + <DisplayString Optional="true">{ptr.pointer->value}</DisplayString> + <Expand> + <!-- thin --> + <ExpandedItem Optional="true">ptr.pointer->value</ExpandedItem> + <Item Name="[Reference count]" Optional="true">ptr.pointer->strong</Item> + <Item Name="[Weak reference count]" Optional="true">ptr.pointer->weak</Item> + + <!-- dyn --> + <Item Name="[Reference count]" Optional="true">ptr.pointer.pointer->strong</Item> + <Item Name="[Weak reference count]" Optional="true">ptr.pointer.pointer->weak</Item> + </Expand> + </Type> + + <!-- alloc::rc::Weak<[T]> --> + <Type Name="alloc::rc::Weak<slice$<*> >"> + <DisplayString>{{ len={ptr.pointer.length} }}</DisplayString> + <Expand> + <Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item> + <Item Name="[Reference count]">ptr.pointer.data_ptr->strong</Item> + <Item Name="[Weak reference count]">ptr.pointer.data_ptr->weak</Item> + <ArrayItems> + <Size>ptr.pointer.length</Size> + <ValuePointer>($T1*)(((size_t*)ptr.pointer.data_ptr) + 2)</ValuePointer> + </ArrayItems> + </Expand> + </Type> + + <!-- alloc::sync::Arc<T> --> + <Type Name="alloc::sync::Arc<*>"> + <DisplayString Optional="true">{ptr.pointer->data}</DisplayString> + <Expand> + <!-- thin --> + <ExpandedItem Optional="true">ptr.pointer->data</ExpandedItem> + <Item Name="[Reference count]" Optional="true">ptr.pointer->strong</Item> + <Item Name="[Weak reference count]" Optional="true">ptr.pointer->weak</Item> + + <!-- dyn --> + <Item Name="[Reference count]" Optional="true">ptr.pointer.pointer->strong</Item> + <Item Name="[Weak reference count]" Optional="true">ptr.pointer.pointer->weak</Item> + </Expand> + </Type> + + <!-- alloc::sync::Arc<[T]> --> + <Type Name="alloc::sync::Arc<slice$<*> >"> + <DisplayString>{{ len={ptr.pointer.length} }}</DisplayString> + <Expand> + <Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item> + <Item Name="[Reference count]">ptr.pointer.data_ptr->strong</Item> + <Item Name="[Weak reference count]">ptr.pointer.data_ptr->weak</Item> + <ArrayItems> + <Size>ptr.pointer.length</Size> + <ValuePointer>($T1*)(((size_t*)ptr.pointer.data_ptr) + 2)</ValuePointer> + </ArrayItems> + </Expand> + </Type> + + <!-- alloc::sync::Weak<T> --> + <Type Name="alloc::sync::Weak<*>"> + <DisplayString Optional="true">{ptr.pointer->data}</DisplayString> + <Expand> + <!-- thin --> + <ExpandedItem Optional="true">ptr.pointer->data</ExpandedItem> + <Item Name="[Reference count]" Optional="true">ptr.pointer->strong</Item> + <Item Name="[Weak reference count]" Optional="true">ptr.pointer->weak</Item> + + <!-- dyn --> + <Item Name="[Reference count]" Optional="true">ptr.pointer.pointer->strong</Item> + <Item Name="[Weak reference count]" Optional="true">ptr.pointer.pointer->weak</Item> + </Expand> + </Type> + + <!-- alloc::sync::Weak<[T]> --> + <Type Name="alloc::sync::Weak<slice$<*> >"> + <DisplayString>{{ len={ptr.pointer.length} }}</DisplayString> + <Expand> + <Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item> + <Item Name="[Reference count]">ptr.pointer.data_ptr->strong</Item> + <Item Name="[Weak reference count]">ptr.pointer.data_ptr->weak</Item> + <ArrayItems> + <Size>ptr.pointer.length</Size> + <ValuePointer>($T1*)(((size_t*)ptr.pointer.data_ptr) + 2)</ValuePointer> + </ArrayItems> + </Expand> + </Type> + + <Type Name="alloc::borrow::Cow<*>"> + <DisplayString Condition="RUST$ENUM$DISR == 0x0">Borrowed({__0})</DisplayString> + <DisplayString Condition="RUST$ENUM$DISR == 0x1">Owned({__0})</DisplayString> + <Expand> + <Item Name="[value]" ExcludeView="simple">__0</Item> + </Expand> + </Type> +</AutoVisualizer> diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis new file mode 100644 index 000000000..a4e8a57e4 --- /dev/null +++ b/src/etc/natvis/libcore.natvis @@ -0,0 +1,163 @@ +<?xml version="1.0" encoding="utf-8"?> +<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> + <Type Name="core::cell::Cell<*>"> + <DisplayString>{value.value}</DisplayString> + <Expand> + <ExpandedItem>value.value</ExpandedItem> + </Expand> + </Type> + <Type Name="core::cell::Ref<*>"> + <DisplayString>{value.pointer}</DisplayString> + <Expand> + <ExpandedItem>value.pointer</ExpandedItem> + </Expand> + </Type> + <Type Name="core::cell::RefMut<*>"> + <DisplayString>{value.pointer}</DisplayString> + <Expand> + <ExpandedItem>value.pointer</ExpandedItem> + </Expand> + </Type> + <Type Name="core::cell::RefCell<*>"> + <DisplayString>{value.value}</DisplayString> + <Expand> + <Item Name="[Borrow state]" Condition="borrow.value.value == 0">"Unborrowed",sb</Item> + <Item Name="[Borrow state]" Condition="borrow.value.value > 0">"Immutably borrowed",sb</Item> + <Item Name="[Borrow state]" Condition="borrow.value.value < 0">"Mutably borrowed",sb</Item> + <ExpandedItem>value.value</ExpandedItem> + </Expand> + </Type> + <Type Name="core::cell::UnsafeCell<*>"> + <DisplayString>{value}</DisplayString> + <Expand> + <ExpandedItem>value</ExpandedItem> + </Expand> + </Type> + + <Type Name="core::mem::manually_drop::ManuallyDrop<*>"> + <DisplayString>{value}</DisplayString> + <Expand> + <ExpandedItem>value</ExpandedItem> + </Expand> + </Type> + + <Type Name="core::num::nonzero::NonZeroI8"> + <DisplayString>{__0}</DisplayString> + </Type> + <Type Name="core::num::nonzero::NonZeroI16"> + <DisplayString>{__0}</DisplayString> + </Type> + <Type Name="core::num::nonzero::NonZeroI32"> + <DisplayString>{__0}</DisplayString> + </Type> + <Type Name="core::num::nonzero::NonZeroI64"> + <DisplayString>{__0}</DisplayString> + </Type> + <Type Name="core::num::nonzero::NonZeroI128"> + <DisplayString>{__0}</DisplayString> + </Type> + <Type Name="core::num::nonzero::NonZeroIsize"> + <DisplayString>{__0}</DisplayString> + </Type> + <Type Name="core::num::nonzero::NonZeroU8"> + <DisplayString>{__0}</DisplayString> + </Type> + <Type Name="core::num::nonzero::NonZeroU16"> + <DisplayString>{__0}</DisplayString> + </Type> + <Type Name="core::num::nonzero::NonZeroU32"> + <DisplayString>{__0}</DisplayString> + </Type> + <Type Name="core::num::nonzero::NonZeroU64"> + <DisplayString>{__0}</DisplayString> + </Type> + <Type Name="core::num::nonzero::NonZeroU128"> + <DisplayString>{__0}</DisplayString> + </Type> + <Type Name="core::num::nonzero::NonZeroUsize"> + <DisplayString>{__0}</DisplayString> + </Type> + + <Type Name="core::num::wrapping::Wrapping<*>"> + <DisplayString>{__0}</DisplayString> + </Type> + + <Type Name="core::ops::range::Range<*>"> + <DisplayString>({start}..{end})</DisplayString> + </Type> + <Type Name="core::ops::range::RangeFrom<*>"> + <DisplayString>({start}..)</DisplayString> + </Type> + <Type Name="core::ops::range::RangeInclusive<*>"> + <DisplayString>({start}..={end})</DisplayString> + </Type> + <Type Name="core::ops::range::RangeTo<*>"> + <DisplayString>(..{end})</DisplayString> + </Type> + <Type Name="core::ops::range::RangeToInclusive<*>"> + <DisplayString>(..={end})</DisplayString> + </Type> + + <Type Name="core::pin::Pin<*>"> + <DisplayString>Pin({(void*)pointer}: {pointer})</DisplayString> + <Expand> + <ExpandedItem>pointer</ExpandedItem> + </Expand> + </Type> + + <Type Name="core::ptr::non_null::NonNull<*>"> + <DisplayString>NonNull({(void*) pointer}: {pointer})</DisplayString> + <Expand> + <ExpandedItem>pointer</ExpandedItem> + </Expand> + </Type> + + <Type Name="core::ptr::unique::Unique<*>"> + <DisplayString>Unique({(void*)pointer.pointer}: {pointer.pointer})</DisplayString> + <Expand> + <ExpandedItem>pointer</ExpandedItem> + </Expand> + </Type> + + <Type Name="core::sync::atomic::AtomicBool"> + <DisplayString>{(bool)v.value}</DisplayString> + </Type> + <Type Name="core::sync::atomic::AtomicI8"> + <DisplayString>{v.value}</DisplayString> + </Type> + <Type Name="core::sync::atomic::AtomicI16"> + <DisplayString>{v.value}</DisplayString> + </Type> + <Type Name="core::sync::atomic::AtomicI32"> + <DisplayString>{v.value}</DisplayString> + </Type> + <Type Name="core::sync::atomic::AtomicI64"> + <DisplayString>{v.value}</DisplayString> + </Type> + <Type Name="core::sync::atomic::AtomicIsize"> + <DisplayString>{v.value}</DisplayString> + </Type> + <Type Name="core::sync::atomic::AtomicU8"> + <DisplayString>{v.value}</DisplayString> + </Type> + <Type Name="core::sync::atomic::AtomicU16"> + <DisplayString>{v.value}</DisplayString> + </Type> + <Type Name="core::sync::atomic::AtomicU32"> + <DisplayString>{v.value}</DisplayString> + </Type> + <Type Name="core::sync::atomic::AtomicU64"> + <DisplayString>{v.value}</DisplayString> + </Type> + <Type Name="core::sync::atomic::AtomicUsize"> + <DisplayString>{v.value}</DisplayString> + </Type> + + <Type Name="core::time::Duration"> + <DisplayString>{secs,d}s {nanos,d}ns</DisplayString> + <Expand> + <Item Name="seconds">secs,d</Item> + <Item Name="nanoseconds">nanos,d</Item> + </Expand> + </Type> +</AutoVisualizer> diff --git a/src/etc/natvis/libstd.natvis b/src/etc/natvis/libstd.natvis new file mode 100644 index 000000000..4371b9953 --- /dev/null +++ b/src/etc/natvis/libstd.natvis @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> + <!-- + std::collection::Hash* container visualizers + + Current std impls: + std::collections::hash::set::HashSet<K, S> is implemented in terms of... + hashbrown::set::HashSet<K, S> is implemented in terms of... + hashbrown::map::HashMap<K, V, S> is implemented in terms of... + hashbrown::raw::RawTable<(K, V)> + + Ideally, we'd teach rustc to scan dependencies/crates for .natvis files so + the bulk of this could live alongside the hashbrown crate implementation, + and std would just forward using e.g. <ExpandedItem>base</ExpandedItem>. + + However, Given that std...Hash*Set* is currently implemented in terms of + hashbrown...Hash*Map*, which would visualize poorly, we want to customize the + look/feel at the std type level *anyways*... + + References: + https://github.com/rust-lang/rust/blob/master/src/libstd/collections/hash/map.rs + https://github.com/rust-lang/rust/blob/master/src/libstd/collections/hash/set.rs + https://github.com/rust-lang/hashbrown/blob/master/src/map.rs + https://github.com/rust-lang/hashbrown/blob/master/src/set.rs + https://github.com/rust-lang/hashbrown/blob/master/src/raw/mod.rs + --> + + <Type Name="std::collections::hash::map::HashMap<*,*,*>"> + <DisplayString>{{ len={base.table.table.items} }}</DisplayString> + <Expand> + <Item Name="[len]">base.table.table.items</Item> + <Item Name="[capacity]">base.table.table.items + base.table.table.growth_left</Item> + <Item Name="[state]">base.hash_builder</Item> + + <CustomListItems> + <Variable Name="i" InitialValue="0" /> + <Variable Name="n" InitialValue="base.table.table.items" /> + <Size>base.table.table.items</Size> + <Loop> + <Break Condition="n == 0" /> + <If Condition="(base.table.table.ctrl.pointer[i] & 0x80) == 0"> + <!-- Bucket is populated --> + <Exec>n--</Exec> + <Item Name="{((tuple$<$T1,$T2>*)base.table.table.ctrl.pointer)[-(i + 1)].__0}">((tuple$<$T1,$T2>*)base.table.table.ctrl.pointer)[-(i + 1)].__1</Item> + </If> + <Exec>i++</Exec> + </Loop> + </CustomListItems> + </Expand> + </Type> + + <Type Name="std::collections::hash::set::HashSet<*,*>"> + <DisplayString>{{ len={base.map.table.table.items} }}</DisplayString> + <Expand> + <Item Name="[len]">base.map.table.table.items</Item> + <Item Name="[capacity]">base.map.table.table.items + base.map.table.table.growth_left</Item> + <Item Name="[state]">base.map.hash_builder</Item> + + <CustomListItems> + <Variable Name="i" InitialValue="0" /> + <Variable Name="n" InitialValue="base.map.table.table.items" /> + <Size>base.map.table.table.items</Size> + <Loop> + <Break Condition="n == 0" /> + <If Condition="(base.map.table.table.ctrl.pointer[i] & 0x80) == 0"> + <!-- Bucket is populated --> + <Exec>n--</Exec> + <Item>(($T1*)base.map.table.table.ctrl.pointer)[-(i + 1)]</Item> + </If> + <Exec>i++</Exec> + </Loop> + </CustomListItems> + </Expand> + </Type> + + <Type Name="std::ffi::c_str::CString"> + <DisplayString>{(char*)inner.data_ptr}</DisplayString> + <Expand> + <Synthetic Name="[chars]"> + <DisplayString>{(char*)inner.data_ptr}</DisplayString> + <Expand> + <ArrayItems> + <Size>inner.length</Size> + <ValuePointer>(char*)inner.data_ptr</ValuePointer> + </ArrayItems> + </Expand> + </Synthetic> + </Expand> + </Type> + + <Type Name="std::ffi::c_str::CStr"> + <DisplayString>{(char*) inner}</DisplayString> + <Expand> + <Synthetic Name="[chars]"> + <DisplayString>{(char*) inner}</DisplayString> + <Expand> + <ArrayItems> + <Size>strlen((char *) inner) + 1</Size> + <ValuePointer>(char*)inner</ValuePointer> + </ArrayItems> + </Expand> + </Synthetic> + </Expand> + </Type> + + <Type Name="std::ffi::os_str::OsString"> + <DisplayString>{(char*)inner.inner.bytes.buf.ptr.pointer.pointer,[inner.inner.bytes.len]}</DisplayString> + <Expand> + <Synthetic Name="[chars]"> + <DisplayString>{(char*)inner.inner.bytes.buf.ptr.pointer.pointer,[inner.inner.bytes.len]}</DisplayString> + <Expand> + <ArrayItems> + <Size>inner.inner.bytes.len</Size> + <ValuePointer>(char*)inner.inner.bytes.buf.ptr.pointer.pointer</ValuePointer> + </ArrayItems> + </Expand> + </Synthetic> + </Expand> + </Type> +</AutoVisualizer> |