xref: /freebsd/contrib/llvm-project/lldb/bindings/python/lldb-python (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
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