natvis

Sysprogs forums Forums VisualGDB natvis

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #8278
    viktor
    Participant

    auto visualizer does not always work.
    take the example of code:

    #include <stdlib.h>
    #include <iostream>
    
    struct MyType
    {
      int _value_;
    };
    
    void test1(MyType mt) {
      std::cout << mt._value_ << std::endl;
    }
    
    void test2(const MyType mt) {
      std::cout << mt._value_ << std::endl;
    }
    
    void test3(const MyType &mt) {
      std::cout << mt._value_ << std::endl;
    }
    
    void test4(const MyType *mt) {
      std::cout << mt->_value_ << std::endl;
    }
    int main()
    {
      MyType mt{10};
      test1(mt);
      test2(mt);
      test3(mt);
      test4(&mt);
      system("pause");
      return 0;
    }

    and create a natvis file:

    <?xml version="1.0" encoding="utf-8"?>
    <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
      <Type Name="MyType">
        <DisplayString>[{_value_}]</DisplayString>
        <Expand>
          <Item Name="Value">_value_</Item>
        </Expand>
      </Type>
    </AutoVisualizer>

    if you create a project that Win32 Visual C++

    if the project is to create MinGW/Cygwin VisualGDB

    #8279
    viktor
    Participant

    little help AlternativeType.

    <?xml version="1.0" encoding="utf-8"?>
    <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
      <Type Name="MyType">
        <AlternativeType Name="const MyType" />
        <DisplayString>[{_value_}]</DisplayString>
        <Expand>
          <Item Name="Value">_value_</Item>
        </Expand>
      </Type>
    </AutoVisualizer>

    but it does not solve the problem with the pointer.

    • This reply was modified 7 years, 11 months ago by viktor.
    #8289
    support
    Keymaster

    Thanks for reporting this. Please try this build: http://sysprogs.com/files/tmp/VisualGDB-5.2.1.719.msi

    #8291
    viktor
    Participant

    Thank you. working.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.