Questions tagged [natvis]

Visual Studio uses .natvis files to visualize C++ types in debugger. Natvis file format replaces older autoexp.dat in previous versions of Visual Studio.

Visual C++ debugger uses .natvis files get a user friendly visualization of C++ types. Natvis files are new to Visual Studio 2012.

In addition to C++ libraries supplied by Microsoft, some 3-rd party libraries come with Natvis-enabled support, for example C++ library.

The format of the files is XML based. Here is an example of how std::string is displayed:

<Type Name="std::basic_string&lt;char,*&gt;">
    <DisplayString Condition="_Myres &lt; _BUF_SIZE">{_Bx._Buf,s}</DisplayString>
    <DisplayString Condition="_Myres &gt;= _BUF_SIZE">{_Bx._Ptr,s}</DisplayString>
    <StringView Condition="_Myres &lt; _BUF_SIZE">_Bx._Buf,s</StringView>
    <StringView Condition="_Myres &gt;= _BUF_SIZE">_Bx._Ptr,s</StringView>
    <Expand>
        <Item Name="[size]">_Mysize</Item>
        <Item Name="[capacity]">_Myres</Item>
        <ArrayItems>
            <Size>_Mysize</Size>
            <ValuePointer Condition="_Myres &lt; _BUF_SIZE">_Bx._Buf</ValuePointer>
            <ValuePointer Condition="_Myres &gt;= _BUF_SIZE">_Bx._Ptr</ValuePointer>
        </ArrayItems>
    </Expand>
</Type>
116 questions
0
votes
0 answers

Using a pattern when implementing a natvis visualizer

(P_BBB)((X*)this->member)
I.S.M.
  • 131
  • 1
  • 9
0
votes
1 answer

Custom natvis file for Armadillo only works with resharper

I created a custom visualizer file (.natvis) for Visual Studio (17.7.4) in order to be able to see data inside Armadillo containers. The custom visualization only works when hovering over the variable and when ReSharper(2018.3.2) is enabled. If I…
serg
  • 1
  • 1
0
votes
1 answer

Can a native visualiser modify the display of an item, based on the parameter name of its collection?

In my company, the developers are regularly using CMapStringToStr objects, and always the pointers have the same type, for a particular parameter, e.g. m_mapUsers : every pointer is a CL_USER object m_mapOthers : every pointer is a CL_OTHER…
Dominique
  • 16,450
  • 15
  • 56
  • 112
0
votes
1 answer

Natvis with multiple base classes

I'm working in a framework that does a lot of inheritance, and I've found that Natvis for one base class will interfere with that for another. Here's a dumb example: class MainBase {}; class ExtraBase {}; class Derived: MainBase, ExtraBase {}; With…
Biro Cash
  • 11
  • 4
0
votes
1 answer

How to (temporarily) typecast CPtrList entries using natvis?

I'm working with a C++ solution, based on STL, and I'm using CPtrList collections. I have here a CPtrList collection, containing void * entries, and I would like to typecast those automatically using a natvis file. Currently, my natvis looks as…
Dominique
  • 16,450
  • 15
  • 56
  • 112
0
votes
1 answer

Natvis for a type that may be compiled into dll or lib

I have a solution in visual studio that has one configuration that allows for each project to be statically linked into the main exe, and another configuration that compiles each project as its own dll. The idea being that I can develop using DLLs,…
Dan Forever
  • 381
  • 2
  • 12
0
votes
2 answers

Visual Studio natvis displaying pointer-to-interface

I'm trying to create debug visualizers for our company custom smart pointers. I would like to use ExpandItem to get the contents just one level down, which works for concrete types like ref_ptr, but not for virtual types like…
porglezomp
  • 1,333
  • 12
  • 24
0
votes
1 answer

Deconstruct array of structs with natvis

I'm looking for a way to display the Entries of an Array of structs in separate arrays with natvis in visual studio 2015. Display this +-x[0] +-a +-b +-c +-x[1] +-a +-b +-c ... as a +-[0] (= x[0].a) +-[1] (= x[1].a) ... b +-[0] …
heitho
  • 61
  • 1
  • 7
0
votes
3 answers

View Qt5.6 QStrings in Visual Studio 2015 Debugger

It seems that visualizing Qt5.6 QStrings in the Visual Studio 2015 debugger does not work with the standard way of QString visualization (adding a natvis to Visual Studio 2015\Visualizers) as one did in Visual Studio 2013 and before. Is this…
user3640262
  • 57
  • 2
  • 7
0
votes
1 answer

How do I set up the natvis file?

I am trying to use the .natvis file for Visual Studio 2012 to display a customised class in the Watch window but I cannot get it to display. If I have this structure namespace a { namespace b { template
Stefan
  • 3,669
  • 2
  • 32
  • 43
0
votes
1 answer

Using macros in natvis files?

I just learned about .natvis files in Visual Studio and I've been setting up some for my Ruby C++ Extension project. http://msdn.microsoft.com/en-us/library/jj620914.aspx However, then I tried to use one of the Ruby macro's in a conditional…
thomthom
  • 2,854
  • 1
  • 23
  • 53
1 2 3 4 5 6 7
8