Fix StringDataPtr gdb pretty printer
This commit is contained in:
parent
49def73e4e
commit
51f6c52013
|
@ -73,8 +73,8 @@ class StringView:
|
||||||
def to_string(self):
|
def to_string(self):
|
||||||
return "\"%s\"" % (self.val['m_data'].string("utf-8", "ignore", self.val['m_length']['m_value']))
|
return "\"%s\"" % (self.val['m_data'].string("utf-8", "ignore", self.val['m_length']['m_value']))
|
||||||
|
|
||||||
class StringStoragePtr:
|
class StringDataPtr:
|
||||||
""" Print a ref_ptr<StringStorage>"""
|
""" Print a RefPtr<StringData>"""
|
||||||
|
|
||||||
def __init__(self, val):
|
def __init__(self, val):
|
||||||
self.val = val
|
self.val = val
|
||||||
|
@ -85,6 +85,16 @@ class StringStoragePtr:
|
||||||
content = (ptr + 1).cast(str_type).string("utf-8", "ignore", ptr.dereference()['length'])
|
content = (ptr + 1).cast(str_type).string("utf-8", "ignore", ptr.dereference()['length'])
|
||||||
return "\"%s\" (ref:%d)" % (content.replace("\n", "\\n"), ptr.dereference()['refcount'])
|
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:
|
class Option:
|
||||||
""" Print a Option"""
|
""" Print a Option"""
|
||||||
|
|
||||||
|
@ -131,7 +141,8 @@ def build_pretty_printer():
|
||||||
pp.add_printer('String', '^Kakoune::String$', String)
|
pp.add_printer('String', '^Kakoune::String$', String)
|
||||||
pp.add_printer('StringView', '^Kakoune::StringView$', StringView)
|
pp.add_printer('StringView', '^Kakoune::StringView$', StringView)
|
||||||
pp.add_printer('SharedString', '^Kakoune::SharedString$', 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('Option', '^Kakoune::Option$', Option)
|
||||||
pp.add_printer('LineCount', '^Kakoune::LineCount$', LineCount)
|
pp.add_printer('LineCount', '^Kakoune::LineCount$', LineCount)
|
||||||
pp.add_printer('CharCount', '^Kakoune::CharCount$', CharCount)
|
pp.add_printer('CharCount', '^Kakoune::CharCount$', CharCount)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user