JDevlieghere added a comment.

I feel like this puts too much Python specific logic in the driver compared to 
the convenience it brings. Even though we already leak python details (like 
`--python-path`), LLDB has always been designed to support several scripting 
languages. I'm not convinced this use case is compelling enough to make the 
situation worse.

FWIW `crashlog.py` has a good example of how to import LLDB. It's complicated 
slightly by us having to honor the `LLDB_DEFAULT_PYTHON_VERSION`, but otherwise 
it's pretty simple:

  try:
      import lldb
  except ImportError:
      lldb_python_path = subprocess.check_output(['xcrun', 'lldb', 
'-P']).decode("utf-8").strip()
      if os.path.exists(lldb_python_path) and not 
sys.path.__contains__(lldb_python_path):
          sys.path.append(lldb_python_path)
          import lldb

A potential alternative to this could be an `lldb-python` (python) script that 
reinvokes itself with the correct `PYTHONPATH` set?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112973/new/

https://reviews.llvm.org/D112973

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to