From: Robert Lupton the Good <rhl@astro.princeton.edu>
To: gdb@sourceware.org
Subject: Problem redefining python pretty printers
Date: Sun, 22 May 2011 01:41:00 -0000 [thread overview]
Message-ID: <1AAE9F25-87D5-44F0-BCF8-B6C3A5D20203@astro.princeton.edu> (raw)
Using the 7.2.90.20110521-cvs (i.e. 7.3-branch) version, the docs say:
> Help on function register_pretty_printer in module gdb.printing:
>
> register_pretty_printer(obj, printer)
> Register pretty-printer PRINTER with OBJ.
>
> The printer is added to the front of the search list, thus one can override
> an existing printer if one needs to.
which makes sense if one's working on a new printer. Unfortunately:
> (gdb) python import sourcePrinter; sourcePrinter.register(); sourcePrinter.register()
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> File "/home/rhl/Bugs/gdb-pp/sourcePrinter.py", line 35, in register
> gdb.printing.register_pretty_printer(gdb, printer)
> File "/home/astro/hsc/products/Linux64/external/gdb/7.3-1/share/gdb/python/gdb/printing.py", line 131, in register_pretty_printer
> printer.name)
> RuntimeError: pretty-printer already registered: afw
> Error while executing Python code.
The routine register is:
> def register():
> printer = gdb.printing.RegexpCollectionPrettyPrinter("afw")
> gdb.printing.register_pretty_printer(gdb, printer)
Any advice on what I'm doing wrong? I suppose I could come up with a new name each time, but that seems a little clumsy.
R
next reply other threads:[~2011-05-22 1:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-22 1:41 Robert Lupton the Good [this message]
2011-05-23 15:06 ` Doug Evans
2011-05-23 15:24 ` Phil Muldoon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1AAE9F25-87D5-44F0-BCF8-B6C3A5D20203@astro.princeton.edu \
--to=rhl@astro.princeton.edu \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox