diff options
| author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-09-06 11:53:19 +0200 |
|---|---|---|
| committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-09-07 12:53:37 +0200 |
| commit | fc038ef44561b6fa60adf40ada84d9337e76808c (patch) | |
| tree | 904004971c974cd5bfbd38a348d63e4ad40feac0 /src/corelib/debug_script.py | |
| parent | 70b9e0687b501f1602b0c4251cda50ddddfb6712 (diff) | |
Fix lldbbridge.py loading when using lldb + Python 3 from CLI
or from Xcode.
A command line lldb that uses python3 fails to load the 'utils'
module dependency when importing lldbbridge.py via the dSYM script
debug_script.py.
Add the directory where lldbbridge.py is as an additional import path
to sys.path.
This fixes the bridge to load in both CLI lldb and from within Xcode.
Traceback (most recent call last):
File "src/corelib/debug_script.py", line 92, in __lldb_init_module
bridge = import_bridge(bridge_path, debugger, session_dict)
File "src/corelib/debug_script.py", line 42, in import_bridge
bridge = imp.load_source(MODULE_NAME, path)
File "Versions/3.8/lib/python3.8/imp.py", line 171, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 702, in _load
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783,
in exec_module
File "<frozen importlib._bootstrap>", line 219,
in _call_with_frames_removed
File "Qt Creator.app/Contents/Resources/debugger/lldbbridge.py",
line 34, in <module>
import utils
ModuleNotFoundError: No module named 'utils'
Amends 1b73c202ce907cd03864413f472bfeb5abf5151e
Pick-to: 6.2
Change-Id: I521d7530e35ee9c51ae0418d2c532e58ec1952d0
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/corelib/debug_script.py')
| -rw-r--r-- | src/corelib/debug_script.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/debug_script.py b/src/corelib/debug_script.py index 7aaa1a79d13..c66549ceaa7 100644 --- a/src/corelib/debug_script.py +++ b/src/corelib/debug_script.py @@ -38,6 +38,8 @@ def import_bridge(path, debugger, session_dict, reload_module=False): if not reload_module and MODULE_NAME in sys.modules: del sys.modules[MODULE_NAME] + if sys.version_info[0] >= 3: + sys.path.append(os.path.dirname(path)) bridge = imp.load_source(MODULE_NAME, path) if not hasattr(bridge, '__lldb_init_module'): |
