* [RFC] New option -nh: disable loading ~/.gdbinit
@ 2012-09-20 22:02 dje
2012-09-21 15:23 ` Joel Brobecker
2012-09-21 15:35 ` Jan Kratochvil
0 siblings, 2 replies; 5+ messages in thread
From: dje @ 2012-09-20 22:02 UTC (permalink / raw)
To: gdb-patches
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. */
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC] New option -nh: disable loading ~/.gdbinit
2012-09-20 22:02 [RFC] New option -nh: disable loading ~/.gdbinit dje
@ 2012-09-21 15:23 ` Joel Brobecker
2012-09-21 15:35 ` Jan Kratochvil
1 sibling, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2012-09-21 15:23 UTC (permalink / raw)
To: dje; +Cc: gdb-patches
> [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.
FWIW, the new feature seems OK.
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC] New option -nh: disable loading ~/.gdbinit
2012-09-20 22:02 [RFC] New option -nh: disable loading ~/.gdbinit dje
2012-09-21 15:23 ` Joel Brobecker
@ 2012-09-21 15:35 ` Jan Kratochvil
2012-09-21 16:23 ` Doug Evans
1 sibling, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2012-09-21 15:35 UTC (permalink / raw)
To: dje; +Cc: gdb-patches
On Fri, 21 Sep 2012 00:01:54 +0200, dje@google.com wrote:
> 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.
The current auto-load functionality:
(gdb) set auto-load
gdb-scripts local-gdbinit safe-path
libthread-db python-scripts scripts-directory
besides local-gdbinit would logically have also system-gdbinit and
home-gdbinit.
-nx would be then equivalent to all of:
-iex 'set auto-load system-gdbinit off'
-iex 'set auto-load home-gdbinit off'
-iex 'set auto-load local-gdbinit off'
-nh would be then equivalent to:
-iex 'set auto-load home-gdbinit off'
Wouldn't be the last option more clear than another magic option '-nh'?
The patch would be short, I could even post it but so far it was more just
some sort of a clean-up but if you even have a use for it.
Regards,
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC] New option -nh: disable loading ~/.gdbinit
2012-09-21 15:35 ` Jan Kratochvil
@ 2012-09-21 16:23 ` Doug Evans
2012-09-21 16:28 ` Jan Kratochvil
0 siblings, 1 reply; 5+ messages in thread
From: Doug Evans @ 2012-09-21 16:23 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
On Fri, Sep 21, 2012 at 8:35 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Fri, 21 Sep 2012 00:01:54 +0200, dje@google.com wrote:
>> 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.
>
> The current auto-load functionality:
> (gdb) set auto-load
> gdb-scripts local-gdbinit safe-path
> libthread-db python-scripts scripts-directory
>
> besides local-gdbinit would logically have also system-gdbinit and
> home-gdbinit.
>
> -nx would be then equivalent to all of:
> -iex 'set auto-load system-gdbinit off'
> -iex 'set auto-load home-gdbinit off'
> -iex 'set auto-load local-gdbinit off'
>
> -nh would be then equivalent to:
> -iex 'set auto-load home-gdbinit off'
>
> Wouldn't be the last option more clear than another magic option '-nh'?
magic? Say what?
> The patch would be short, I could even post it but so far it was more just
> some sort of a clean-up but if you even have a use for it.
In this case I like the short -nh.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC] New option -nh: disable loading ~/.gdbinit
2012-09-21 16:23 ` Doug Evans
@ 2012-09-21 16:28 ` Jan Kratochvil
0 siblings, 0 replies; 5+ messages in thread
From: Jan Kratochvil @ 2012-09-21 16:28 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
On Fri, 21 Sep 2012 18:23:01 +0200, Doug Evans wrote:
> On Fri, Sep 21, 2012 at 8:35 AM, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> > Wouldn't be the last option more clear than another magic option '-nh'?
>
> magic? Say what?
I find already unclear which auto-loaded files are / are not loaded by -nx.
It takes me always some time thinking about all the files which are / are not
loaded with -nx.
> > The patch would be short, I could even post it but so far it was more just
> > some sort of a clean-up but if you even have a use for it.
>
> In this case I like the short -nh.
OK.
Regards,
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-09-21 16:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-20 22:02 [RFC] New option -nh: disable loading ~/.gdbinit dje
2012-09-21 15:23 ` Joel Brobecker
2012-09-21 15:35 ` Jan Kratochvil
2012-09-21 16:23 ` Doug Evans
2012-09-21 16:28 ` Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox