Commit e4e1bdb2 authored by hjk's avatar hjk

Debugger: Robustify typedef member lookup

Some code path did not resolve typedefs when looking up
struct members by name, making e.g. the BoostList dumper
fail for LLDB.

Change-Id: I7adf235cff3941574cab9f03d6f15ec5f3e2f0bd
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 8f2f614f
......@@ -2759,6 +2759,20 @@ class DumperBase:
self.targetValue = None # For references.
self.isBaseClass = None
def copy(self):
val = self.dumper.Value(self.dumper)
val.dumper = self.dumper
val.name = self.name
val.type = self.type
val.ldata = self.ldata
val.laddress = self.laddress
val.lIsInScope = self.lIsInScope
val.ldisplay = self.ldisplay
val.lbitpos = self.lbitpos
val.lbitsize = self.lbitsize
val.targetValue = self.targetValue
return val
def check(self):
if self.laddress is not None and not self.dumper.isInt(self.laddress):
error('INCONSISTENT ADDRESS: %s' % type(self.laddress))
......@@ -2848,12 +2862,18 @@ class DumperBase:
members = self.members(True)
for member in members:
#warn('CHECKING FIELD %s' % member.name)
if member.type.code == TypeCodeTypedef:
member = member.detypedef()
if member.name == name:
return member
for member in members:
#warn('CHECKING BASE %s' % member.name)
#if member.name == name:
# return member
if member.type.code == TypeCodeTypedef:
member = member.detypedef()
if member.name == name:
return member
if member.type.code == TypeCodeStruct:
res = member.findMemberByName(name)
if res is not None:
......@@ -2979,6 +2999,9 @@ class DumperBase:
res = []
anonNumber = 0
for field in fields:
if isinstance(field, self.dumper.Value):
res.append(field)
continue
if field.isBaseClass and not includeBases:
continue
if field.name is None or len(field.name) == 0:
......@@ -3029,10 +3052,8 @@ class DumperBase:
self.check()
if self.type.code != TypeCodeTypedef:
error("WRONG")
val = self.dumper.Value(self.dumper)
val = self.copy()
val.type = self.type.ltarget
val.ldata = self.ldata
val.laddress = self.laddress
#warn("DETYPEDEF FROM: %s" % self)
#warn("DETYPEDEF TO: %s" % val)
return val
......
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