Commit b2874f3b authored by hjk's avatar hjk

Debugger: Make some gdb dumper work for libc++

Better user experience on Mac.

Change-Id: Ice1455685e0e9bbe0d45cde20563929b7370695d
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 667390f8
......@@ -755,7 +755,11 @@ class Dumper(DumperBase):
def childAt(self, value, index):
field = value.type.fields()[index]
if len(field.name):
return value[field.name]
try:
return value[field.name]
except:
return value.cast(field.type)
# FIXME: Cheat. There seems to be no official way to access
# the real item, so we pass back the value. That at least
# enables later ...["name"] style accesses as gdb handles
......@@ -765,6 +769,9 @@ class Dumper(DumperBase):
def fieldAt(self, type, index):
return type.fields()[index]
def simpleValue(self, value):
return str(value)
def directBaseClass(self, typeobj, index = 0):
# FIXME: Check it's really a base.
return typeobj.fields()[index]
......
......@@ -381,6 +381,9 @@ class Dumper(DumperBase):
child = value.GetChildMemberWithName(name)
return child if child.IsValid() else None
def simpleValue(self, value):
return str(value.value)
def childAt(self, value, index):
return value.GetChildAtIndex(index)
......
......@@ -489,7 +489,7 @@ def qdump__std__shared_ptr(d, value):
return
if d.isSimpleType(d.templateArgument(value.type, 0)):
d.putValue("%s @0x%x" % (i.dereference(), d.pointerValue(i)))
d.putValue("%s @0x%x" % (d.simpleValue(i.dereference()), d.pointerValue(i)))
else:
i = d.expensiveDowncast(i)
d.putValue("@0x%x" % d.pointerValue(i))
......@@ -509,7 +509,7 @@ def qdump__std____1__shared_ptr(d, value):
return
if d.isSimpleType(d.templateArgument(value.type, 0)):
d.putValue("%s @0x%x" % (i.dereference().value, d.pointerValue(i)))
d.putValue("%s @0x%x" % (d.simpleValue(i.dereference()), d.pointerValue(i)))
else:
d.putValue("@0x%x" % d.pointerValue(i))
......@@ -528,7 +528,7 @@ def qdump__std__unique_ptr(d, value):
return
if d.isSimpleType(d.templateArgument(value.type, 0)):
d.putValue("%s @0x%x" % (i.dereference(), d.pointerValue(i)))
d.putValue("%s @0x%x" % (d.simpleValue(i.dereference()), d.pointerValue(i)))
else:
i = d.expensiveDowncast(i)
d.putValue("@0x%x" % d.pointerValue(i))
......@@ -538,14 +538,15 @@ def qdump__std__unique_ptr(d, value):
d.putSubItem("data", i)
def qdump__std____1__unique_ptr(d, value):
i = d.childAt(d.childAt(value["__ptr_"], 0), 0)
#i = d.childAt(d.childAt(value["__ptr_"], 0), 0)
i = d.childAt(value["__ptr_"], 0)["__first_"]
if d.isNull(i):
d.putValue("(null)")
d.putNumChild(0)
return
if d.isSimpleType(d.templateArgument(value.type, 0)):
d.putValue("%s @0x%x" % (i.dereference().value, d.pointerValue(i)))
d.putValue("%s @0x%x" % (d.simpleValue(i.dereference()), d.pointerValue(i)))
else:
d.putValue("@0x%x" % d.pointerValue(i))
......
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