def __call__ (self, val): tp = val.type try: switch(tp.code) except (case(gdb.TYPE_CODE_VOID)): return None except (case(gdb.TYPE_CODE_REF), case(gdb.TYPE_CODE_PTR)): tp = tp.target() except (case(gdb.TYPE_CODE_TYPEDEF)): tp = tp.unqualified().strip_typedefs() except: pass if (tp.code == gdb.TYPE_CODE_VOID): return None tp = tp.unqualified().strip_typedefs() self.typename = tp.tag if self.typename is not None: if self.printers.has_key(self.typename): return self.printers[self.typename](val) else: for f in self.regexPrinters: if f.search(self.typename): return self.regexPrinters[f](val) return None
def to_string(self): if self.kwargs is None: return self.to_string_short() if self.kwargs.has_key('print-control-parameter'): pcp = self.kwargs['print-control-parameter'] try: verbose = gdb.parameter(pcp) except error: verbose = 'short' else: verbose = 'short' try: switch(pcp) except ( case('long') ): return self.to_string_long() except ( case('detailed') ): return self.to_string_detailed() except: return self.to_string_short()