microsoft / MIEngine

The Visual Studio MI Debug Engine ("MIEngine") provides an open-source Visual Studio Debugger extension that works with MI-enabled debuggers such as gdb and lldb.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

templated type alias not recognized

jobor opened this issue · comments

Consider the following code

template<typename T>
struct Foo
{
};

template<typename T> using Bar = Foo<T>;

int main()
{
    Foo<int> foo = {};
    Bar<int> bar = {};
    // break here and hover over foo and bar.
    return 0;
}

with this natvis file

<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
    <Type Name="Foo&lt;*&gt;">
        <DisplayString>this is a Foo</DisplayString>
    </Type>
</AutoVisualizer>

then cppdbg with gcc on Linux will be able to display the content of foo as this is a Foo, but it displays the default visualizer for bar.

Expected result: display this is a Foo for bar as well.

Adding <AlternativeType Name="Bar&lt;*&gt;"> to the Foo type does not work.

Adding a separate <Type Name="Bar&lt;*&gt;"> does not work.

Adding a separate <Type Name="Bar"> does work. However, I loose the information about the template parameters. I can't access $T1 anymore.

Side note / trivia: with cppvsdbg, this is a Foo is displayed for bar - also if the entry for Bar is missing in the natvis file.

More trivia: this contrived example stems from an attempt to display Qt's type QVector which is defined as template <typename T> using QVector = QList<T>.