Commit d6a2d096 authored by hjk's avatar hjk
Browse files

Debugger: Better QObject display with LLDB



Change-Id: Ide88fd07e077a158223a68cc504fff5a5b9391ac
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 6cc660fa
......@@ -636,6 +636,20 @@ class DumperBase:
addrBase=p, addrStep=ts):
self.putFields(value)
def cleanAddress(self, addr):
if addr is None:
return "<no address>"
# We cannot use str(addr) as it yields rubbish for char pointers
# that might trigger Unicode encoding errors.
#return addr.cast(lookupType("void").pointer())
# We do not use "hex(...)" as it (sometimes?) adds a "L" suffix.
try:
return "0x%x" % toInteger(addr)
except:
warn("CANNOT CONVERT TYPE: %s" % type(addr))
return str(addr)
def putFormattedPointer(self, value):
#warn("POINTER: %s" % value)
if self.isNull(value):
......@@ -654,7 +668,7 @@ class DumperBase:
except:
# Failure to dereference a pointer should at least
# show the value of a pointer.
self.putValue(cleanAddress(value))
self.putValue(self.cleanAddress(value))
self.putType(typeName)
self.putNumChild(0)
return True
......@@ -930,16 +944,6 @@ class DumperBase:
base += 1
f.write("e\n")
def cleanAddress(addr):
if addr is None:
return "<no address>"
# We cannot use str(addr) as it yields rubbish for char pointers
# that might trigger Unicode encoding errors.
#return addr.cast(lookupType("void").pointer())
# We do not use "hex(...)" as it (sometimes?) adds a "L" suffix.
return "0x%x" % toInteger(addr)
# Some "Enums"
......
......@@ -577,6 +577,13 @@ class Dumper(DumperBase):
#if numchild != self.currentChildNumChild:
self.put('numchild="%s",' % numchild)
def putPointerValue(self, value):
# Use a lower priority
if value is None:
self.putEmptyValue(-1)
else:
self.putValue("0x%x" % value.Dereference())
def putSimpleValue(self, value, encoding = None, priority = 0):
self.putValue(value.GetValue(), encoding, priority)
......
......@@ -1156,7 +1156,7 @@ def qdump__QObject(d, value):
# warn("SUPERDATA: %s" % superData)
if privateType is None:
#d.putValue(cleanAddress(value.address))
#d.putValue(d.cleanAddress(d.pointerValue(value))
d.putPlainChildren(value)
return
......@@ -1242,7 +1242,7 @@ def qdump__QObject(d, value):
exp = '"((%sQObject*)%s)"' % (ns, value.address)
warn("EXPRESSION: %s" % exp)
warn("METAOBJECT: %s" % mo)
addr = cleanAddress(metaStringData + metaData[offset])
addr = d.cleanAddress(metaStringData + metaData[offset])
warn("ADDRESS: %s" % addr)
prop = d.call(value, "property", str(addr))
warn("PROP: %s" % prop)
......@@ -1332,9 +1332,9 @@ def qdump__QObject(d, value):
d.putField("keyencoded", Hex2EncodedLatin1)
qq = q.cast(valuesType.pointer().pointer())
qq = qq.dereference();
d.putField("addr", cleanAddress(qq))
d.putField("addr", d.cleanAddress(qq))
d.putField("exp", "*(%s*)%s"
% (variant, cleanAddress(qq)))
% (variant, d.cleanAddress(qq)))
t = qdump__QVariant(d, qq)
# Override the "QVariant (foo)" output.
d.putBetterType(t)
......@@ -1376,7 +1376,7 @@ def qdump__QObject(d, value):
# Signals.
signalCount = metaData[13]
signalCount = int(metaData[13])
with SubItem(d, "signals"):
d.putItemCount(signalCount)
d.putNoType()
......@@ -1418,7 +1418,7 @@ def qdump__QObject(d, value):
with SubItem(d, "currentSender"):
d.putNoType()
sender = d_ptr["currentSender"]
d.putValue(cleanAddress(sender))
d.putPointerValue(sender)
if d.isNull(sender):
d.putNumChild(0)
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment