summaryrefslogtreecommitdiff
path: root/Meta/serenity_gdb.py
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-05-21 02:14:19 -0700
committerAndreas Kling <kling@serenityos.org>2021-05-21 15:23:01 +0200
commit0fbc5893bfc34d2a2fbe41566cc85e67047b156d (patch)
tree4da016c1a439466faba3cecd8dbbf30655e0ff03 /Meta/serenity_gdb.py
parent6b25842b104476afa3844363c85697718700e124 (diff)
downloadserenity-0fbc5893bfc34d2a2fbe41566cc85e67047b156d.zip
Meta: Add GDB pretty printer for AK::InlineLinkedList
This allows a developer to easily dump a InlineLinkedList in the debugger without having to manually running the list. I needed this for a recent bug investigation in the Kernel.
Diffstat (limited to 'Meta/serenity_gdb.py')
-rw-r--r--Meta/serenity_gdb.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Meta/serenity_gdb.py b/Meta/serenity_gdb.py
index 380037ee63..ce4e6e6ac2 100644
--- a/Meta/serenity_gdb.py
+++ b/Meta/serenity_gdb.py
@@ -159,6 +159,25 @@ class AKHashMapPrettyPrinter:
return elements
+class AKInlineLinkedList:
+ def __init__(self, val):
+ self.val = val
+
+ def to_string(self):
+ return self.val.type.name
+
+ def children(self):
+ node_type_ptr = self.val.type.template_argument(0).pointer()
+
+ elements = []
+ node = self.val["m_head"]
+ while node != 0:
+ elements.append(node.cast(node_type_ptr))
+ node = node["m_next"]
+
+ return [(f"[{i}]", elements[i].dereference()) for i in range(len(elements))]
+
+
class VirtualAddress:
def __init__(self, val):
self.val = val
@@ -187,6 +206,8 @@ class SerenityPrettyPrinterLocator(gdb.printing.PrettyPrinter):
return AKAtomic(val)
elif klass == 'AK::DistinctNumeric':
return AKDistinctNumeric(val)
+ elif klass == 'AK::InlineLinkedList':
+ return AKInlineLinkedList(val)
elif klass == 'AK::HashMap':
return AKHashMapPrettyPrinter(val)
elif klass == 'AK::RefCounted':