Re: [review] Load system gdbinit files from a directory

Christian Biesinger via gdb-patches
2019-10-18T11:57:48Z

On Thu, Oct 17, 2019 at 8:00 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > Date: Wed, 16 Oct 2019 18:18:34 -0400
> > From: "Christian Biesinger (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
> > Cc: Tom de Vries <tdevries@suse.de>, Simon Marchi <simon.marchi@polymtl.ca>
> >
> > gdb/ChangeLog:
> >
> > 2019-08-20 Christian Biesinger <cbiesinger@google.com>
> >
> > * NEWS: Mention new --with-system-gdbinit-dir option.
> > * config.in: Regenerate.
> > * configure: Regenerate.
> > * configure.ac: Add new option --with-system-gdbinit-dir.
> > * extension.c (get_ext_lang_of_file): Return extension_language_gdb
> > for a ".gdb" suffix.
> > * main.c (get_init_files): Change system_gdbinit argument to
> > a vector and return the files in SYSTEM_GDBINIT_DIR in
> > addition to SYSTEM_GDBINIT.
> > (captured_main_1): Update.
> > (print_gdb_help): Update.
> > * top.c (print_gdb_configuration): Also print the value of
> > SYSTEM_GDBINIT_DIR.
> >
> > gdb/doc/ChangeLog:
> >
> > 2019-08-25 Christian Biesinger <cbiesinger@google.com>
> >
> > * Makefile.in: Also set SYSTEM_GDBINIT_DIR for the info manual
> > generation.
> > * gdb.texinfo (many sections): Document new --with-system-gdbinit-dir
> > option.
>
> I think I already approved the changes to the documentation, didn't I?

You did review them before
(https://sourceware.org/ml/gdb-patches/2019-08/msg00585.html) but I'm
not sure that it counted as an approval. In any case, thanks for
taking a look at the updated patch.

> > diff --git a/gdb/NEWS b/gdb/NEWS
> > index 25e67e4..7613598 100644
> > --- a/gdb/NEWS
> > +++ b/gdb/NEWS
> > @@ -46,6 +46,12 @@
> > The 'outer_function::' prefix is only needed if 'inner_function' is
> > not visible in the current scope.
> >
> > +* In addition to the system-wide gdbinit file, if configured with
> > + --with-system-gdbinit-dir, GDB will now also load files in that directory
> > + as system gdbinit files, unless the -nx or -n flag is provided. Files
> > + with extensions .gdb, .py and .scm are supported as long as GDB was
> > + compiled with support for that language.
>
> OK for this part.
>
> > +@item @file{system.gdbinit.d}
> > +This is the system-wide init directory.
> > +Its location is specified with the @code{--with-system-gdbinit-dir}
> > +configure option (@pxref{System-wide configuration}).
> > +Files in this directory are loaded in alphabetical order immediately after
> > +system.gdbinit (if enabled) when @value{GDBN} starts, before command line
> > +options have been processed. Files need to have a recognized scripting
> > +language extension (@code{.py}/@code{.scm}) or be named with a @code{.gdb}
>
> File-name extensions should have the @file markup.
>
> > @@ -1315,8 +1325,11 @@
> > @cindex init file
> > Reads the system-wide @dfn{init file} (if @option{--with-system-gdbinit} was
> > used when building @value{GDBN}; @pxref{System-wide configuration,
> > - ,System-wide configuration and settings}) and executes all the commands in
> > -that file.
> > + ,System-wide configuration and settings}) and the files in the system-wide
> > +gdbinit directory (if @option{--with-system-gdbinit-dir} was used) and executes
> > +all the commands in those files. The files need to be named with a @code{.gdb}
> > +extension to be interpreted as @value{GDBN} commands, or they can be written
> > +in a supported scripting language with an appropriate file extension.
>
> Likewise here, and elsewhere in the patch.

Thank you, updated all of those to @file. Will upload a new version to
gerrit momentarily.

Christian