Adso4
Adso4

Reputation: 141

How to see Qt5 QString contents while debugging on Visual Studio 2015

I'm using visual studio 2015 and Qt5.

I'have already added qt5.natvis on Vislaualizers folders. I have set the "Use Native Compatibility Mode" option in Tools > Options > Debugging > General menu.

Even so, QString value does not appear correctly when debugging. Only memory direction appears on Locals/Autos/Watch windows. Any idea?

I have set Verbose option for Native diagnostic messages and this is what I get:

Natvis: Parsing natvis xml file: D:\<user_name>\Documents\Visual Studio 2015\Visualizers\qt5.natvis.
Natvis: Fatal error: 
Natvis: Parsing natvis xml file: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON TOOLS FOR VISUAL STUDIO\2.2\PythonDkm.natvis.
Natvis: Fatal error: 
Natvis: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Packages\Debugger\Visualizers\qt.natvis(128,25): Error: a pointer to a bound function may only be used to call the function
Error while evaluating 'd->data,sub' in the context of type '<executable>!QString'.
Natvis: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Packages\Debugger\Visualizers\qt.natvis(127,6): Ignoring visualizer for type 'QString' labeled as 'QString' because one or more sub-expressions was invalid.

Upvotes: 3

Views: 3732

Answers (2)

You need to use older natvis files. The ones you're using appear to use functionality that wasn't available in VS 2015.

The natvis file comes from the qt-labs/vstools repository. GitHub's online browser shows two revisions for src/qtvstools/qt5.natvis.xml, one from 2018, another from 2020.

The the 2018 revision also renamed the file from src/qtvisualizer/qt5.natvis.xml, with one prior revision.

Since the oldest revision is from 2016, maybe that'd work for you with VS 2015.

Upvotes: 0

mr NAE
mr NAE

Reputation: 3372

Original qt5.natvis from qt plugin for MSVS contains some strange problem. I use alternative natvis. I'm not sure if this will work correctly on MSVS 2015, if so, you can ask the author to help you

Upvotes: 1

Related Questions