aboutsummaryrefslogtreecommitdiff
path: root/kapi/gdb/boot_modules/boot_module.py
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-05-08 18:14:08 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-05-08 18:14:08 +0200
commit8ec011d9f5ad79c1e951127d3906a08e282649d1 (patch)
tree0223ce3c923578efe913f5b9dc39bf2c7481dcc9 /kapi/gdb/boot_modules/boot_module.py
parent07fb219869099c719b0fbfeae81b95512487639e (diff)
downloadkernel-8ec011d9f5ad79c1e951127d3906a08e282649d1.tar.xz
kernel-8ec011d9f5ad79c1e951127d3906a08e282649d1.zip
debug: add pretty printer for boot modules
Diffstat (limited to 'kapi/gdb/boot_modules/boot_module.py')
-rw-r--r--kapi/gdb/boot_modules/boot_module.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/kapi/gdb/boot_modules/boot_module.py b/kapi/gdb/boot_modules/boot_module.py
new file mode 100644
index 0000000..f0d558b
--- /dev/null
+++ b/kapi/gdb/boot_modules/boot_module.py
@@ -0,0 +1,23 @@
+import gdb
+from teachos import format_size
+
+
+class KapiBootModulesBootModulePrinter(gdb.ValuePrinter):
+ def __init__(self, val):
+ self.__val = val
+ self.__name = val["name"]
+ self.__start = val["start_address"]
+ self.__size = val["size"]
+ self.__pointer_type = gdb.lookup_type("std::byte").pointer()
+ self.__pretty_name = self.__name if str(self.__name) != '""' else "<no name>"
+
+ def to_string(self):
+ return f"boot module {self.__pretty_name} of size {format_size(int(self.__size))}, at {self.__start.cast(self.__pointer_type)}"
+
+ def children(self):
+ yield ("name", self.__name)
+ yield ("start_address", self.__start)
+ yield ("size", self.__size)
+
+ def display_hint(self):
+ return None