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

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

Sunday, October 11, 2009

Quanta4 xdebug plugin

Hi Planet,

first, a short introduction: My name is Niko Sams, I'm from Austria. I have contributed to KDE for a while and ever since I planned blogging about - so here I am.

As a web developer and KDE user I need a good IDE. I use the great Quanta3 for years now, but it's dead now. So I started contributing to Quanta4 - well indirectly though various kdevelop plugins - those all will be used by Quanta4.
Yes - Quanta4 is not dead - we just need time (and developers).

What I've been working on recently is a XDebug (php debugger) plugin.

I started on this quite some time ago by creating a generic debugger infrastructure for kdevplatform - and port the kdevelop gdb plugin to that. In kdevelop3 every debugger plugin had it's own set of toolbars, views and everything - you can imagine how this looks like when you have 3 debuggers installed :D

For kdevplatform the common actions and views are now shared across debuggers.

Another important part was the new launch framework apaku introduced, with that we can have one Run » Launch Debug action that works for all debuggers. (Perhaps someone remembers the "Debug - Not yet working" action we had at the time of our latest KDevelop hack sprint)

You can follow the development here:

(for now only debugging local cli php scripts is supported)