From a6eb6dd9093390a3bc041a87e24659a1b7858b44 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 1 Feb 2024 07:04:05 +0100 Subject: [PATCH] Debugger: try harder to find static meta object Improves dumping of QObjects when the staticMetaObject is defined in a different module than the object itself. Change-Id: Ic02103016d14b4925978d8afeaf2dbcc5dcebf85 Reviewed-by: Reviewed-by: Christian Stenger --- share/qtcreator/debugger/cdbbridge.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/share/qtcreator/debugger/cdbbridge.py b/share/qtcreator/debugger/cdbbridge.py index b41a4e3e377..d323714ba44 100644 --- a/share/qtcreator/debugger/cdbbridge.py +++ b/share/qtcreator/debugger/cdbbridge.py @@ -407,10 +407,16 @@ class Dumper(DumperBase): return mem def findStaticMetaObject(self, type): - typeName = type.name + ptr = 0 if type.moduleName is not None: - typeName = type.moduleName + '!' + typeName - ptr = cdbext.getAddressByName(typeName + '::staticMetaObject') + # Try to find the static meta object in the same module as the type definition. This is + # an optimization that improves the performance of looking up the meta object for not + # exported types. + ptr = cdbext.getAddressByName(type.moduleName + '!' + type.name + '::staticMetaObject') + if ptr == 0: + # If we do not find the meta object in the same module or we do not have the module name + # we fall back to the slow lookup over all modules. + ptr = cdbext.getAddressByName(type.name + '::staticMetaObject') return ptr def warn(self, msg):