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

def qdump__int_image(d, value):
        pixels = value["pixels"]
        tx = value["tx"]
        ty = value["ty"]
        size = tx*ty
        maxDisplayItems = 4000

        type=gdb.lookup_type('int')
        ptr=gdb.Value(pixels.cast(type.pointer()))

        d.putValue('[%dx%d]'%(tx,ty))
        d.putNumChild(3)

        with Children(d):
                d.putSubItem("tx", tx)
                d.putSubItem("ty", ty)
                with SubItem(d, "pixels"):
                        d.putItemCount(size)
                        d.putNumChild(size)
                        if 1:
                        #if d.isExpanded():
numDisplayItems = min(maxDisplayItems, size) with Children(d,numChild=size,maxNumChild=numDisplayItems,childType=type,addrBase=ptr,addrStep=ptr.dereference().__sizeof__):
                                        for i in range(0,numDisplayItems):
d.putSubItem(i, ptr.dereference())
                                                ptr += 1

        file=open('/home/x/debug.txt','w')
        file.write(str(string.join(d.output,"\n")))
        file.close()


The output looks like this:

{
iname="local.grid",
name="grid",
addr="0x7fffffffde50",
numchild="3",
children=[
{
name="tx",
addr="0x7fffffffde58",
numchild="0",
type="int",
value="2",
},
{
name="ty",
addr="0x7fffffffde5c",
numchild="0",
type="int",
value="1953",
},
{
name="pixels",
numchild="3906",
childtype="int",
childnumchild="0",
addrbase="0x725ee0",
children=[
{
addr="0x725ee0",
value="0",
},
{
addr="0x725ee4",
value="0",
},
{
addr="0x725ee8",
value="2",
},
...
{
addr="0x729be4",
value="60",
},
],
value="<3906 items>",
},
],

But for "pixels" I only see <unavailable synchronous data> in Qt Creator. I have already tried lots of stuff but the message stays the same.

Any idea what I am missing?


Best regards,



Eddy

_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qt-creator

Reply via email to