Skip to content

Commit

Permalink
Add natvis for Result, NonNull, CString, CStr, and Cow
Browse files Browse the repository at this point in the history
  • Loading branch information
rylev committed Mar 1, 2021
1 parent d95d304 commit 920e2d8
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/etc/natvis/liballoc.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,11 @@
<ExpandedItem>ptr.pointer->data</ExpandedItem>
</Expand>
</Type>
<Type Name="alloc::borrow::Cow&lt;*&gt;">
<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>
15 changes: 15 additions & 0 deletions src/etc/natvis/libcore.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,19 @@
</Expand>
</Type>

<Type Name="core::result::Result&lt;*&gt;">
<DisplayString Condition="RUST$ENUM$DISR == 0x0">Ok({__0})</DisplayString>
<DisplayString Condition="RUST$ENUM$DISR == 0x1">Err({(*($T2*) &amp;__0)})</DisplayString>
<Expand>
<Item Name="[value]" Condition="RUST$ENUM$DISR == 0x0">__0</Item>
<Item Name="[value]" Condition="RUST$ENUM$DISR == 0x1">(*($T2*) &amp;__0)</Item>
</Expand>
</Type>

<Type Name="core::ptr::non_null::NonNull&lt;*&gt;">
<DisplayString>{(void*) pointer}</DisplayString>
<Expand>
<Item Name="[value]">*pointer</Item>
</Expand>
</Type>
</AutoVisualizer>
29 changes: 29 additions & 0 deletions src/etc/natvis/libstd.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,33 @@
</CustomListItems>
</Expand>
</Type>

<Type Name="std::ffi::c_str::CString">
<DisplayString>{inner.data_ptr,s}</DisplayString>
<Expand>
<Synthetic Name="[chars]">
<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>
</AutoVisualizer>

0 comments on commit 920e2d8

Please sign in to comment.