[Development] GDB python pretty printers for common Qt classes

David Faure david.faure at kdab.com
Mon Jul 22 23:22:08 CEST 2013

On Thursday 18 July 2013 22:58:50 Milian Wolff wrote:
> Hey all!
> KDevelop is since some time relying on python pretty printers to stringify
> common Qt container classes when using GDB [1]. They work nicely in any GDB
> console, as long as you compile your app with -O0 -g -fno-inline. If you
> don't do that, the existing pretty printers will start to fail. To improve
> that situation, I would like to start rewriting the pretty printers and
> rely more on the actual internal Qt implementation.


> Since this might change between versions, I would very much welcome if we
> could get these pretty printers into Qt itself. Note that while the existing
> code we wrote is mostly for Qt4, afaik it also works relatively OK for Qt5
> already. 

Yes, I use them almost every day.

> I think getting it upstream for Qt5 only would be good.

Hell yes :-)

> Feedback? And, if this is accepted - where should such files reside? Should
> they accompany each Qt module? Or should there be a central pretty printer
> file?

Currently it's all about types from qtbase, isn't it? So it would be a file 
installed by qtbase.
(If there's more, I'd say that each module should have its own file).

> What classes should be pretty-printable?

QString is the most important one by far.
Collection classes come next.

PS: of course, make sure they work from a core dump too - i.e. without a 

David Faure | david.faure at kdab.com | Managing Director KDAB France
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions

More information about the Development mailing list