diff options
| author | Lukas Oesch <lukas.oesch@ost.ch> | 2026-06-10 10:40:46 +0200 |
|---|---|---|
| committer | Lukas Oesch <lukas.oesch@ost.ch> | 2026-06-10 10:40:46 +0200 |
| commit | 33abd5cf264cb9e34121082105b0bc17b3cf7a36 (patch) | |
| tree | 36b15d53fea04f4f9d9af817100f7ad013bd9b5c /kapi/gdb/memory/address.py | |
| parent | d01caf1c4aef3c89c68b9d1cc9fe56445f0860b5 (diff) | |
| parent | 7e27130c342b7299a1d2188a7192a7f17b5ac2ad (diff) | |
| download | kernel-33abd5cf264cb9e34121082105b0bc17b3cf7a36.tar.xz kernel-33abd5cf264cb9e34121082105b0bc17b3cf7a36.zip | |
Merge of BA-FS26 branch into develop
See merge request teachos/kernel!49
Diffstat (limited to 'kapi/gdb/memory/address.py')
| -rw-r--r-- | kapi/gdb/memory/address.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/kapi/gdb/memory/address.py b/kapi/gdb/memory/address.py new file mode 100644 index 0000000..429db1d --- /dev/null +++ b/kapi/gdb/memory/address.py @@ -0,0 +1,31 @@ +import gdb + + +class KapiMemoryAddressPrinter(gdb.ValuePrinter): + def __init__(self, val): + self.__val = val + self.__type = val.type.template_argument(0) + + def to_string(self): + try: + raw_address = int(self.__val["m_value"]) + type_string = str(self.__type) + + if "linear" in type_string: + suffix = "%lin" + elif "physical" in type_string: + suffix = "%phy" + else: + suffix = "%???" + + return f"{raw_address:#018x}{suffix}" + except Exception as e: + return f"{self.__val}: {e}" + + def children(self): + if "linear" in str(self.__type): + pointer_type = gdb.lookup_type("std::byte").pointer() + yield ("[bytes]", self.__val["m_value"].cast(pointer_type)) + + def display_hint(self): + return None |
