33 from distutils.version
import LooseVersion
38 if not reload_module
and MODULE_NAME
in sys.modules:
39 del sys.modules[MODULE_NAME]
41 if sys.version_info[0] >= 3:
42 sys.path.append(os.path.dirname(path))
43 bridge = imp.load_source(MODULE_NAME, path)
45 if not hasattr(bridge,
'__lldb_init_module'):
50 session_dict[MODULE_NAME] = bridge
53 bridge.__lldb_init_module(debugger, session_dict)
55 if not debugger.GetCategory(
'Qt'):
57 del session_dict[MODULE_NAME]
63 print(
"Using Qt summary providers from Creator {} in '{}'".format(
64 bridge.CREATOR_VERSION, bridge.CREATOR_PATH))
66 def __lldb_init_module(debugger, session_dict):
70 if MODULE_NAME
in sys.modules:
71 module = sys.modules[MODULE_NAME]
73 bridge =
import_bridge(module.__file__, debugger, session_dict,
80 for install
in os.popen(
81 'mdfind kMDItemCFBundleIdentifier=org.qt-project.qtcreator'
83 'do echo $p=$(mdls "$p" -name kMDItemVersion -raw);'
85 install = install.strip()
86 (p, v) = install.split(
'=')
89 for version
in sorted(versions, key=LooseVersion, reverse=
True):
90 path = versions[version]
92 bridge_path =
'{}/Contents/Resources/debugger/lldbbridge.py'.format(path)
95 bridge.CREATOR_VERSION = version
96 bridge.CREATOR_PATH = path
100 print(
"Could not find Qt Creator installation, no Qt summary providers installed")
def report_success(bridge)
def import_bridge(path, debugger, session_dict, reload_module=False)