mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
Meta: Add GDB pretty printer for AK::SinglyLinkedList
This commit is contained in:
parent
0fbc5893bf
commit
bd1bdbe91b
1 changed files with 20 additions and 0 deletions
|
@ -159,6 +159,24 @@ class AKHashMapPrettyPrinter:
|
||||||
return elements
|
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:
|
class AKInlineLinkedList:
|
||||||
def __init__(self, val):
|
def __init__(self, val):
|
||||||
self.val = val
|
self.val = val
|
||||||
|
@ -218,6 +236,8 @@ class SerenityPrettyPrinterLocator(gdb.printing.PrettyPrinter):
|
||||||
return AKOwnPtr(val)
|
return AKOwnPtr(val)
|
||||||
elif klass == 'AK::NonnullRefPtr':
|
elif klass == 'AK::NonnullRefPtr':
|
||||||
return AKRefPtr(val)
|
return AKRefPtr(val)
|
||||||
|
elif klass == 'AK::SinglyLinkedList':
|
||||||
|
return AKSinglyLinkedList(val)
|
||||||
elif klass == 'AK::String':
|
elif klass == 'AK::String':
|
||||||
return AKString(val)
|
return AKString(val)
|
||||||
elif klass == 'AK::StringView':
|
elif klass == 'AK::StringView':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue