Skip to content

natvis visualizers do not follow typedefs on Linux #3038

Closed
@Djoulihen

Description

@Djoulihen

Hi
First of all thanks for implementing natvis visualization even with GDB, that is a very useful feature.

One pretty limiting shortcoming I found is that the visualization gets broken on Linux when the type of the variable is hidden behind a typedef. An example:

    std::vector<int> myVec1(5);

    typedef std::vector<int> MyVectorType;

    MyVectorType myVec2(10);

Using this natvis declaration:

<Type Name="std::vector&lt;*&gt;">
    <DisplayString>{{ size={_M_impl._M_finish - _M_impl._M_start} }}</DisplayString>
    <Expand>
        <Item Name="[size]" >_M_impl._M_finish - _M_impl._M_start</Item>
        <ArrayItems>
            <Size>_M_impl._M_finish - _M_impl._M_start</Size>
            <ValuePointer>_M_impl._M_start</ValuePointer>
        </ArrayItems>
    </Expand>
</Type>

In this case myVec1 will have its display string as { size=5 } while myVec2 will just have {...}. As it would be a cumbersome to add a new declaration in the natvis for every local typedef that could be used, it would be very useful if the visualizer could find the real type behind the typedef and match it, as Visual Studio does.

Thanks,
Julien

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions