Commit 5784a965 authored by hjk's avatar hjk

Debugger: Extract printing of dereferenced pointers into method

It's used twice, always for 'this', and whenever asked for by the
user's 'Dereference Pointers Automatically' choice, but needs to
be done at different times.

Change-Id: I4dc7340d0a4cb3eb0c7ff17d59e39be0e3870aa0
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent b952d042
......@@ -1304,6 +1304,17 @@ class DumperBase:
self.putFormattedPointerX(value)
self.ping('formattedPointer')
def putDerefedPointer(self, value):
derefValue = value.dereference()
innerType = value.type.target() #.unqualified()
self.putType(innerType)
savedCurrentChildType = self.currentChildType
self.currentChildType = innerType.name
derefValue.name = '*'
self.putItem(derefValue)
self.currentChildType = savedCurrentChildType
self.putOriginalAddress(value.pointer())
def putFormattedPointerX(self, value):
#warn("PUT FORMATTED: %s" % value)
pointer = value.pointer()
......@@ -1328,6 +1339,10 @@ class DumperBase:
self.putNumChild(0)
return
if self.currentIName.endswith('.this'):
self.putDerefedPointer(value)
return
displayFormat = self.currentItemFormat(value.type.name)
innerType = value.type.target() #.unqualified()
......@@ -1375,18 +1390,10 @@ class DumperBase:
#warn('AUTODEREF: %s' % self.autoDerefPointers)
#warn('INAME: %s' % self.currentIName)
#warn('INNER: %s' % innerType.name)
if self.autoDerefPointers or self.currentIName.endswith('.this'):
derefValue = value.dereference()
# Never dereference char types.
if self.autoDerefPointers:
# Generic pointer type with AutomaticFormat, but never dereference char types:
if innerType.name not in ('char', 'signed char', 'unsigned char', 'wchar_t'):
# Generic pointer type with AutomaticFormat.
self.putType(innerType)
savedCurrentChildType = self.currentChildType
self.currentChildType = innerType.name
derefValue.name = '*'
self.putItem(derefValue)
self.currentChildType = savedCurrentChildType
self.putOriginalAddress(pointer)
self.putDerefedPointer(value)
return
#warn('GENERIC PLAIN POINTER: %s' % value.type)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment