Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I see the contents of Qt objects during debugging?

Many Qt classes uses pimpl, so they're very opaque to VS's debugger.

This is bothersome when I want to check some internal Qt state to see if my code is doing it wrong or if I'm having wrong expectations of how things stand.

I'm using the Qt VS add-in (1.1.0), but that doesn't seem to help.

Any ideas?

Update

My autoexp.dat file is filled with Qt stuff, but I'm still not able to look inside the heavier classes (QWidget, QTcpSocket, etc).

I can see the simpler classes contents, so the autoexp.dat below seems to be working, but trying to look inside a QWidget doesn't work.

Update 2

For some reason, after reading comments and looking more, it does work, and I can see the data stuff.

I don't know what happened in the mean time (when I just worked and ignored it), but I did have problems seeing the data before.

I'm accepting the "just works" answer, because I can't delete a bountied question and that's the closest answer available. (The autoexp-dat just pretty-formats the debug lines, using data that's already visible if one digs down)

like image 793
Macke Avatar asked Oct 20 '09 20:10

Macke


People also ask

How do I debug JavaScript in Qt?

Qt Creator debug mode To open your app in debug mode, either press F5 in Qt Creator, or click the Start debugging of startup project button at the lower left of the Qt Creator window. See Interacting with the Debugger in the Qt documentation for more information on how to use the debugging tools in Qt Creator.

How do I debug QML in Visual Studio?

QML debugging is enabled by default for any Qt QML application. It is possible to disable QML debugging, and revert to native-only debugging, by opening the Qt project settings dialog and setting the "QML Debug" option to "Disable".


3 Answers

This might help http://daniel-albuschat.blogspot.com/2008/02/qt-debugging-with-visual-studio-2005.html

IIRC the install of Qt for Windows includes an autoexp.dat file -
Correction, it's part of the the qt-vs-addin

like image 163
Martin Beckett Avatar answered Oct 25 '22 07:10

Martin Beckett


You need to add custom dumpers for your debugger.

There are pre-built ones for GDB. You may have to roll your own for other debuggers, although for visual studio it's possible to get some decent results pretty easily by tweaking the autoexp.dat file. There are plenty of resources online for how to change this file.

like image 20
Thomi Avatar answered Oct 25 '22 08:10

Thomi


Editing autoexp.dat is an option. See http://eecs.vanderbilt.edu/research/hmtl/wiki/pmwiki.php?n=Knowledge.Qt for a set of visualizers.

like image 1
larsmoa Avatar answered Oct 25 '22 07:10

larsmoa