-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vec, LinkedList, VecDeque, String, and Option NatVis visualizations #39843
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> | ||
<Type Name="collections::vec::Vec<*>"> | ||
<DisplayString>{{ size={len} }}</DisplayString> | ||
<Expand> | ||
<Item Name="[size]" ExcludeView="simple">len</Item> | ||
<Item Name="[capacity]" ExcludeView="simple">buf.cap</Item> | ||
<ArrayItems> | ||
<Size>len</Size> | ||
<ValuePointer>buf.ptr.pointer.__0</ValuePointer> | ||
</ArrayItems> | ||
</Expand> | ||
</Type> | ||
<Type Name="collections::vec_deque::VecDeque<*>"> | ||
<DisplayString>{{ size={tail <= head ? head - tail : buf.cap - tail + head} }}</DisplayString> | ||
<Expand> | ||
<Item Name="[size]" 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.__0 + i</Item> | ||
<Exec>i = (i + 1 == buf.cap ? 0 : i + 1)</Exec> | ||
</Loop> | ||
</CustomListItems> | ||
</Expand> | ||
</Type> | ||
<Type Name="collections::linked_list::LinkedList<*>"> | ||
<DisplayString>{{ size={len} }}</DisplayString> | ||
<Expand> | ||
<LinkedListItems> | ||
<Size>len</Size> | ||
<HeadPointer>*(collections::linked_list::Node<$T1> **)&head</HeadPointer> | ||
<NextPointer>*(collections::linked_list::Node<$T1> **)&next</NextPointer> | ||
<ValueNode>element</ValueNode> | ||
</LinkedListItems> | ||
</Expand> | ||
</Type> | ||
<Type Name="collections::string::String"> | ||
<DisplayString>{*(char**)this,[vec.len]}</DisplayString> | ||
<StringView>*(char**)this,[vec.len]</StringView> | ||
<Expand> | ||
<Item Name="[size]" ExcludeView="simple">vec.len</Item> | ||
<Item Name="[capacity]" ExcludeView="simple">vec.buf.cap</Item> | ||
<ArrayItems> | ||
<Size>vec.len</Size> | ||
<ValuePointer>*(char**)this</ValuePointer> | ||
</ArrayItems> | ||
</Expand> | ||
</Type> | ||
</AutoVisualizer> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> | ||
<Type Name="core::ptr::Unique<*>"> | ||
<DisplayString>{{ Unique {*pointer.__0} }}</DisplayString> | ||
<Expand> | ||
<Item Name="[ptr]">pointer.__0</Item> | ||
</Expand> | ||
</Type> | ||
<Type Name="core::ptr::Shared<*>"> | ||
<DisplayString>{{ Shared {*pointer.__0} }}</DisplayString> | ||
<Expand> | ||
<Item Name="[ptr]">pointer.__0</Item> | ||
</Expand> | ||
</Type> | ||
<Type Name="core::option::Option<*>"> | ||
<DisplayString Condition="RUST$ENUM$DISR == 0x0">{{ None }}</DisplayString> | ||
<DisplayString Condition="RUST$ENUM$DISR == 0x1">{{ Some {__0} }}</DisplayString> | ||
<Expand> | ||
<Item Name="[size]" ExcludeView="simple">(ULONG)(RUST$ENUM$DISR != 0)</Item> | ||
<Item Name="[value]" ExcludeView="simple">__0</Item> | ||
<ArrayItems> | ||
<Size>(ULONG)(RUST$ENUM$DISR != 0)</Size> | ||
<ValuePointer>&__0</ValuePointer> | ||
</ArrayItems> | ||
</Expand> | ||
</Type> | ||
<Type Name="core::option::Option<*>" Priority="MediumLow"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting the Priority here basically means "if you have problems with a higher priority visualization, come to me." The higher priority visualization relies on the RUST$ENUM$DISR member being present. If not, the code currently assumes that it's a cost-saving Enum where the NIL value is embedded within the type. This check is almost certainly wrong. Right now it's checking "are the first sizeof(PVOID) bytes of this structure 0"? |
||
<DisplayString Condition="*(PVOID *)this == nullptr">{{ None }}</DisplayString> | ||
<DisplayString>{{ Some {($T1 *)this} }}</DisplayString> | ||
<Expand> | ||
<Item Name="[size]" ExcludeView="simple">(ULONG)(*(PVOID *)this != nullptr)</Item> | ||
<Item Name="[value]" ExcludeView="simple" Condition="*(PVOID *)this != nullptr">($T1 *)this</Item> | ||
<ArrayItems> | ||
<Size>(ULONG)(*(PVOID *)this != nullptr)</Size> | ||
<ValuePointer>($T1 *)this</ValuePointer> | ||
</ArrayItems> | ||
</Expand> | ||
</Type> | ||
</AutoVisualizer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a windbg bug where referencing any symbol dependent on i8 or u8 causes windbg to be unable to interpret the expression. So, right now this relies on the pointer in the String to be the first member of the structure. #36646 has more details on this bug.