Skip to content
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

STL.natvis: add specializations for shared_ptr<void>, weak_ptr<void>, and unique_ptr<void, deleter> #2706

Merged
merged 2 commits into from
May 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions stl/debugger/STL.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,16 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
</Type>

<!-- VC 2015 -->
<Type Name="std::unique_ptr&lt;void, *&gt;">
Copy link
Contributor

@CaseyCarter CaseyCarter May 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pulled these changes into internal VS-PR-400483. Please notify me of any changes to this file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add this to the MSVC-PR mirror too.

Copy link
Contributor

@CaseyCarter CaseyCarter May 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May as well. I don't plan to include the "big" visualizer PR. I won't have time to review it today, expected is taking an ... unexpectedly long time to review. 😎

<SmartPointer Usage="Minimal">_Mypair._Myval2</SmartPointer>
<DisplayString Condition="_Mypair._Myval2 == 0">empty</DisplayString>
<DisplayString Condition="_Mypair._Myval2 != 0">unique_ptr void</DisplayString>
<Expand>
<Item Condition="_Mypair._Myval2 != 0" Name="[ptr]">_Mypair._Myval2</Item>
<Item Condition="_Mypair._Myval2 != 0" Name="[deleter]">_Mypair</Item>
</Expand>
</Type>

<Type Name="std::unique_ptr&lt;*&gt;">
<SmartPointer Usage="Minimal">_Mypair._Myval2</SmartPointer>
<DisplayString Condition="_Mypair._Myval2 == 0">empty</DisplayString>
Expand Down Expand Up @@ -388,6 +398,24 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
</Expand>
</Type>

<!-- Do not dereference _Ptr when type is void -->
<Type Name="std::shared_ptr&lt;void&gt;">
<SmartPointer Usage="Minimal">_Ptr</SmartPointer>
<DisplayString Condition="_Rep == 0">empty</DisplayString>
<DisplayString IncludeView="ptr" Condition="_Ptr == 0">nullptr</DisplayString>
<DisplayString IncludeView="ptr" Condition="_Ptr != 0">void</DisplayString>
<DisplayString Condition="(_Rep != 0) &amp;&amp; (_Rep-&gt;_Uses == 1) &amp;&amp; (_Rep-&gt;_Weaks == 1)" >shared_ptr {*this,view(ptr)} [{_Rep-&gt;_Uses} strong ref] [{*_Rep}]</DisplayString>
<DisplayString Condition="(_Rep != 0) &amp;&amp; (_Rep-&gt;_Uses == 1) &amp;&amp; (_Rep-&gt;_Weaks == 2)" >shared_ptr {*this,view(ptr)} [{_Rep-&gt;_Uses} strong ref, {_Rep-&gt;_Weaks - 1} weak ref] [{*_Rep}]</DisplayString>
<DisplayString Condition="(_Rep != 0) &amp;&amp; (_Rep-&gt;_Uses == 1) &amp;&amp; (_Rep-&gt;_Weaks &gt; 2)">shared_ptr {*this,view(ptr)} [{_Rep-&gt;_Uses} strong ref, {_Rep-&gt;_Weaks - 1} weak refs] [{*_Rep}]</DisplayString>
<DisplayString Condition="(_Rep != 0) &amp;&amp; (_Rep-&gt;_Uses &gt; 1) &amp;&amp; (_Rep-&gt;_Weaks == 1)" >shared_ptr {*this,view(ptr)} [{_Rep-&gt;_Uses} strong refs] [{*_Rep}]</DisplayString>
<DisplayString Condition="(_Rep != 0) &amp;&amp; (_Rep-&gt;_Uses &gt; 1) &amp;&amp; (_Rep-&gt;_Weaks == 2)" >shared_ptr {*this,view(ptr)} [{_Rep-&gt;_Uses} strong refs, {_Rep-&gt;_Weaks - 1} weak ref] [{*_Rep}]</DisplayString>
<DisplayString Condition="(_Rep != 0) &amp;&amp; (_Rep-&gt;_Uses &gt; 1) &amp;&amp; (_Rep-&gt;_Weaks &gt; 2)">shared_ptr {*this,view(ptr)} [{_Rep-&gt;_Uses} strong refs, {_Rep-&gt;_Weaks - 1} weak refs] [{*_Rep}]</DisplayString>
<Expand>
<Item Condition="_Rep != 0" Name="[ptr]">_Ptr</Item>
<Item Condition="_Rep != 0" Name="[control block]">*_Rep</Item>
</Expand>
</Type>

