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: make_shared and allocate_shared are no longer visualized properly #2787

Closed
StephanTLavavej opened this issue Jun 13, 2022 · 0 comments · Fixed by #2811
Closed
Labels
fixed Something works now, yay! visualizer How the VS debugger displays STL types

Comments

@StephanTLavavej
Copy link
Member

STL.natvis contains visualizers for _Ref_count_obj and _Ref_count_obj_alloc:

STL/stl/debugger/STL.natvis

Lines 396 to 401 in 9947dd9

<Type Name="std::_Ref_count_obj&lt;*&gt;">
<DisplayString>make_shared</DisplayString>
<Expand>
<Item Condition="_Uses != 0" Name="[original ptr]">($T1 *) &amp;_Storage</Item>
</Expand>
</Type>

STL/stl/debugger/STL.natvis

Lines 412 to 419 in 9947dd9

<!-- VC 2015 -->
<Type Name="std::_Ref_count_obj_alloc&lt;*&gt;">
<DisplayString>allocate_shared</DisplayString>
<Expand>
<Item Condition="_Uses != 0" Name="[original ptr]">($T1 *) &amp;_Mypair._Myval2</Item>
<Item Name="[allocator]">_Mypair</Item>
</Expand>
</Type>

However, we've upgraded those control blocks (which is possible while preserving binary compatibility because shared_ptr performs type erasure). The modern forms are _Ref_count_obj2 and _Ref_count_obj_alloc3, which we don't have visualizers for:

STL/stl/inc/memory

Lines 2018 to 2019 in 9947dd9

template <class _Ty>
class _Ref_count_obj2 : public _Ref_count_base { // handle reference counting for object in control block, no allocator

STL/stl/inc/memory

Lines 2438 to 2439 in 9947dd9

template <class _Ty, class _Alloc>
class _Ref_count_obj_alloc3 : public _Ebco_base<_Rebind_alloc_t<_Alloc, _Ty>>, public _Ref_count_base {

Thus, while we intended for make_shared and allocate_shared to be visualized in cool ways, this has been broken for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Something works now, yay! visualizer How the VS debugger displays STL types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant