From 78bdb0fa6dc5e89156a5c2e1f8d1b5650fe26e20 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Wed, 6 May 2026 06:56:47 +0000 Subject: dump_mb2i: dump unsupported tags as hex --- scripts/gdb/teachos/dump_mb2i.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/gdb/teachos/dump_mb2i.py b/scripts/gdb/teachos/dump_mb2i.py index ca0c378..3a9ee4a 100644 --- a/scripts/gdb/teachos/dump_mb2i.py +++ b/scripts/gdb/teachos/dump_mb2i.py @@ -161,9 +161,9 @@ class DumpMB2I(gdb.Command): def _print_tag(self, inferior, tag_address, tag_type, tag_size): name = TAG_NAMES.get(tag_type, f"Unknown Tag") - gdb.write( - f"[Tag {tag_type:#04x}] {name} (size: {self._format_size(tag_size)})\n" - ) + size = self._format_size(tag_size) + payload = self._format_size(tag_size - 8) + gdb.write(f"[Tag {tag_type:#04x}] {name} (size: {size} | payload: {payload})\n") if tag_size <= 8 and tag_type != TagType.END: return @@ -182,9 +182,8 @@ class DumpMB2I(gdb.Command): TagType.FRAMEBUFFER: self._write_framebuffer_info_tag, } - handler = handlers.get(tag_type) - if handler: - handler(data) + handler = handlers.get(tag_type, self._write_unknown_tag) + handler(data) except Exception as e: gdb.write( @@ -242,3 +241,9 @@ class DumpMB2I(gdb.Command): gdb.write(f"{INDENT}width: {width} chars | height: {height} chars\n") else: gdb.write(f"{INDENT}width: {width} px | height: {height} px\n") + + def _write_unknown_tag(self, data): + for i in range(0, len(data), 16): + chunk = data[i : i + 16] + hex_chunk = " ".join([f"{b:02x}" for b in chunk]) + gdb.write(f"{INDENT}{i:#010x}: {hex_chunk}\n") -- cgit v1.2.3