开发者

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 seein开发者_如何学Gog 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)


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


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.


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


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. :)


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™.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