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/liballoc.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/liballoc.natvis')
-rw-r--r-- | src/etc/natvis/liballoc.natvis | 196 |
1 files changed, 196 insertions, 0 deletions
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> |