aboutsummaryrefslogtreecommitdiff
path: root/scripts/gdb/pretty_printers.py
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-05-04 19:40:01 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-05-04 19:40:01 +0200
commitd8670d8eeb55bc0ea347cfe4a9a27640fe4e4e7e (patch)
tree58c69126ad8b2147f4a5b68350207b811d00f1e2 /scripts/gdb/pretty_printers.py
parent78e42a1b6e0a857865be1e60f82871ac13c91bb1 (diff)
downloadkernel-d8670d8eeb55bc0ea347cfe4a9a27640fe4e4e7e.tar.xz
kernel-d8670d8eeb55bc0ea347cfe4a9a27640fe4e4e7e.zip
debug: add multiboot2 information dump tool
This patch introduces a new GDB tool `dump_mb2i` that dump the multiboot2 information provided by the bootloader. This tool can be invoked in the GDB console. For example in vscode: -exec dump_mb2i ((kapi::boot::information)bootstrap_information).mbi The tool expects the address of the loader provided MB2 information as its only argument.
Diffstat (limited to 'scripts/gdb/pretty_printers.py')
-rw-r--r--scripts/gdb/pretty_printers.py41
1 files changed, 0 insertions, 41 deletions
diff --git a/scripts/gdb/pretty_printers.py b/scripts/gdb/pretty_printers.py
deleted file mode 100644
index c209328..0000000
--- a/scripts/gdb/pretty_printers.py
+++ /dev/null
@@ -1,41 +0,0 @@
-import sys
-import os
-import gdb
-import importlib.util
-
-script_path = os.path.abspath(__file__)
-script_root = os.path.dirname(script_path)
-repo_root = os.path.dirname(os.path.dirname(script_root))
-
-if script_root not in sys.path:
- sys.path.insert(0, script_root)
-
-components = {
- "kstd": "libs/kstd/gdb",
- "kapi": "kapi/gdb",
-}
-
-for component, path in components.items():
- full_path = os.path.join(repo_root, *path.split("/"))
- init_file = os.path.join(full_path, "__init__.py")
-
- if os.path.isfile(init_file):
- try:
- spec = importlib.util.spec_from_file_location(component, init_file)
- module = importlib.util.module_from_spec(spec)
- sys.modules[component] = module
- spec.loader.exec_module(module)
-
- if hasattr(module, "register_printers"):
- module.register_printers(gdb.current_objfile())
- gdb.write(f"Info: Registered pretty printers for '{component}'.\n")
- else:
- gdb.write(
- f"Warning: '{component}' does not have 'register_printers' function\n"
- )
- except Exception as e:
- gdb.write(f"Warning: Failed to load '{component}' pretty printers: {e}\n")
- else:
- gdb.write(f"Warning: GDB extension init not found: '{init_file}'\n")
-
-gdb.write("Info: Loaded TeachOS pretty printers.\n")