[PATCH 0/7] Adding startup files to GDB

Andrew Burgess
2020-10-07T19:05:32Z

This series borrows heavily from some work that Tom submitted here:

https://sourceware.org/pipermail/gdb-patches/2020-June/169821.html

This work replaces patches 4 -> 7 of Tom's original series. Patches
1->3 of the original work are unrelated and are not impacted by this
series.

Looking at what I'm submitting here, my patches #1, #6 and #7 are
taken directly from Tom's original series with only very minor tweaks.

Patches #2, #3, #4, and #5 are significantly different than Tom's
original work though.

First, the motivation for this series - there are some parts of GDB
that can't currently be controlled with normal settings, as the point
at which the action is performed in GDB is earlier than the current
config files and command line options are processed.

This series introduces a new set of command line options and config
files that can be read very early during the startup process, these
files/command line flags can then be used to control the very early
actions that would otherwise not be user controllable.

Right now there are just two such settings added in this series, but
it is hoped that over time we might be able to add more.

Next I'll describe what the patches I wrote do, and the significant
differences to the series Tom put forward:

Patch #2 makes GDB look for .gdbinit in the standard config directory,
this makes this consistent between the standard init file and the new
startup file. This is new work in this series.

Patch #3 is just a small refactor in preparation for later patches.

Patch #4 adds the startup file support. Compared to Tom's original work:
(a) there's no auto saving of startup options,

(b) there's command line flag support for passing startup options
to GDB.

(c) there's support for a home directory and current working
directory startup file (only because this is basically free
given the restructuring of the code).

Patch #5 adds back the auto-save feature from Tom's series, however, I
have this off by default. I (personally) dislike the auto-save
feature, though I can see why some users might want it. I hope the
proposal I have here is might be a good middle ground.

There's some pretty extensive documentation changes in this series,
which I'm sure will need some serious polish before this is ready to
commit.

---

Andrew Burgess (4):
gdb: use get_standard_config_dir when looking for .gdbinit
gdb: new function to wrap up executing command line scripts/commands
gdb: process startup files and startup command line options
gdb: add mechanism to auto-save startup options

Tom Tromey (3):
Add get_standard_config_dir function
Let the user control the startup style
Add "set startup-quietly"

gdb/ChangeLog | 72 ++++++
gdb/NEWS | 31 +++
gdb/auto-load.c | 27 ++-
gdb/cli/cli-setshow.c | 122 +++++++++-
gdb/cli/cli-setshow.h | 23 ++
gdb/cli/cli-style.c | 36 ++-
gdb/cli/cli-style.h | 9 +-
gdb/config.in | 3 +
gdb/configure | 6 +
gdb/configure.ac | 3 +
gdb/doc/ChangeLog | 31 +++
gdb/doc/gdb.texinfo | 364 +++++++++++++++++++++-------
gdb/main.c | 370 ++++++++++++++++++++---------
gdb/main.h | 5 +
gdb/testsuite/ChangeLog | 8 +
gdb/testsuite/gdb.base/persist.exp | 68 ++++++
gdb/top.c | 45 +++-
gdb/top.h | 5 +
gdbsupport/ChangeLog | 5 +
gdbsupport/pathstuff.cc | 81 +++++++
gdbsupport/pathstuff.h | 37 +++
21 files changed, 1148 insertions(+), 203 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/persist.exp

--
2.25.4