From 1a16caf221da6586f429a164656d89509398c625 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 4 Jul 2017 18:47:56 +0200 Subject: [PATCH] Debugger: Don't list static members of items in arrays To properly access a static member we need a nativeValue which we don't have in the expansion of an array. Not showing static members in that case is a compromise between LLDB behavior (never show statics) and showing something wrong (see the linked bug report) Task-number: QTCREATORBUG-18366 Change-Id: I688779224a89d4ecbc47dd5623922efb32be9c4c Reviewed-by: Christian Stenger Reviewed-by: Orgad Shaneh --- share/qtcreator/debugger/gdbbridge.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index 1dab5895839..0f171a445fe 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -489,10 +489,6 @@ class Dumper(DumperBase): #warn('LISTING FIELDS FOR %s' % nativeType) for nativeField in nativeType.fields(): - #if nativeField.bitpos is None: - # # This could be a static data member. Ignore it - # #warn(' STATIC MEMBER: %s' % nativeMember) - # continue fieldName = nativeField.name # Something without a name. # Anonymous union? We need a dummy name to distinguish @@ -506,7 +502,12 @@ class Dumper(DumperBase): anonNumber += 1 fieldName = '#%s' % anonNumber #warn('FIELD: %s' % fieldName) - yield self.fromNativeField(nativeField, nativeValue, fieldName) + # hasattr(nativeField, 'bitpos') == False indicates a static field, + # but if we have access to a nativeValue .fromNativeField will + # also succeed. We essentially skip only static members from + # artificial values, like array members constructed from address. + if hasattr(nativeField, 'bitpos') or nativeValue is not None: + yield self.fromNativeField(nativeField, nativeValue, fieldName) def fromNativeField(self, nativeField, nativeValue, fieldName): nativeFieldType = nativeField.type.unqualified()