Re: [patch] New set auto-load-local-gdbinit + disable it by default

Doug Evans
2012-01-17T16:11:36Z

On Tue, Jan 17, 2012 at 1:55 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> Besides security problems the automatic execution is even inconvenient:
>        $ gdb testsuite/gdb.base/return
>        [...]
>        Setting up the environment for debugging gdb.
>        Function "internal_error" not defined.
>        Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
>        Function "info_command" not defined.
>        Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
>        .gdbinit:8: Error in sourced command file:
>        Argument required (one or more breakpoint numbers).
>         - What had happened?  Oh, I forgot -nx again!

This only affects gdb developers though.
Another way to go is to enhance gdb's .gdbinit to check for which
binary is being debugged and only do those things when it's gdb (and
if necessary enhance the scripting language to support such a check).
Seems generally useful, we should add support for it anyway.

One problem I have with -nx is that it also turns off system.gdbinit.
I've sometimes wanted to turn off everything but system.gdbinit,
without having to specify the path to system.gdbinit in -x.

> I do not see a precedent for executing anything from current directory by
> default.  . (current directory) is also not contained in $PATH at all.
> bash also does not execute .bashrc in any current directory.
> And "gdb -x ./.gdbinit" is a pretty simple way to do what one wants to do.

Well, there is make (and I'm sure others). E.g.,
echo "default:; @echo Gotcha." > GNUmakefile && make
:-)

> From what I know still there may be a resistance to this change, Eli please
> save your work with doc reviewing only after the change has been approved.
>
> Still at least the setting should go in and then one can then have
> "set auto-load-local-gdbinit off" at least in ~/.gdbinit.   Anyway I would
> file a FESCo (Fedora Engineering Steering Committee) ticket for such "off" in
> /etc/gdbinit at least in distro and IMHO it needs to get approved (but maybe
> not, it would be another fork from upstream).

I don't mind "set auto-load-local-gdbinit", though "set auto-load
local-gdbinit" feels better, I could do "show auto-load" and see all
the auto-load settings (assuming we migrate "auto-load-scripts" to
"auto-load scripts" - though I'm beginning to like plain "scripts" in
the name less ...).
If you want to default it to "off", I think I'd give several releases
warning notice,
e.g., at least a year, to give enough time to change our minds if the
user community really doesn't want it. :-)