mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +00:00
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.
This commit is contained in:
parent
6b25842b10
commit
0fbc5893bf
1 changed files with 21 additions and 0 deletions
|
@ -159,6 +159,25 @@ class AKHashMapPrettyPrinter:
|
||||||
return elements
|
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:
|
class VirtualAddress:
|
||||||
def __init__(self, val):
|
def __init__(self, val):
|
||||||
self.val = val
|
self.val = val
|
||||||
|
@ -187,6 +206,8 @@ class SerenityPrettyPrinterLocator(gdb.printing.PrettyPrinter):
|
||||||
return AKAtomic(val)
|
return AKAtomic(val)
|
||||||
elif klass == 'AK::DistinctNumeric':
|
elif klass == 'AK::DistinctNumeric':
|
||||||
return AKDistinctNumeric(val)
|
return AKDistinctNumeric(val)
|
||||||
|
elif klass == 'AK::InlineLinkedList':
|
||||||
|
return AKInlineLinkedList(val)
|
||||||
elif klass == 'AK::HashMap':
|
elif klass == 'AK::HashMap':
|
||||||
return AKHashMapPrettyPrinter(val)
|
return AKHashMapPrettyPrinter(val)
|
||||||
elif klass == 'AK::RefCounted':
|
elif klass == 'AK::RefCounted':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue