diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-05-01 20:46:21 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-05-01 20:46:21 +0200 |
| commit | 61949538ad6d114c1c2a788928a0b9706b4efc76 (patch) | |
| tree | a1cf47e160d040ea4b199b6ca089e4580a810a7f /scripts/gdb/kstd/vector.py | |
| parent | b1405c44434fbfa535348d310aa3243203aefb06 (diff) | |
| download | kernel-61949538ad6d114c1c2a788928a0b9706b4efc76.tar.xz kernel-61949538ad6d114c1c2a788928a0b9706b4efc76.zip | |
debug: add support for kstd pretty printing
Diffstat (limited to 'scripts/gdb/kstd/vector.py')
| -rw-r--r-- | scripts/gdb/kstd/vector.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/gdb/kstd/vector.py b/scripts/gdb/kstd/vector.py new file mode 100644 index 0000000..b42aeae --- /dev/null +++ b/scripts/gdb/kstd/vector.py @@ -0,0 +1,22 @@ +import gdb + + +class KstdVectorPrinter: + + def __init__(self, val): + self.val = val + self.type = val.type.template_argument(0) + + def to_string(self): + size = int(self.val(["m_size"])) + capacity = int(self.val(["m_capacity"])) + return f"kstd::vector<{self.type}> of length {size}, capacity {capacity}" + + def children(self): + size = int(self.val["m_size"]) + data_pointer = self.val["m_data"] + for i in range(size): + yield (f"[{i}]", (data_pointer + i).dereference()) + + def display_hint(self): + return "array" |
