From 9968271d3f82799152473a27730c3b103cdb3274 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 18 Jun 2014 13:15:15 +0200 Subject: [PATCH] Debugger: Streamline gdb.Value field access workarounds Change-Id: I1b3b81019f6861353e5ada350fadbe3c8734f186 Reviewed-by: hjk --- share/qtcreator/debugger/gdbbridge.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index 655a3c99b57..2d0a8d43d68 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -634,12 +634,19 @@ class Dumper(DumperBase): def childAt(self, value, index): field = value.type.fields()[index] - # GDB 7.7 commit b5b08fb4 started to report None as field names. - if field.name: - try: - return value[field.name] - except: - return value.cast(field.type) + try: + # Official access in GDB 7.6 or later. + return value[field] + except: + pass + + 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 # the real item, so we pass back the value. That at least