forked from qt-creator/qt-creator
Debugger: Fix ARM Mac visualizers
Fixed some (primarily related to `QMap`) alignment/padding issues on ARM-based Macs. Note that this change does not completely fix `StdMap` debugger dumper test, which still fails due to incorrect reported alignment of `std::string`. Task-number: QTCREATORBUG-32309 Change-Id: I06b8be49453546fafacfefe88acbc7197d6c9434 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -3917,18 +3917,8 @@ typename))
|
||||
alignment = self.type_size(typeid)
|
||||
elif code in (TypeCode.Pointer, TypeCode.Reference, TypeCode.RValueReference):
|
||||
alignment = self.ptrSize()
|
||||
elif self.isCdb:
|
||||
alignment = self.nativeStructAlignment(self.type_nativetype(typeid))
|
||||
else:
|
||||
size = self.type_size(typeid)
|
||||
if size is None:
|
||||
self.dump_type_cache()
|
||||
self.warn("NO ALIGNMENT FOUND FOR SIZE OF TYPE %s" % str(typeid))
|
||||
return 1
|
||||
if size >= self.ptrSize():
|
||||
alignment = self.ptrSize()
|
||||
else:
|
||||
alignment = size
|
||||
alignment = self.nativeStructAlignment(self.type_nativetype(typeid))
|
||||
#self.warn("GUESSING ALIGNMENT %s FOR TYPEID %s" % (alignment, typeid))
|
||||
self.type_alignment_cache[typeid] = alignment
|
||||
return alignment
|
||||
|
@@ -577,6 +577,17 @@ class Dumper(DumperBase):
|
||||
return fields
|
||||
|
||||
|
||||
def nativeStructAlignment(self, nativeType):
|
||||
#DumperBase.warn("NATIVE ALIGN FOR %s" % nativeType.name)
|
||||
def handleItem(nativeFieldType, align):
|
||||
a = self.type_alignment(self.from_native_type(nativeFieldType))
|
||||
return a if a > align else align
|
||||
align = 1
|
||||
for f in nativeType.fields():
|
||||
align = handleItem(f.type, align)
|
||||
return align
|
||||
|
||||
|
||||
def listLocals(self, partialVar):
|
||||
frame = gdb.selected_frame()
|
||||
|
||||
|
@@ -130,18 +130,17 @@ def qdump__std____1__map(d, value):
|
||||
d.putItemCount(size)
|
||||
|
||||
if d.isExpanded():
|
||||
keyType = value.type[0]
|
||||
valType = value.type[1]
|
||||
pair_type = alloc_type[0]
|
||||
|
||||
def in_order_traversal(node):
|
||||
(left, right, parent, color, _pad_1, key, _pad_2, val) = d.split(
|
||||
f'pppB@{{{keyType.name}}}@{{{valType.name}}}', node)
|
||||
(left, right, _parent, _is_black, _pad, pair) = d.split(
|
||||
f'pppB@{{{pair_type.name}}}', node)
|
||||
|
||||
if left:
|
||||
for res in in_order_traversal(left):
|
||||
yield res
|
||||
|
||||
yield key, val
|
||||
yield pair
|
||||
|
||||
if right:
|
||||
for res in in_order_traversal(right):
|
||||
@@ -308,6 +307,10 @@ def qdump__std____1__string(d, value):
|
||||
d.putCharArrayHelper(data, size, charType)
|
||||
|
||||
|
||||
def qdump__std____1__basic_string(d, value):
|
||||
qdump__std____1__string(d, value)
|
||||
|
||||
|
||||
def qdump__std____1__shared_ptr(d, value):
|
||||
i = value["__ptr_"]
|
||||
if i.pointer() == 0:
|
||||
|
@@ -904,6 +904,18 @@ class Dumper(DumperBase):
|
||||
|
||||
return lldb.SBType()
|
||||
|
||||
|
||||
def nativeStructAlignment(self, nativeType):
|
||||
#DumperBase.warn("NATIVE ALIGN FOR %s" % nativeType.name)
|
||||
def handleItem(nativeFieldType, align):
|
||||
a = self.type_alignment(self.from_native_type(nativeFieldType))
|
||||
return a if a > align else align
|
||||
align = 1
|
||||
for f in nativeType.get_fields_array():
|
||||
align = handleItem(f.type, align)
|
||||
return align
|
||||
|
||||
|
||||
def setupInferior(self, args):
|
||||
""" Set up SBTarget instance """
|
||||
|
||||
|
Reference in New Issue
Block a user