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

Many Qt classes use pimpl, so they are very opaque to the VS debugger.

This bothers me when I want to check some Qt internal state to see if my code is doing wrong or I have the wrong expectations about how things are.

I am using the Qt VS add-on (1.1.0), but this does not seem to help.

Any ideas?

Update

My autoexp.dat file is filled with Qt materials, but I still can't peek into the heavier classes (QWidget, QTcpSocket, etc.).

I see simpler class contents, so autoexp.dat seems to work, but trying to peek inside QWidget does not work.

Update 2

For some reason, after reading the comments and looking more, it works, and I see the data material.

I don’t know what happened at this time (when I just worked and ignored it), but I had problems viewing the data before.

I accept the answer "just works" because I cannot delete the asked question and get the closest answer. (Autoexp-dat just nicely formats debug lines using data that is already visible if one digs out)

+6
debugging windows qt visual-studio
source share
5 answers

You can definitely look into pimpl when Qt is compiled with debugging information. Not sure about VS, but with gdb it's Just Works β„’.

-one
source share

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

IIRC: Qt installation for Windows includes autoexp.dat file -
Correction, this is part of qt-vs-addin

+3
source share

You need to add custom dump trucks for your debugger.

There are built-in for gdb. You may need to roll back to other debuggers, although for a visual studio you can easily get some decent results by setting up the autoexp.dat file. There are many resources on the Internet how to modify this file.

+1
source share

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

+1
source share

It seems you might be out of luck.

This page currently has the most comprehensive list of macros for QT wariables that can be added to autoexp.dat: QT with Visual Studio 2008 (updated for Qt 4.5.2)

ActiveQt also sounds promising, but it might be a little redundant for you.

Other than that, you'll have to collapse your own expressions, or perhaps write the Visualizer Visualizer of the Visual Studio debugger. (more on this on CodeProject or MSDN )

Since there is nothing like this, it can be a good opportunity for development from scratch. :)

0
source share

All Articles