diff --git a/lldb/bindings/python.swig b/lldb/bindings/python.swig --- a/lldb/bindings/python.swig +++ b/lldb/bindings/python.swig @@ -128,8 +128,15 @@ %include "./python/python-wrapper.swig" %pythoncode%{ +_initialize = True +try: + import lldbconfig + _initialize = lldbconfig.INITIALIZE +except ImportError: + pass debugger_unique_id = 0 -SBDebugger.Initialize() +if _initialize: + SBDebugger.Initialize() debugger = None target = None process = None diff --git a/lldb/packages/Python/lldbconfig/__init__.py b/lldb/packages/Python/lldbconfig/__init__.py new file mode 100644 --- /dev/null +++ b/lldb/packages/Python/lldbconfig/__init__.py @@ -0,0 +1 @@ +INITIALIZE = True diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -954,7 +954,9 @@ setupSysPath() + import lldbconfig import lldb + # Use host platform by default. lldb.selected_platform = lldb.SBPlatform.GetHostPlatform()