mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-22 15:31:00 +00:00
72cb10c364
Summary: pudb and pdb interfere with the behavior of the inspect module. calling `inspect.getfile(inspect.currentframe())` returns a different result depending on whether or not you're in a debugger. Calling `os.path.abspath` on the result of `inspect.getfile(...)` normalizes the result between the two environments. Patch by Nathan Lanza <lanza@fb.com> Differential Revision: https://reviews.llvm.org/D49620 llvm-svn: 338923
29 lines
710 B
Python
29 lines
710 B
Python
import inspect
|
|
import os
|
|
import sys
|
|
|
|
|
|
def find_lldb_root():
|
|
lldb_root = os.path.dirname(
|
|
os.path.abspath(inspect.getfile(inspect.currentframe()))
|
|
)
|
|
while True:
|
|
lldb_root = os.path.dirname(lldb_root)
|
|
if lldb_root is None:
|
|
return None
|
|
|
|
test_path = os.path.join(lldb_root, "use_lldb_suite_root.py")
|
|
if os.path.isfile(test_path):
|
|
return lldb_root
|
|
return None
|
|
|
|
lldb_root = find_lldb_root()
|
|
if lldb_root is not None:
|
|
import imp
|
|
fp, pathname, desc = imp.find_module("use_lldb_suite_root", [lldb_root])
|
|
try:
|
|
imp.load_module("use_lldb_suite_root", fp, pathname, desc)
|
|
finally:
|
|
if fp:
|
|
fp.close()
|