From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org
Subject: [RFA] Don't install gdb.PYTHONDIR if -nx
Date: Mon, 29 Nov 2010 00:40:00 -0000 [thread overview]
Message-ID: <20101129003949.502FC246199@ruffy.mtv.corp.google.com> (raw)
Hi.
I was testing a change to gdb/command/pretty_printers.py
and was tripping over the fact that gdb was picking up
the installed copies.
The testsuite loads the copies from the build dir, but
python keeps the one already installed during gdb startup.
This patch only installs gdb.PYTHONDIR (and only runs
gdb/__init__.py which installs the python-based gdb commands)
if not running with -nx.
I don't entirely like the patch, it's extending -nx into
new territory, e.g., -nx controlling whether certain commands
are available or not. It shouldn't matter, from the user's
perspective, whether the commands are implemented in python.
However, the only other alternative I can think of is to
add a new option, and I'm guessing that's unacceptable.
Ok to check in?
Or would a new option be preferable?
E.g., -np to disable loading of python code, or some such.
2010-11-28 Doug Evans <dje@google.com>
* python/python.c (finish_python_initialization): Don't install
gdb.PYTHONDIR (or run gdb/__init__.py) if running -nx.
Index: python/python.c
===================================================================
RCS file: /cvs/src/src/gdb/python/python.c,v
retrieving revision 1.53
diff -u -p -r1.53 python.c
--- python/python.c 12 Nov 2010 20:49:42 -0000 1.53
+++ python/python.c 29 Nov 2010 00:08:56 -0000
@@ -1080,11 +1080,15 @@ def GdbSetPythonDirectory (dir):\n\
ipy = gdb.PYTHONDIR + '/gdb/__init__.py'\n\
if os.path.exists (ipy):\n\
execfile (ipy)\n\
-\n\
-# Install the default gdb.PYTHONDIR.\n\
-GdbSetPythonDirectory (gdb.PYTHONDIR)\n\
");
+ /* Don't install the python directory if -nx.
+ We don't want to pick up, for example, python-based commands from the
+ install directory when running the testsuite. */
+ if (! inhibit_gdbinit)
+ /* Install the default gdb.PYTHONDIR. */
+ PyRun_SimpleString ("GdbSetPythonDirectory (gdb.PYTHONDIR)");
+
do_cleanups (cleanup);
}
next reply other threads:[~2010-11-29 0:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-29 0:40 Doug Evans [this message]
2010-11-29 21:38 ` Tom Tromey
2010-11-30 0:03 ` [RFA, doc RFA] " Doug Evans
2010-11-30 0:30 ` Jan Kratochvil
2010-11-30 3:54 ` Eli Zaretskii
2010-11-30 4:11 ` Doug Evans
2010-11-30 11:20 ` Eli Zaretskii
2010-11-30 15:29 ` Doug Evans
2010-11-30 18:59 ` Tom Tromey
2010-12-06 20:43 ` Doug Evans
2010-12-06 20:50 ` Eli Zaretskii
2010-12-06 20:58 ` Doug Evans
2010-12-06 21:15 ` Doug Evans
2010-12-06 21:15 ` Eli Zaretskii
2010-12-06 21:16 ` Doug Evans
2010-12-06 22:17 ` Doug Evans
2010-12-07 4:02 ` Eli Zaretskii
2010-12-07 1:38 ` Jan Kratochvil
2010-11-30 4:22 ` [RFA] " Daniel Jacobowitz
2010-11-30 5:16 ` Doug Evans
2010-11-30 18:19 ` Daniel Jacobowitz
2010-11-30 18:25 ` Doug Evans
2010-11-30 5:33 ` Jan Kratochvil
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=20101129003949.502FC246199@ruffy.mtv.corp.google.com \
--to=dje@google.com \
--cc=gdb-patches@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