Search code examples
pythonqtdebuggingqt-creatorcpython

Contents of PyString in Qt Creator debugger?


I've got a PyString* object that I would like to see the contents of. Is there any way to see the text of the PyString using Qt Creator's debugger?

PyObject *import_str = PyString_InternFromString("__import__");

If it makes a difference, Qt Creator is a front end to GDB.


Solution

  • You can write debugging info to be displayed in QtCreator for any class using Python with the latest QtCreator. It's actually quite simple. This is thanks to gdb 7 that added support for Python in addition to C++.

    You can see the ones that ship with QtCreator in /usr/share/qtcreator/gdbmacros.
    For more info you can check QtCreator documentation and this blog post from Qt Labs.