pretty printer for pointers

Joachim Protze joachim.protze@tu-dresden.de
Thu Jun 21 13:57:00 GMT 2012


On 19.06.2012 10:27, graham wrote:
> I have tried many things including this
>     def children(self):
>         data2 = self.val.dereference()
>         ptype2 = gdb.lookup_type("QTextDocument").pointer()
>         yield
> "isEmpty",callClassMethod(data2.cast(ptype2).dereference(),"isEmpty","")
>
> but this results in an infinite loop
>
> My implementation of the callClassMethod function is
>
> def callClassMethod (value,func,args):
>
>     type = value.type
>     #type = type.unqualified ().strip_typedefs ()
>     #print "type %s" % type
>     exp = "((class %s*)%s)->%s()" % (type, value.address, func)
"%s" % value.address
is the source of your infinite loop as it triggers the pretty printer
for the pointer to value. Try
"%i" % long(value.address)
or
"0x%x" % long(value.address)

- Joachim

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5306 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://sourceware.org/pipermail/gdb/attachments/20120621/3e0d5270/attachment.p7s>


More information about the Gdb mailing list