Skip to content

STL.natvis: make_shared and allocate_shared are no longer visualized properly #2787

@StephanTLavavej

Description

@StephanTLavavej

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixedSomething works now, yay!visualizerHow the VS debugger displays STL types

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions