1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-22 05:03:56 +03:00

Fix StringDataPtr gdb pretty printer

This commit is contained in:
Maxime Coste 2015-05-13 13:28:23 +01:00
parent 49def73e4e
commit 51f6c52013

View File

@ -73,8 +73,8 @@ class StringView:
def to_string(self):
return "\"%s\"" % (self.val['m_data'].string("utf-8", "ignore", self.val['m_length']['m_value']))
class StringStoragePtr:
""" Print a ref_ptr<StringStorage>"""
class StringDataPtr:
""" Print a RefPtr<StringData>"""
def __init__(self, val):
self.val = val
@ -85,6 +85,16 @@ class StringStoragePtr:
content = (ptr + 1).cast(str_type).string("utf-8", "ignore", ptr.dereference()['length'])
return "\"%s\" (ref:%d)" % (content.replace("\n", "\\n"), ptr.dereference()['refcount'])
class RefPtr:
""" Print a RefPtr"""
def __init__(self, val):
self.val = val
def to_string(self):
ptr = self.val['m_ptr']
return "\"refptr %s\"" % (ptr)
class Option:
""" Print a Option"""
@ -131,7 +141,8 @@ def build_pretty_printer():
pp.add_printer('String', '^Kakoune::String$', String)
pp.add_printer('StringView', '^Kakoune::StringView$', StringView)
pp.add_printer('SharedString', '^Kakoune::SharedString$', StringView)
pp.add_printer('StringStoragePtr', '^Kakoune::ref_ptr<Kakoune::StringStorage>$', StringStoragePtr)
pp.add_printer('StringDataPtr', '^Kakoune::RefPtr<Kakoune::StringData,.*>$', StringDataPtr)
pp.add_printer('RefPtr', '^Kakoune::RefPtr<.*>$', RefPtr)
pp.add_printer('Option', '^Kakoune::Option$', Option)
pp.add_printer('LineCount', '^Kakoune::LineCount$', LineCount)
pp.add_printer('CharCount', '^Kakoune::CharCount$', CharCount)