Bug 819525: JS GDB pretty-printers: Don't trip over tagless structs. DONTBUILD r=sfink

This commit is contained in:
Jim Blandy 2012-12-12 18:09:50 -08:00
parent ee5da5b676
commit c0928bdcb3
2 changed files with 5 additions and 3 deletions

View File

@ -53,7 +53,9 @@ class EncapsulatedValue(Common):
# Return the referent of a HeapPtr, Rooted, or Handle.
def deref(root):
tag = root.type.strip_typedefs().tag
if tag.startswith('js::HeapPtr<'):
if not tag:
raise TypeError, "Can't dereference type with no structure tag: %s" % (root.type,)
elif tag.startswith('js::HeapPtr<'):
return root['value']
elif tag.startswith('js::Rooted<'):
return root['ptr']

View File

@ -231,7 +231,7 @@ def lookup_for_objfile(objfile):
for t2 in implemented_types(t.target()):
if t2.code == gdb.TYPE_CODE_TYPEDEF:
p = check_table(ptr_printers_by_tag, str(t2))
elif t2.code == gdb.TYPE_CODE_STRUCT:
elif t2.code == gdb.TYPE_CODE_STRUCT and t2.tag:
p = check_table(ptr_printers_by_tag, t2.tag)
else:
p = None
@ -239,7 +239,7 @@ def lookup_for_objfile(objfile):
else:
if t.code == gdb.TYPE_CODE_TYPEDEF:
p = check_table(printers_by_tag, str(t))
elif t.code == gdb.TYPE_CODE_STRUCT:
elif t.code == gdb.TYPE_CODE_STRUCT and t.tag:
m = template_regexp.match(t.tag)
if m:
p = check_table(template_printers_by_tag, m.group(1))