IDE Debug Helpers

From Qt Wiki
Revision as of 15:56, 14 January 2015 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

IDE debug helpers

Qt Creator

Qt Creator directly supports introspection of all Qt Containers and QObject derived classes for Qt 4 and Qt 5.
User defined types can be supported in addition, see the Qt Creator documentation for details.

MS visual studio QString & QByteArray expansions

The new layout of QString in Qt 5 is hard to inspect using the debugger.
The following code can be added to autoexp.dat (c:\program files(x86)\microsoft visual studio 9.0\common7\packages\debugger\autoexp.dat)
You should add it to the <nowiki>[Visualizer]</nowiki> section, before the STL/ATL containers.

Unfortunately, sizeof() cannot be used. That is why there is a constant 2 or 4 for the offset pointer.
For an x64 build, the sizes most likely need to be doubled.

MS Visual Studio 2012

There is a new way to visualize native type, see
http://code.msdn.microsoft.com/Writing-type-visualizers-2eae77a2 [code.msdn.microsoft.com] for details.

Ready-made .natvis files are included in the Visual Studio add-in [qt.io], and can be grabbed directly from gitorious [qt.gitorious.org].

So we can visualize QString and some other types using .natvis file
(save to file: USERPROFILE\My Documents\Visual Studio 2012\Visualizers\Qt5.natvis)

MS Visual Studio 2013

The “.natvis” files introduced in MSVS2012 received some additional attention in MSVS2013:

http://blogs.msdn.com/b/vcblog/archive/2013/06/28/using-visual-studio-2013-to-write-maintainable-native-visualizations-natvis.aspx

Categories: