From: Doug Evans <dje@google.com>
To: Tom Tromey <tromey@redhat.com>, Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA, doc RFA] Don't install gdb.PYTHONDIR if -nx
Date: Tue, 30 Nov 2010 00:03:00 -0000 [thread overview]
Message-ID: <AANLkTimXeqzeVP-R0RZPehORxmdS3=_3vkfHh2A7AfP7@mail.gmail.com> (raw)
In-Reply-To: <m3sjyjstdg.fsf@fleche.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]
On Mon, Nov 29, 2010 at 1:38 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Doug" == Doug Evans <dje@google.com> writes:
>
> Doug> I don't entirely like the patch, it's extending -nx into
> Doug> new territory, e.g., -nx controlling whether certain commands
> Doug> are available or not. It shouldn't matter, from the user's
> Doug> perspective, whether the commands are implemented in python.
>
> I agree. In particular I think it is reasonable to want to use python
> commands from a batch script, but such a script is likely to use -nx.
>
> Doug> However, the only other alternative I can think of is to
> Doug> add a new option, and I'm guessing that's unacceptable.
>
> I think it would be fine to add one.
>
>
> Either way I think the documentation needs to be updated.
>
> Jan pointed out that this is PR 12227.
>
> Tom
>
I will check this in then, pending doc RFA.
2010-11-29 Doug Evans <dje@google.com>
PR python/12227
* main.c (captured_main): Recognize -np.
* top.c (inhibit_pythoninit): New global.
* top.h (inhibit_pythoninit): Declare.
* python/python.c (finish_python_initialization): Only initialize
gdb module if not -np.
doc/
* gdb.texinfo (Mode Options): Document -np.
testsuite/
* lib/gdb.exp: Add -np to INTERNAL_GDBFLAGS.
[-- Attachment #2: gdb-101129-pr-12227-1.patch.txt --]
[-- Type: text/plain, Size: 4350 bytes --]
2010-11-29 Doug Evans <dje@google.com>
PR python/12227
* main.c (captured_main): Recognize -np.
* top.c (inhibit_pythoninit): New global.
* top.h (inhibit_pythoninit): Declare.
* python/python.c (finish_python_initialization): Only initialize
gdb module if not -np.
doc/
* gdb.texinfo (Mode Options): Document -np.
testsuite/
* lib/gdb.exp: Add -np to INTERNAL_GDBFLAGS.
Index: main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.87
diff -u -p -r1.87 main.c
--- main.c 22 Sep 2010 19:59:15 -0000 1.87
+++ main.c 29 Nov 2010 23:49:58 -0000
@@ -396,6 +396,7 @@ captured_main (void *data)
{"silent", no_argument, &quiet, 1},
{"nx", no_argument, &inhibit_gdbinit, 1},
{"n", no_argument, &inhibit_gdbinit, 1},
+ {"np", no_argument, &inhibit_pythoninit, 1},
{"batch-silent", no_argument, 0, 'B'},
{"batch", no_argument, &batch_flag, 1},
{"epoch", no_argument, &epoch_interface, 1},
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.185
diff -u -p -r1.185 top.c
--- top.c 2 Nov 2010 16:48:41 -0000 1.185
+++ top.c 29 Nov 2010 23:49:58 -0000
@@ -88,6 +88,9 @@ char gdbinit[PATH_MAX + 1] = GDBINIT_FIL
int inhibit_gdbinit = 0;
+/* If nonzero, don't load any initial python scripts. */
+int inhibit_pythoninit = 0;
+
/* If nonzero, and GDB has been configured to be able to use windows,
attempt to open them upon startup. */
Index: top.h
===================================================================
RCS file: /cvs/src/src/gdb/top.h,v
retrieving revision 1.22
diff -u -p -r1.22 top.h
--- top.h 7 Apr 2010 16:54:39 -0000 1.22
+++ top.h 29 Nov 2010 23:49:58 -0000
@@ -30,6 +30,7 @@ extern int in_user_command;
extern int caution;
extern char gdb_dirbuf[1024];
extern int inhibit_gdbinit;
+extern int inhibit_pythoninit;
extern int epoch_interface;
extern char gdbinit[];
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.778
diff -u -p -r1.778 gdb.texinfo
--- doc/gdb.texinfo 29 Nov 2010 23:20:57 -0000 1.778
+++ doc/gdb.texinfo 29 Nov 2010 23:49:58 -0000
@@ -1025,6 +1025,14 @@ Do not execute commands found in any ini
options and arguments have been processed. @xref{Command Files,,Command
Files}.
+@item -np
+@cindex @code{--np}
+Do not initialize the @code{gdb} python module.
+Normally @value{GDBN}, as part of initialization, will initialize
+the @code{gdb} python module. @xref{Python API}.
+This interferes with, for example, running the GDB testsuite which
+wants to use its own copy.
+
@item -quiet
@itemx -silent
@itemx -q
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 23:49:58 -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 -np.
+ We don't want to pick up, for example, python-based commands from the
+ install directory when running the testsuite. */
+ if (! inhibit_pythoninit)
+ /* Install the default gdb.PYTHONDIR. */
+ PyRun_SimpleString ("GdbSetPythonDirectory (gdb.PYTHONDIR)");
+
do_cleanups (cleanup);
}
Index: testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.159
diff -u -p -r1.159 gdb.exp
--- testsuite/lib/gdb.exp 23 Nov 2010 22:25:37 -0000 1.159
+++ testsuite/lib/gdb.exp 29 Nov 2010 23:49:58 -0000
@@ -56,7 +56,7 @@ verbose "using GDBFLAGS = $GDBFLAGS" 2
# INTERNAL_GDBFLAGS contains flags that the testsuite requires.
global INTERNAL_GDBFLAGS
if ![info exists INTERNAL_GDBFLAGS] {
- set INTERNAL_GDBFLAGS "-nw -nx"
+ set INTERNAL_GDBFLAGS "-nw -nx -np"
}
# The variable gdb_prompt is a regexp which matches the gdb prompt.
next prev parent reply other threads:[~2010-11-30 0:03 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-29 0:40 [RFA] " Doug Evans
2010-11-29 21:38 ` Tom Tromey
2010-11-30 0:03 ` Doug Evans [this message]
2010-11-30 0:30 ` [RFA, doc RFA] " 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 ` 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-06 21:15 ` Doug Evans
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='AANLkTimXeqzeVP-R0RZPehORxmdS3=_3vkfHh2A7AfP7@mail.gmail.com' \
--to=dje@google.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.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