Skip to content

Commit

Permalink
etc: Pretty print openage::curve::Keyframe.
Browse files Browse the repository at this point in the history
  • Loading branch information
heinezen committed Apr 7, 2024
1 parent f34022c commit 6a234ef
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions etc/gdb_pretty/printers.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,28 @@ def display_hint():
Get the display hint for the vector.
"""
return 'array'


@printer_regex('^openage::curve::Keyframe<.*>')
class KeyframePrinter:
"""
Pretty printer for openage::curve::Keyframe.
TODO: Inherit from gdb.ValuePrinter when gdb 14.1 is available in all distros.
"""

def __init__(self, val: gdb.Value):
self.__val = val

def to_string(self):
"""
Get the keyframe as a string.
"""
return f'openage::curve::Keyframe<{self.__val.type.template_argument(0)}>'

def children(self):
"""
Get the displayed children of the keyframe.
"""
yield ('time', self.__val['time'])
yield ('value', self.__val['value'])

0 comments on commit 6a234ef

Please sign in to comment.