Debugger: Streamline gdb.Value field access workarounds

Change-Id: I1b3b81019f6861353e5ada350fadbe3c8734f186
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
hjk
2014-06-18 13:15:15 +02:00
parent e744649456
commit 9968271d3f

View File

@@ -634,12 +634,19 @@ class Dumper(DumperBase):
def childAt(self, value, index): def childAt(self, value, index):
field = value.type.fields()[index] field = value.type.fields()[index]
# GDB 7.7 commit b5b08fb4 started to report None as field names. try:
if field.name: # Official access in GDB 7.6 or later.
try: return value[field]
return value[field.name] except:
except: pass
return value.cast(field.type)
try:
# Won't work with anon entities, tradionally with empty
# field name, but starting with GDB 7.7 commit b5b08fb4
# with None field name.
return value[field.name]
except:
pass
# FIXME: Cheat. There seems to be no official way to access # FIXME: Cheat. There seems to be no official way to access
# the real item, so we pass back the value. That at least # the real item, so we pass back the value. That at least