Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: tromey@redhat.com, gdb-patches@sourceware.org
Subject: Re: [RFA, doc RFA] Don't install gdb.PYTHONDIR if -nx
Date: Tue, 30 Nov 2010 04:11:00 -0000	[thread overview]
Message-ID: <AANLkTinUAteSaa2fRXoy5Ocjr51Mr8nLCWLQH-CSssDC@mail.gmail.com> (raw)
In-Reply-To: <83tyiz8o0h.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 821 bytes --]

On Mon, Nov 29, 2010 at 7:54 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Mon, 29 Nov 2010 16:03:02 -0800
>> From: Doug Evans <dje@google.com>
>> Cc: gdb-patches@sourceware.org
>>
>> I will check this in then, pending doc RFA.
>
> OK.  Do we want this to be mentioned in NEWS?
>
> Thanks.

Probably. :-)

2010-11-29  Doug Evans  <dje@google.com>

        PR python/12227
        * NEWS: Mention -np
        * 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-2.patch.txt --]
[-- Type: text/plain, Size: 4889 bytes --]

2010-11-29  Doug Evans  <dje@google.com>

	PR python/12227
	* NEWS: Mention -np
	* 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: NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.411
diff -u -p -r1.411 NEWS
--- NEWS	5 Nov 2010 16:55:37 -0000	1.411
+++ NEWS	30 Nov 2010 04:09:31 -0000
@@ -3,6 +3,10 @@
 
 *** Changes since GDB 7.2
 
+* New command line options
+
+-np	Do not initialize the gdb python module.
+
 * GDB has a new command: "set directories".
   It is like the "dir" command except that it replaces the
   source path list instead of augmenting it.
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.

  reply	other threads:[~2010-11-30  4:11 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   ` [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 [this message]
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=AANLkTinUAteSaa2fRXoy5Ocjr51Mr8nLCWLQH-CSssDC@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