import os import subprocess import sys def setup_toolchain_debugging(): try: gcc_path = ( subprocess.check_output(["which", "x86_64-pc-elf-g++"]) .decode("utf-8") .strip() ) python_dir = None share_path = os.path.join(os.path.dirname(os.path.dirname(gcc_path)), "share") for root, dirs, _ in os.walk(share_path): if "libstdcxx" in dirs: python_dir = root break if python_dir: sys.path.insert(0, python_dir) from libstdcxx.v6.printers import register_libstdcxx_printers from libstdcxx.v6.xmethods import register_libstdcxx_xmethods register_libstdcxx_printers(None) register_libstdcxx_xmethods(None) print(f"Loaded Printers & Xmethods from: {python_dir}") except Exception as e: print(f"Debug setup failed: {e}") setup_toolchain_debugging()