From: Jean-Marc Saffroy <saffroy@gmail.com>
To: 🐝 <epilys@nessuent.xyz>
Cc: gdb@sourceware.org
Subject: Re: Reloading pretty-printers
Date: Mon, 20 May 2019 14:57:00 -0000 [thread overview]
Message-ID: <CAM5YWZfSQSVUR7JSPq=jfW5mXupVvn805jc7dNS7cJR4v4wt1Q@mail.gmail.com> (raw)
In-Reply-To: <rr5fv.n5kdjc343gd@nessuent.xyz>
Hi,
On Sun, May 19, 2019 at 3:00 PM 🐝 <epilys@nessuent.xyz> wrote:
> Hello,
>
> I'm writing some pretty-printers for a codebase, and when I modify the
> python files with gdb running, I can't seem to use the new version.
> giving `source $GDBINIT` or `source $PRETTYPRINTERDOTPY` gives
> `pretty-printer already registered`
>
> Is there a solution to this other than restarting gdb?
>
When I faced the same problem, I found it useful to simply generate a
random name when registering the pretty printer:
def _build_pretty_printer():
> # hack: random name allows reloading in the same gdb session!
> pp = gdb.printing.RegexpCollectionPrettyPrinter(
> "xxx.%d"%(random.randint(0, 1000000)))
> pp.add_printer('BIGNUM', '^bignum_st$', BNPrinter)
> return pp
>
> gdb.printing.register_pretty_printer(
> gdb.current_objfile(),
> _build_pretty_printer())
>
>
Cheers,
JM
--
Jean-Marc Saffroy - saffroy@gmail.com
prev parent reply other threads:[~2019-05-19 19:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-19 19:23 🐝
2019-05-20 14:57 ` Jean-Marc Saffroy [this message]
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='CAM5YWZfSQSVUR7JSPq=jfW5mXupVvn805jc7dNS7cJR4v4wt1Q@mail.gmail.com' \
--to=saffroy@gmail.com \
--cc=epilys@nessuent.xyz \
--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