Showing posts with label qt. Show all posts
Showing posts with label qt. Show all posts

Saturday, January 23, 2010

Gdb Qt pretty printers updated

I just commited an update to the Gdb Qt pretty printers, they work now for Qt 4.6. (I didn't test 4.5, but most won't work anymore I guess)

The printers need to poke around in private members, that's why they depend on a specific Qt version.

They are still located in the kdevelop git, instructions on how to enable them see here. (the svn url changed as kdevelop is now in extragear)

Unfortunately my merge request for Qt that would add them directly to Qt got rejected, so it is a bit difficult to support multiple Qt versions - for now 4.6 only is supported. Perhaps in future more people will discover this feature in Gdb and they will get added... You know where to find them.

Sunday, October 18, 2009

Gdb Qt pretty printers

The recently released gdb 7.0 adds a really great feature: python scripting for pretty printers. It makes it really easy to write pretty printers for any class.
Basically it's the same as QtCreator supports, however with a few differences:
  • also works in plain gdb on commandline
  • no compiled debug-helper library needed
  • a gdb-only solution
Example showing a QStringList:

Of course everything can be combined, as seen here:

Currently supported classes are: QString, QByteArray, QList, QMap, QDate, QTime, QDateTime

The code can be found in KDevelop git (gdb plugin uses them by default). For using in cli you need the following in ~/.gdbinit:
python
import sys

sys.path.insert(0, '/home/niko/kdesvn/kde-git/kdevelop/debuggers/gdb/printers')
from qt4 import register_qt4_printers
register_qt4_printers (None)

end
set print pretty 1

Gdb also supports autoloading the pretty printers - they could be included in -dev packages. The merge request that would add it to qt is still pending.

And now I'm off watching an episode of dexter :D