lsst.ip.diffim ga1d1d01525+4193888634
Loading...
Searching...
No Matches
printers.py
Go to the documentation of this file.
2import gdb
3import sys
4
5try:
6 import gdb.printing
7
8 # example from meas_alg
9 class CRPixelPrinter(object):
10 "Print a CRPixel"
11
12 def __init__(self, val):
13 self.val = val
14
15 def to_string(self):
16 return "{id=%d (%d, %d)}" % (self.val["id"], self.val["col"], self.val["row"])
17
18 printers = []
19
20 def register(obj):
21 "Register my pretty-printers with objfile Obj."
22
23 if obj is None:
24 obj = gdb
25
26 for p in printers:
27 gdb.printing.register_pretty_printer(obj, p)
28
30 printer = gdb.printing.RegexpCollectionPrettyPrinter("ip_diffim")
31
32 # example from meas_alg
33 # printer.add_printer('lsst::meas::algorithms::CRPixel',
34 # '^lsst::meas::algorithms::CRPixel', CRPixelPrinter)
35
36 return printer
37
38 printers.append(build_ip_diffim_dictionary())
39
40except ImportError:
41 def register(*args, **kwargs):
42 print("Your version of gdb is too old to load the ip.diffim python pretty printers", file=sys.stderr)
43 pass
44
45 pass