<Type Name="std::shared_ptr&lt;*&gt;">
<SmartPointer Usage="Minimal">_Ptr</SmartPointer>
<DisplayString Condition="_Rep == 0">empty</DisplayString>
Expand All @@ -405,6 +433,23 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
</Expand>
</Type>

<!-- Do not dereference _Ptr when type is void -->
<Type Name="std::weak_ptr&lt;void&gt;">
<DisplayString Condition="_Rep == 0">empty</DisplayString>
<DisplayString IncludeView="ptr" Condition="_Ptr == 0">nullptr</DisplayString>
<DisplayString IncludeView="ptr" Condition="_Ptr != 0">void</DisplayString>
<DisplayString Condition="(_Rep != 0) &amp;&amp; (_Rep-&gt;_Uses == 0) &amp;&amp; (_Rep-&gt;_Weaks == 1)" >expired [{_Rep-&gt;_Weaks} weak ref] [{*_Rep}]</DisplayString>
<DisplayString Condition="(_Rep != 0) &amp;&amp; (_Rep-&gt;_Uses == 0) &amp;&amp; (_Rep-&gt;_Weaks &gt; 1)">expired [{_Rep-&gt;_Weaks} weak refs] [{*_Rep}]</DisplayString>
<DisplayString Condition="(_Rep != 0) &amp;&amp; (_Rep-&gt;_Uses == 1) &amp;&amp; (_Rep-&gt;_Weaks == 2)" >weak_ptr {*this,view(ptr)} [{_Rep-&gt;_Uses} strong ref, {_Rep-&gt;_Weaks - 1} weak ref] [{*_Rep}]</DisplayString>
<DisplayString Condition="(_Rep != 0) &amp;&amp; (_Rep-&gt;_Uses == 1) &amp;&amp; (_Rep-&gt;_Weaks &gt; 2)">weak_ptr {*this,view(ptr)} [{_Rep-&gt;_Uses} strong ref, {_Rep-&gt;_Weaks - 1} weak refs] [{*_Rep}]</DisplayString>
<DisplayString Condition="(_Rep != 0) &amp;&amp; (_Rep-&gt;_Uses &gt; 1) &amp;&amp; (_Rep-&gt;_Weaks == 2)" >weak_ptr {*this,view(ptr)} [{_Rep-&gt;_Uses} strong refs, {_Rep-&gt;_Weaks - 1} weak ref] [{*_Rep}]</DisplayString>
<DisplayString Condition="(_Rep != 0) &amp;&amp; (_Rep-&gt;_Uses &gt; 1) &amp;&amp; (_Rep-&gt;_Weaks &gt; 2)">weak_ptr {*this,view(ptr)} [{_Rep-&gt;_Uses} strong refs, {_Rep-&gt;_Weaks - 1} weak refs] [{*_Rep}]</DisplayString>
<Expand>
<Item Condition="(_Rep != 0) &amp;&amp; (_Rep-&gt;_Uses &gt; 0)" Name="[ptr]">_Ptr</Item>
<Item Condition="_Rep != 0" Name="[control block]">*_Rep</Item>
</Expand>
</Type>

<Type Name="std::weak_ptr&lt;*&gt;">
<DisplayString Condition="_Rep == 0">empty</DisplayString>
<DisplayString IncludeView="ptr" Condition="_Ptr == 0">nullptr</DisplayString>
Expand Down