Skip to content

Commit

Permalink
natvis visualizers for BStr and BString
Browse files Browse the repository at this point in the history
Closes #1
  • Loading branch information
MaulingMonkey committed Sep 21, 2022
1 parent 91f0aea commit 47e41bf
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/bstring.natvis
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">

<!-- These could be simplified with a `x,bstr` format specifier. However, that doesn't appear to be supported by VS Code? -->

<Type Name="winstr::bstring::danger::BStr">
<DisplayString>{(wchar_t*)&amp;__0,[((unsigned int *)&amp;__0)[-1] / 2]su}</DisplayString>
<Expand>
<Item Name="[len]" >((unsigned int *)&amp;__0)[-1] / 2</Item>
<Item Name="[bytes]" >((unsigned int *)&amp;__0)[-1]</Item>
<Item Name="[code units]" >(wchar_t*)&amp;__0,[((unsigned int *)&amp;__0)[-1] / 2]su</Item>
</Expand>
</Type>

<Type Name="winstr::bstring::danger::BString">
<DisplayString>{(wchar_t*)__0.pointer,[((unsigned int *)__0.pointer)[-1] / 2]su}</DisplayString>
<Expand>
<Item Name="[len]" >((unsigned int *)__0.pointer)[-1] / 2</Item>
<Item Name="[bytes]" >((unsigned int *)__0.pointer)[-1]</Item>
<Item Name="[code units]" >(wchar_t*)__0.pointer,[((unsigned int *)__0.pointer)[-1] / 2]su</Item>
</Expand>
</Type>

</AutoVisualizer>

0 comments on commit 47e41bf

Please sign in to comment.