Where are files required for debugging support of Qt 4.8 types in Visual Studio 2013? I've heard about *.natvis files, but I've found only Qt5 *.natvis files for Visual Studio 2013 or Qt4 *.natvis for Visual Studio 2012. They don't work for me. Are Visual Studio 2012 *.natvis and Visual Studio 2013 *.natvis incompatible?
Asked
Active
Viewed 678 times
1 Answers
2
Either one should "work", but know that the Qt 5 natvis is going to reference a different object structure, e.g. QString has a member offset
in Qt 5, but not Qt 4.8. I grabbed the Qt5.natvis from the Qt VS Addin and anything that didn't work, I cracked open autoexp.dat (the old way of doing this) to look at the Qt modifications created by the VS addin and make appropriate changes.
QString in autoexp.dat:
QString|*::QString{
preview ([$e.d->data,su])
stringview ([$e.d->data,sub])
children
(
#(
d: $c.d,
[size]: $c.d->size,
[referenced]: $c.d->ref._q_value
)
)
}
QString in Qt5.natvis:
<Type Name="QString">
<DisplayString>{((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),sub}</DisplayString>
<StringView>((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),sub</StringView>
<Expand>
<Item Name="[size]">d->size</Item>
<Item Name="[referenced]">d->ref.atomic._q_value</Item>
<ArrayItems>
<Size>d->size</Size>
<ValuePointer>((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),c</ValuePointer>
</ArrayItems>
</Expand>
</Type>
How did you attempt to install them? What errors do you get? They can either go in Documents\Visual Studio 2015\Visualizers to be added by the IDE, or you can put them in your project tree and add them to the project.

John Neuhaus
- 1,784
- 20
- 32
-
Would you mind sharing your qt4.natvis, e.g. as a GIST? – Andreas Haferburg Mar 01 '18 at 17:46