Update gdb pretty printer
This commit is contained in:
parent
3b0e9331a7
commit
2d9aa24e9d
|
@ -17,8 +17,8 @@ class ArrayIterator:
|
||||||
self.index = self.index + 1
|
self.index = self.index + 1
|
||||||
return ('[%d]' % index, (self.data + index).dereference())
|
return ('[%d]' % index, (self.data + index).dereference())
|
||||||
|
|
||||||
class MemoryView:
|
class ArrayView:
|
||||||
"""Print a memoryview"""
|
"""Print a ArrayView"""
|
||||||
|
|
||||||
def __init__(self, val):
|
def __init__(self, val):
|
||||||
self.val = val
|
self.val = val
|
||||||
|
@ -31,7 +31,7 @@ class MemoryView:
|
||||||
|
|
||||||
def to_string(self):
|
def to_string(self):
|
||||||
value_type = self.val.type.template_argument(0).unqualified().strip_typedefs()
|
value_type = self.val.type.template_argument(0).unqualified().strip_typedefs()
|
||||||
return "memoryview<%s>" % (value_type)
|
return "ArrayView<%s>" % (value_type)
|
||||||
|
|
||||||
class LineAndColumn:
|
class LineAndColumn:
|
||||||
"""Print a LineAndColumn"""
|
"""Print a LineAndColumn"""
|
||||||
|
@ -55,7 +55,6 @@ class BufferIterator:
|
||||||
else:
|
else:
|
||||||
return "buffer<none>@(%s, %s)" % (self.val['m_coord']['line'], self.val['m_coord']['column'])
|
return "buffer<none>@(%s, %s)" % (self.val['m_coord']['line'], self.val['m_coord']['column'])
|
||||||
|
|
||||||
std_str = gdb.lookup_type("std::string")
|
|
||||||
class String:
|
class String:
|
||||||
""" Print a String"""
|
""" Print a String"""
|
||||||
|
|
||||||
|
@ -63,8 +62,18 @@ class String:
|
||||||
self.val = val
|
self.val = val
|
||||||
|
|
||||||
def to_string(self):
|
def to_string(self):
|
||||||
|
std_str = gdb.lookup_type("std::string")
|
||||||
return self.val.cast(std_str)
|
return self.val.cast(std_str)
|
||||||
|
|
||||||
|
class StringView:
|
||||||
|
""" Print a StringView"""
|
||||||
|
|
||||||
|
def __init__(self, val):
|
||||||
|
self.val = val
|
||||||
|
|
||||||
|
def to_string(self):
|
||||||
|
return "\"%s\"" % (self.val['m_data'].string("utf-8", "ignore", self.val['m_length']['m_value']))
|
||||||
|
|
||||||
class Option:
|
class Option:
|
||||||
""" Print a Option"""
|
""" Print a Option"""
|
||||||
|
|
||||||
|
@ -103,12 +112,14 @@ class LineCount:
|
||||||
|
|
||||||
def build_pretty_printer():
|
def build_pretty_printer():
|
||||||
pp = gdb.printing.RegexpCollectionPrettyPrinter("kakoune")
|
pp = gdb.printing.RegexpCollectionPrettyPrinter("kakoune")
|
||||||
pp.add_printer('memoryview', '^Kakoune::memoryview<.*>$', MemoryView)
|
pp.add_printer('ArrayView', '^Kakoune::ArrayView<.*>$', ArrayView)
|
||||||
pp.add_printer('LineAndColumn', '^Kakoune::LineAndColumn<.*>$', LineAndColumn)
|
pp.add_printer('LineAndColumn', '^Kakoune::LineAndColumn<.*>$', LineAndColumn)
|
||||||
pp.add_printer('ByteCoord', '^Kakoune::ByteCoord$', LineAndColumn)
|
pp.add_printer('ByteCoord', '^Kakoune::ByteCoord$', LineAndColumn)
|
||||||
pp.add_printer('CharCoord', '^Kakoune::CharCoord$', LineAndColumn)
|
pp.add_printer('CharCoord', '^Kakoune::CharCoord$', LineAndColumn)
|
||||||
pp.add_printer('BufferIterator', '^Kakoune::BufferIterator$', BufferIterator)
|
pp.add_printer('BufferIterator', '^Kakoune::BufferIterator$', BufferIterator)
|
||||||
pp.add_printer('String', '^Kakoune::String$', String)
|
pp.add_printer('String', '^Kakoune::String$', String)
|
||||||
|
pp.add_printer('StringView', '^Kakoune::StringView$', StringView)
|
||||||
|
pp.add_printer('SharedString', '^Kakoune::SharedString$', StringView)
|
||||||
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