This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] New option -nh: disable loading ~/.gdbinit


Hi.
When running tests (not necessarily tests in gdb/testsuite!) with a
gdb with a non-trivial system.gdbinit,
it is useful to be able disable loading ~/.gdbinit.
system.gdbinit is still necessary, it provides necessary functionality.

One *could* run the tests with -nx -x /path/to/system.gdbinit,
but the path to system.gdbinit is not necessarily easy to obtain.

Instead, I'd like to add this option: -nh.

Sound ok?

[I'll submit a full patch with docs if approved.]

2012-09-20  Doug Evans  <dje@google.com>

	New option -nh: inhibit loading of ~/.gdbinit.
	* main.c (captured_main): Recognize and process -nh.

Index: main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.113
diff -u -p -r1.113 main.c
--- main.c	29 Aug 2012 19:17:16 -0000	1.113
+++ main.c	20 Sep 2012 21:51:20 -0000
@@ -273,6 +273,7 @@ captured_main (void *data)
   char **argv = context->argv;
   static int quiet = 0;
   static int set_args = 0;
+  static int inhibit_home_gdbinit = 0;
 
   /* Pointers to various arguments from command line.  */
   char *symarg = NULL;
@@ -415,6 +416,7 @@ captured_main (void *data)
       {"quiet", no_argument, &quiet, 1},
       {"q", no_argument, &quiet, 1},
       {"silent", no_argument, &quiet, 1},
+      {"nh", no_argument, &inhibit_home_gdbinit, 1},
       {"nx", no_argument, &inhibit_gdbinit, 1},
       {"n", no_argument, &inhibit_gdbinit, 1},
       {"batch-silent", no_argument, 0, 'B'},
@@ -845,7 +847,7 @@ captured_main (void *data)
      global parameters, which are independent of what file you are
      debugging or what directory you are in.  */
 
-  if (home_gdbinit && !inhibit_gdbinit)
+  if (home_gdbinit && !inhibit_gdbinit && !inhibit_home_gdbinit)
     catch_command_errors (source_script, home_gdbinit, 0, RETURN_MASK_ALL);
 
   /* Process '-ix' and '-iex' options early.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]