Re: [PATCHv3 2/3] gdb: process early initialization files and command line options

Eli Zaretskii via Gdb-patches
2021-02-18T17:46:48Z

> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Date: Thu, 18 Feb 2021 16:41:03 +0000
>
> gdb/ChangeLog:
>
> PR cli/25956
> * NEWS: Mention new early init files and command line options.
> * config.in: Regenerate.
> * configure: Regenerate.
> * configure.ac: Define GDBEARLYINIT.
> * main.c (get_earlyinit_files): New function.
> (enum cmdarg_kind): Add CMDARG_EARLYINIT_FILE and
> CMDARG_EARLYINIT_COMMAND.
> (captured_main_1): Add support for new command line flags, and for
> processing startup files.
> (print_gdb_help): Include startup files in the output.
> <
> gdb/doc/ChangeLog:
>
> PR cli/25956
> * gdb.texinfo (File Options): Mention new command line options.
> (Startup): Discuss when early init files are processed.
> (Initialization Files): Add description of early init files.
> (Output Styling): Update description of 'version' style.
> (gdb man): Mention early init files.
>
> gdb/testsuite/ChangeLog:
>
> PR cli/25956
> * gdb.base/early-init-file.c: New file.
> * gdb.base/early-init-file.exp: New file.
> * lib/gdb-utils.exp (style): Handle style 'none'.

Thanks.

> +* GDB will now load and process commands from ~/.config/gdb/gdbearlyinit
> + or ~/.gdbearlyinit if these files are present. These files are
> + processed earlier than any of the previous initialization files and
^^^^^^^^
"Previous" is confusing here, since they are actually processed
_after_ .gdbearlyinit. I suggest "any of the other initialization
files" instead.

> +@item -early-init-command @var{file}
> +@itemx -eix @var{file}
> +@cindex @code{--early-init-command}
> +@cindex @code{-eix}
> +Execute commands from file @var{file} very early in the initialization

It is generally better to say

Execute commands from @var{file}

thus avoiding identical words one after the other. When the name in
@var describes itself, there's no need to have the description as
separate text.

> +process, before any output is produced. @xref{Startup}.
> +
> +@item -early-init-eval-command @var{command}
> +@itemx -eiex @var{command}
> +@cindex @code{--early-init-eval-command}
> +@cindex @code{-eiex}
> +Execute a single @value{GDBN} command very early in the initialization
> +process, before any output is produced. @xref{Startup}.

You have here two identical cross-references with only a handful of
lines between them. I'd lose the second one, as it's redundant here.

> +@item
> +Performs minimal setup required to initialise basic internal state.
^^^^^^^^^^
"initialize", in US spelling, per our conventions.

> +@cindex early initialization file
> +Read commands from the early initialization file (if any) in your home
^^^^
"Reads", to be consistent with the other items in this list.

> +directory. Only a restricted set of commands can be placed into an
> +early initialization file, @pxref{Initialization Files} for details.

This usage of @pxref is problematic: @pxref generally produces a
period after the cross reference, and that looks as a mistake when the
sentence doesn't end there. So I suggest this instead:

early initialization file, see @ref{Initialization Files}, for details.

(Note the comma after the closing brace.)

> +Executes commands and command files specified by the @samp{-eiex} and
> +@samp{-eix} command line options in their specified order. Only a
> +restricted set of commands can be used with @samp{-eiex} and
> +@samp{eix}, @pxref{Initialization Files} for details.

Same here.

> +The @dfn{early initialization} file is loaded very early in
> +@value{GDBN}'s initialization process, before the interpreter

Whenever you introduce a term, which is indicated by the use of @dfn,
it is a good idea to have a @cindex entry for that term, so that
readers could easily find this basic description of the term.

> +In contrast, the @dfn{general initialization} files are processed
> +later, after @value{GDBN} has finished its own internal initialization

Same here.

> +Throughout the rest of this document the term @dfn{initialization
> +file} refers to one of the general initialization files, not the early

And here.