xref: /freebsd/contrib/llvm-project/lldb/bindings/python/lldb-python (revision d5b0e70f7e04d971691517ce1304d86a1e367e2e)
1#!/usr/bin/env python3
2
3import subprocess
4import os
5import sys
6import json
7
8lldb = os.path.join(os.path.dirname(__file__), 'lldb')
9
10info_json = subprocess.run([lldb, "-l", "python", "-print-script-interpreter-info"],
11    check=True, stdout=subprocess.PIPE, encoding='utf8').stdout
12info = json.loads(info_json)
13
14os.environ["PYTHONPATH"] = (
15    info["lldb-pythonpath"] + os.path.pathsep + os.environ.get("PYTHONPATH", ""))
16
17os.execl(info["executable"], info["executable"], *sys.argv[1:])
18