aboutsummaryrefslogtreecommitdiff
path: root/scripts/gdb/toolchain.py
diff options
context:
space:
mode:
authorLukas Oesch <lukas.oesch@ost.ch>2026-06-10 10:40:46 +0200
committerLukas Oesch <lukas.oesch@ost.ch>2026-06-10 10:40:46 +0200
commit33abd5cf264cb9e34121082105b0bc17b3cf7a36 (patch)
tree36b15d53fea04f4f9d9af817100f7ad013bd9b5c /scripts/gdb/toolchain.py
parentd01caf1c4aef3c89c68b9d1cc9fe56445f0860b5 (diff)
parent7e27130c342b7299a1d2188a7192a7f17b5ac2ad (diff)
downloadkernel-33abd5cf264cb9e34121082105b0bc17b3cf7a36.tar.xz
kernel-33abd5cf264cb9e34121082105b0bc17b3cf7a36.zip
Merge branch 'develop-BA-FS26' into 'develop'HEADdevelop
Merge of BA-FS26 branch into develop See merge request teachos/kernel!49
Diffstat (limited to 'scripts/gdb/toolchain.py')
-rw-r--r--scripts/gdb/toolchain.py35
1 files changed, 35 insertions, 0 deletions
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()