From: meator via Gdb <gdb@sourceware.org>
To: gdb@sourceware.org
Subject: How can I reload a pretty printer?
Date: Tue, 25 Jul 2023 18:13:55 +0200 [thread overview]
Message-ID: <9fc91cc3-adbe-d2f8-8b27-4245071d6c72@gmail.com> (raw)
Hi. When writing a pretty printer, I want to repeatedly test it. This is
pretty complicated because GDB has no builtin mechanisms to do such
thing (that I know of) and breakpoint() pretty much can not be used
because GDB's Python doesn't have access to the capable pty so
interactive use of PDB is impossible. Even the classic "printf style"
debugging doesn't work because Python's print() doesn't work
(gdb.write() has to be used instead).
I need to test the pretty printer often because the official Python
interface documentation is quite lacking and the interface itself is
imperfect^1. Accessing the docstrings of the Python interface is
difficult because the gdb module nor other modules can be imported in
standalone Python (I've tried to add it to $PYTHONPATH but with no
success; How are you supposed to access the docstrings?).
Therefore my last solution is to load the pretty printer, try it in gdb,
modify the pretty printer and repeat. But a pretty printer can be
sourced only once because the second source call will fail due to the
fact that the pretty printer is already registered. I have to restart
GDB every time I modify the pretty printer which is extremely
impractical. Is there a way to live reload the pretty printer?
1: There is no sane way to call member functions through gdb.Value which
is kind of important in C++: https://stackoverflow.com/q/22774067/13840624
next reply other threads:[~2023-07-25 16:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 16:13 meator via Gdb [this message]
2023-07-25 16:32 ` Jan Vrany via Gdb
2023-07-25 16:37 meator via Gdb
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=9fc91cc3-adbe-d2f8-8b27-4245071d6c72@gmail.com \
--to=gdb@sourceware.org \
--cc=meator.dev@gmail.com \
/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