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 <christian.stenger@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2017-07-04 18:47:56 +02:00
parent e8dfe2f91d
commit 1a16caf221

View File

@@ -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()