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