diff options
Diffstat (limited to 'scripts/gdb')
| -rw-r--r-- | scripts/gdb/teachos.py (renamed from scripts/gdb/load.py) | 0 | ||||
| -rw-r--r-- | scripts/gdb/toolchain.py | 35 |
2 files changed, 35 insertions, 0 deletions
diff --git a/scripts/gdb/load.py b/scripts/gdb/teachos.py index 355f6b9..355f6b9 100644 --- a/scripts/gdb/load.py +++ b/scripts/gdb/teachos.py diff --git a/scripts/gdb/toolchain.py b/scripts/gdb/toolchain.py new file mode 100644 index 0000000..bbb7810 --- /dev/null +++ b/scripts/gdb/toolchain.py @@ -0,0 +1,35 @@ +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() |
