From 1124a75948c037a9b2c82323c8d24c2ff274e79b Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 1 Mar 2023 12:29:03 +0100 Subject: [PATCH] Debugger: Fix highlighting values and members in memory view Fixes: QTCREATORBUG-23681 Change-Id: I1420385d0c923be0ae4dd7ef2662263b88623333 Reviewed-by: Christian Stenger --- share/qtcreator/debugger/cdbbridge.py | 1 + share/qtcreator/debugger/dumper.py | 2 ++ src/plugins/debugger/watchhandler.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/share/qtcreator/debugger/cdbbridge.py b/share/qtcreator/debugger/cdbbridge.py index 8e5241e934a..f19d8dedf9b 100644 --- a/share/qtcreator/debugger/cdbbridge.py +++ b/share/qtcreator/debugger/cdbbridge.py @@ -118,6 +118,7 @@ class Dumper(DumperBase): val.isBaseClass = val.name == val._type.name val.nativeValue = nativeValue val.laddress = nativeValue.address() + val.lbitsize = nativeValue.bitsize() return val def nativeTypeId(self, nativeType): diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index 42b2a8c829f..84008943031 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -2792,6 +2792,8 @@ class DumperBase(): return self.putAddress(value.address()) + if value.lbitsize is not None: + self.putField('size', value.lbitsize // 8) if typeobj.code == TypeCode.Function: #DumperBase.warn('FUNCTION VALUE: %s' % value) diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 371f7fe4975..17ce07bee04 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -1427,15 +1427,15 @@ int WatchModel::memberVariableRecursion(WatchItem *item, const QString nameRoot = name.isEmpty() ? name : name + '.'; for (int r = 0; r < rows; r++) { WatchItem *child = item->childAt(r); - const quint64 childAddress = item->address; + const quint64 childAddress = child->address; if (childAddress && childAddress >= start - && (childAddress + item->size) <= end) { // Non-static, within area? + && (childAddress + child->size) <= end) { // Non-static, within area? const QString childName = nameRoot + child->name; const quint64 childOffset = childAddress - start; - const QString toolTip = variableToolTip(childName, item->type, childOffset); + const QString toolTip = variableToolTip(childName, child->type, childOffset); const ColorNumberToolTip colorNumberNamePair((*colorNumberIn)++, toolTip); const ColorNumberToolTips::iterator begin = cnmv->begin() + childOffset; - std::fill(begin, begin + item->size, colorNumberNamePair); + std::fill(begin, begin + child->size, colorNumberNamePair); childCount++; childCount += memberVariableRecursion(child, childName, start, end, colorNumberIn, cnmv); }