views:

314

answers:

5

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)

+1  A: 

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.

Thomi
I know about that file. I wasn't aware I could use it to provide more info than what the debugger already had. I'll look into it.
Marcus Lindblom
Right - you can't call any methods, but many Qt objects have the interesting data hidden - often behind the `d` ptr, so you can show that data.
Thomi
But don't I need to manually add all of Qt to autoexp.dat? That's a wee bit too much work at the moment. ;)
Marcus Lindblom
yes you do, but I suggest just adding the ones you need, as you need them. I can make do with just QString, QDateTime, and a few others... then again, 90% of the time I use GDB, where it works out of the box.
Thomi
+2  A: 

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

Martin Beckett
The link had a good point about running as Admin on Vista, but I'm sort of missing the heavier classes (QWidget, etc). My autoexp.dat had the stuff from qt-vs-addin already. Perhaps it's something wrong with my symbol files for QT.
Marcus Lindblom
A: 

It seems like you might be out of luck.

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

ActiveQt also sounds promising, but it might be a bit of an overkill for you.

Beyond this, you would have to roll your own expressions, or maybe write a Visual Studio Debugger Visualizer. (more about that is on CodeProject or MSDN)

Since there is nothing like that out there, it might be a good opportunity for development from scratch. :)

Gyuri
A: 

It's definitely possible to look into the pimpl when Qt is compiled with debugging information. Not sure about VS, but with gdb it Just Works™.

Berkus
It does that here too. I wonder what the problem was? Perhaps bad stack or some corruption when I tried to debug previously. Thanks for making me look again. :)
Marcus Lindblom
A: 

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

larsm