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