Python pretty-printer trouble

Michael Haupt
2013-04-22T12:49:28Z

Hello,

using gdb 7.5 on Mac OS X, I am registering a pretty-printer written in Python, which won't be triggered. The pretty-printer is supposed to take care of values of type <something>_array.

class MyPP:
def __init__(self, val):
self.val = val
def to_string(self):
return 'This is an array of sorts.'

pp = gdb.printing.RegexpCollectionPrettyPrinter('my_array_pp')
pp.add_printer('arrays', '^.*_array', MyPP)
gdb.printing.register_pretty_printer(None, pp)

The pretty-printer is registered correctly but will not be triggered when values of a type the name of which matches the pattern are to be printed. I've read my way through the available documentation at sourceware.org and still have no clue. By now, I'm sure I'm missing something obvious.

Any hints?

Regards,

Michael Haupt

--
Dr. Michael Haupt
Principal Member of Technical Staff
Phone: +49 331 200 7277, Fax: +49 331 200 7561
Oracle Labs
Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14, 14467 Potsdam, Germany