Add visualizer for OsString and fixup other string visualizers

This commit is contained in:
Wesley Wiser 2021-07-01 15:57:12 -04:00
parent a6a82c66d4
commit 85002741a2
3 changed files with 20 additions and 5 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="str">
<DisplayString>{data_ptr,[length]s8}</DisplayString>
<StringView>data_ptr,[length]s8</StringView>
<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]">

View File

@ -74,7 +74,7 @@
</Type>
<Type Name="std::ffi::c_str::CString">
<DisplayString>{inner.data_ptr,s}</DisplayString>
<DisplayString>{(char*)inner.data_ptr}</DisplayString>
<Expand>
<Synthetic Name="[chars]">
<Expand>
@ -101,4 +101,18 @@
</Synthetic>
</Expand>
</Type>
<Type Name="std::ffi::os_str::OsString">
<DisplayString>{(char*)inner.inner.bytes.buf.ptr.pointer,[inner.inner.bytes.len]}</DisplayString>
<Expand>
<Synthetic Name="[chars]">
<Expand>
<ArrayItems>
<Size>inner.inner.bytes.len</Size>
<ValuePointer>(char*)inner.inner.bytes.buf.ptr.pointer</ValuePointer>
</ArrayItems>
</Expand>
</Synthetic>
</Expand>
</Type>
</AutoVisualizer>

View File

@ -111,8 +111,9 @@
// cdb-check: [11] : 33 '!' [Type: char]
// cdb-command: dx os_string
// cdb-check:os_string [Type: [...]::OsString]
// NOTE: OsString doesn't have a .natvis entry yet.
// cdb-check:os_string : "IAMA OS string 😃" [Type: std::ffi::os_str::OsString]
// cdb-check: [<Raw View>] [Type: std::ffi::os_str::OsString]
// cdb-check: [chars]
// cdb-command: dx some
// cdb-check:some : Some [Type: enum$<core::option::Option<i16> >]