summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-05-21 02:19:46 -0700
committerAndreas Kling <kling@serenityos.org>2021-05-21 15:23:01 +0200
commitbd1bdbe91bfe4e127d7a344bc42f1042c8245baa (patch)
tree16237e43a64388c397438e90417cbb7ac666590d
parent0fbc5893bfc34d2a2fbe41566cc85e67047b156d (diff)
downloadserenity-bd1bdbe91bfe4e127d7a344bc42f1042c8245baa.zip
Meta: Add GDB pretty printer for AK::SinglyLinkedList
-rw-r--r--Meta/serenity_gdb.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Meta/serenity_gdb.py b/Meta/serenity_gdb.py
index ce4e6e6ac2..0aff2ad17b 100644
--- a/Meta/serenity_gdb.py
+++ b/Meta/serenity_gdb.py
@@ -159,6 +159,24 @@ class AKHashMapPrettyPrinter:
return elements
+class AKSinglyLinkedList:
+ def __init__(self, val):
+ self.val = val
+
+ def to_string(self):
+ return self.val.type.name
+
+ def children(self):
+ elements = []
+
+ node = self.val["m_head"]
+ while node != 0:
+ elements.append(node["value"])
+ node = node["next"]
+
+ return [(f"[{i}]", elements[i]) for i in range(len(elements))]
+
+
class AKInlineLinkedList:
def __init__(self, val):
self.val = val
@@ -218,6 +236,8 @@ class SerenityPrettyPrinterLocator(gdb.printing.PrettyPrinter):
return AKOwnPtr(val)
elif klass == 'AK::NonnullRefPtr':
return AKRefPtr(val)
+ elif klass == 'AK::SinglyLinkedList':
+ return AKSinglyLinkedList(val)
elif klass == 'AK::String':
return AKString(val)
elif klass == 'AK::StringView':