debug/gdb/printers: don't bother taking a secondary type

This commit is contained in:
Danny Robson 2019-01-18 19:45:31 +11:00
parent a94ca358a5
commit 8d8e071b8b

View File

@ -2,12 +2,11 @@ import re
import gdb
class CoordPrinter(object):
def __init__(self, title, val):
self.title = title
def __init__(self, val):
self.val = val
def to_string(self):
return self.title
return self.val
def display_hint(self):
return 'array'
@ -29,12 +28,11 @@ class CoordPrinter(object):
class ViewPrinter(object):
def __init__(self, title, val):
self.title = title
def __init__(self, val):
self.val = val
def to_string(self):
return self.title
return self.val
def display_hint(self):
return 'array'
@ -67,10 +65,10 @@ class ViewPrinter(object):
)
def build_cruft_dict():
pretty_printers_dict[re.compile('^cruft::point.*$') ] = lambda title, val: CoordPrinter(title, val)
pretty_printers_dict[re.compile('^cruft::vector.*$')] = lambda title, val: CoordPrinter(title, val)
pretty_printers_dict[re.compile('^cruft::extent.*$')] = lambda title, val: CoordPrinter(title, val)
pretty_printers_dict[re.compile('^cruft::colour.*$')] = lambda title, val: CoordPrinter(title, val)
pretty_printers_dict[re.compile('^cruft::point.*$') ] = lambda val: CoordPrinter(val)
pretty_printers_dict[re.compile('^cruft::vector.*$')] = lambda val: CoordPrinter(val)
pretty_printers_dict[re.compile('^cruft::extent.*$')] = lambda val: CoordPrinter(val)
pretty_printers_dict[re.compile('^cruft::colour.*$')] = lambda val: CoordPrinter(val)
pretty_printers_dict[re.compile('^cruft::view')] = lambda title, val: ViewPrinter(title, val)
@ -89,7 +87,7 @@ def lookup(val):
for function in pretty_printers_dict:
if function.search(typename):
return pretty_printers_dict[function](typename, val)
return pretty_printers_dict[function](val)
return None
@ -99,5 +97,4 @@ def register_cruft_printers():
pretty_printers_dict = {}
build_cruft_dict ()
build_cruft_dict()