Meta: Add GDB pretty printer for AK::SinglyLinkedList
This commit is contained in:
parent
0fbc5893bf
commit
bd1bdbe91b
Notes:
sideshowbarker
2024-07-18 17:38:03 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/bd1bdbe91bf Pull-request: https://github.com/SerenityOS/serenity/pull/7342 Reviewed-by: https://github.com/gunnarbeutner ✅
1 changed files with 20 additions and 0 deletions
|
@ -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':
|
||||
|
|
Loading…
Add table
Reference in a new issue