diff options
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" |
