How to create a debugging helper for struct that has a char*



  • I am trying to create a QtCreator debugging helper for a structure.

    struct B {
    int i1;
    char* c1;
    };

    B b;
    b.i1 = 11;
    b.c1 = "def";
    

    I have created the following to report both structure fields on a single line.

    def qdump__B(d, value):
    t = '%d %s' % (value["i1"], value["c1"])
    d.putValue(t)

    However, I don't get what I want for output. I want:

    11 def

    I get:

    11 Value(name='c1',type=char*,bsize=64,bpos=None,data=,address=0x7fffffffcdc8)

    How do you format a char* for the above problem?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.