From 4b29b43a2a948ae01bb6f13039c0202cfc0ad86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 19 Sep 2023 23:55:12 +0200 Subject: [PATCH] lldb: Add summary providers using consistent module name When the lldbbridge is imported from the debug_script.py in qtbase, it's imported using the module name 'qt', to distinguish it from when Qt Creator imports the bridge. So when we add the synthetic child provider, we need to use the 'qt' module name. This fixes the warning: The provided class does not exist - please define it before attempting to use this synthetic provider If for some reason the lldbbridge.py is imported into a LLDB session directly, we mirror the 'lldbbrdige' module name to 'qt' as well, so that the class reference still holds. Change-Id: I531b10fd5e10eb0c2acd6014169a02ba3157c704 Reviewed-by: Alexandru Croitor Reviewed-by: Christian Stenger --- share/qtcreator/debugger/lldbbridge.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 4c5cec7a0ed..df1f57dc1c4 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -2437,6 +2437,12 @@ class SyntheticChildrenProvider(SummaryProvider): def __lldb_init_module(debugger, internal_dict): # Module is being imported in an LLDB session + + if not __name__ == 'qt': + # Make available under global 'qt' name for consistency, + # and so we can refer to SyntheticChildrenProvider below. + internal_dict['qt'] = internal_dict[__name__] + dumper = SummaryDumper.initialize() type_category = 'Qt' @@ -2462,14 +2468,10 @@ def __lldb_init_module(debugger, internal_dict): # Synthetic children debugger.HandleCommand("type synthetic add -x '^Q.*$' -l %s -w %s" - % ("lldbbridge.SyntheticChildrenProvider", type_category)) + % ("qt.SyntheticChildrenProvider", type_category)) debugger.HandleCommand('type category enable %s' % type_category) - if not __name__ == 'qt': - # Make available under global 'qt' name for consistency - internal_dict['qt'] = internal_dict[__name__] - if __name__ == "lldbbridge": try: