aboutsummaryrefslogtreecommitdiff
path: root/scripts/gdb/teachos.py
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-09-30 13:10:21 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-09-30 13:10:21 +0200
commit8bec65ba723c9c628d934ec02021d5ce09c01105 (patch)
tree2eec65a312bf523bbe94811f1b8c9f904d07327b /scripts/gdb/teachos.py
parent83f264c22326ae37a0eb38284935a32895a48efb (diff)
downloadkernel-8bec65ba723c9c628d934ec02021d5ce09c01105.tar.xz
kernel-8bec65ba723c9c628d934ec02021d5ce09c01105.zip
chore: clean up python scripts
Diffstat (limited to 'scripts/gdb/teachos.py')
-rw-r--r--scripts/gdb/teachos.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/scripts/gdb/teachos.py b/scripts/gdb/teachos.py
index 355f6b97..616a9c50 100644
--- a/scripts/gdb/teachos.py
+++ b/scripts/gdb/teachos.py
@@ -1,6 +1,6 @@
import sys
import os
-import gdb
+import gdb # pyright: ignore[reportMissingModuleSource]
import importlib.util
script_path = os.path.abspath(__file__)
@@ -24,9 +24,20 @@ for component, path in components.items():
if os.path.isfile(init_file):
try:
spec = importlib.util.spec_from_file_location(component, init_file)
+
+ if spec is None:
+ gdb.write(f"Warning: Could not create spec for '{component}' from '{init_file}'\n")
+ continue
+
module = importlib.util.module_from_spec(spec)
sys.modules[component] = module
- spec.loader.exec_module(module)
+
+ loader = spec.loader
+ if loader is None:
+ gdb.write(f"Warning: No loader found for '{component}' from '{init_file}'\n")
+ continue
+
+ loader.exec_module(module)
if hasattr(module, "register_printers"):
module.register_printers(gdb.current_objfile())