[Qt-creator] qdump for custom data type won't work - unavailable synchronous data

Poenitz Andre Andre.Poenitz at digia.com
Thu Apr 3 17:28:30 CEST 2014

Eddy Ilg wrote:
> I am having trouble integrating my own custom data type into Qt Creator, although very simple:
> struct int_image 
> {
>  int* pixels; 
>     int tx; /* size in x-dimension */
>     int ty; /* size in y-dimension */
> }; 

> I defined a custom dumper like this (almost identical to 
> http://plohrmann.blogspot.de/2013/10/writing-debug-visualizers-for-gdb.html):
> [...]

Try something like

def qdump__int_image(d, value):
    tx = value["tx"]
    ty = value["ty"]
    d.putValue('[%dx%d]' % (tx, ty))
    if d.isExpanded():
        with Children(d):
            d.putSubItem("tx", tx)  # or short: 'd.putFields(value)' for this and the next line
            d.putSubItem("ty", ty)  
            with SubItem(d, "pixels"):
                size = tx*ty
                if d.isExpanded():
                    pixels = value["pixels"]
                    d.putArrayData(pixels.type.target(), pixels, size, maxNumChild=4000)

Exact syntax is still a bit in a flux as long as I am trying to make the same 
code work with gdb and lldb, and Python 2.x and 3.x at the same time, but
with 3.1 we are "essentially there".

It usually doesn't hurt to look at the various share/qtcreator/debugger/*types.py 
files to get an idea how it should look like.

For "debugging the debugger" there's nowadays a "magic button" in the 
lower left of the Debugger Log view. Pressing that attaches a python 
backtrace to the log usually directly pointing to the problem


More information about the Qt-creator mailing list