[00/16] Bunch of commands related cleanups

Message ID 20210714045520.1623120-1-simon.marchi@polymtl.ca
Headers show
Series
  • Bunch of commands related cleanups
Related show

Message

Eli Zaretskii via Gdb-patches July 14, 2021, 4:55 a.m.
While making a patch for bug 28085 [1], I put my hands in the command
code, and noticed a lot of potential cleanups to make the code simpler
more robust.  My patch queue started to get a bit long, so here's a
mixed bag of patches that I think are improvements on their own right.

The last patch of the series is the biggest and most risky one, it makes
string settings use an std::string variable, instead of a `char *`.
It's quite a big change, but I think it makes things easier going
forward.

Other than that, there are some cleanups in tests, removal of unneeded
fields / declarations, adding of C++-y getters / setters, etc.

This was regtested on Ubuntu 20.04 with the unix and
native-extended-gdbserver boards.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=28085

Simon Marchi (16):
  gdb/testsuite: split gdb.python/py-parameter.exp in procs
  gdb.base/setshow.exp: use save_vars to save/restore gdb_prompt
  gdb.base/setshow.exp: split in procs
  gdb.base/setshow.exp: fix duplicate test name
  gdb: un-share set_inferior_cwd declaration
  gdb: remove inferior::{argc,argv}
  gdb: add setter/getter for inferior arguments
  gdb: add setter/getter for inferior cwd
  gdb: make inferior::m_args an std::string
  gdb: make inferior::m_cwd an std::string
  gdb: make inferior::m_terminal an std::string
  gdb: rename cfunc to simple_func
  gdb: remove cmd_list_element::function::sfunc
  gdb/testsuite: test get/set value of unregistered Guile parameter
  gdb: make cmd_list_element var an optional union
  gdb: make string-like set show commands use std::string variable

 gdb/auto-load.c                           |  48 +-
 gdb/breakpoint.c                          |  28 +-
 gdb/breakpoint.h                          |   2 +-
 gdb/build-id.c                            |   4 +-
 gdb/cli/cli-cmds.c                        |  59 +-
 gdb/cli/cli-decode.c                      | 223 ++++---
 gdb/cli/cli-decode.h                      |  57 +-
 gdb/cli/cli-dump.c                        |   2 +-
 gdb/cli/cli-logging.c                     |  23 +-
 gdb/cli/cli-option.c                      |   9 +-
 gdb/cli/cli-option.h                      |   4 +-
 gdb/cli/cli-setshow.c                     | 101 ++-
 gdb/command.h                             |  79 +--
 gdb/compile/compile.c                     |  46 +-
 gdb/corefile.c                            |  17 +-
 gdb/defs.h                                |   4 +-
 gdb/disasm.c                              |  11 +-
 gdb/disasm.h                              |   2 +-
 gdb/dwarf2/dwz.c                          |   2 +-
 gdb/dwarf2/index-cache.c                  |  10 +-
 gdb/dwarf2/read.c                         |  10 +-
 gdb/elf-none-tdep.c                       |   6 +-
 gdb/event-top.c                           |  12 +-
 gdb/fbsd-tdep.c                           |   6 +-
 gdb/fork-child.c                          |   7 +-
 gdb/guile/scm-cmd.c                       |   3 +-
 gdb/guile/scm-param.c                     | 168 ++++-
 gdb/infcmd.c                              | 103 +--
 gdb/inferior.c                            |  11 +-
 gdb/inferior.h                            |  78 ++-
 gdb/inflow.c                              |  46 +-
 gdb/linux-tdep.c                          |   7 +-
 gdb/linux-thread-db.c                     |  17 +-
 gdb/main.c                                |  17 +-
 gdb/maint-test-options.c                  |  11 +-
 gdb/maint-test-settings.c                 |   8 +-
 gdb/mi/mi-cmd-env.c                       |  27 +-
 gdb/nat/fork-inferior.c                   |  15 +-
 gdb/proc-api.c                            |   5 +-
 gdb/procfs.c                              |  10 +-
 gdb/python/py-cmd.c                       |   3 +-
 gdb/python/py-param.c                     |  48 +-
 gdb/python/python-internal.h              |   2 +-
 gdb/python/python.c                       |  32 +-
 gdb/remote-sim.c                          |   7 +-
 gdb/remote.c                              |  21 +-
 gdb/serial.c                              |   8 +-
 gdb/solib.c                               |  20 +-
 gdb/source.c                              |  66 +-
 gdb/source.h                              |   5 +-
 gdb/stack.c                               |  22 +-
 gdb/symfile.c                             |  49 +-
 gdb/symtab.c                              |  46 +-
 gdb/target-descriptions.c                 |   2 +-
 gdb/target.c                              |   4 +-
 gdb/terminal.h                            |   2 +-
 gdb/testsuite/gdb.base/setshow.exp        | 734 +++++++++++++---------
 gdb/testsuite/gdb.guile/scm-parameter.exp |   8 +
 gdb/testsuite/gdb.python/py-parameter.exp | 237 ++++---
 gdb/top.c                                 | 112 ++--
 gdb/top.h                                 |   2 +-
 gdb/tracepoint.c                          |  47 +-
 gdb/tracepoint.h                          |   2 +-
 gdb/tui/tui-layout.c                      |   3 +-
 gdb/windows-nat.c                         |   2 +-
 gdbserver/inferiors.cc                    |  18 +-
 gdbserver/inferiors.h                     |   4 +
 gdbserver/server.cc                       |   6 +-
 gdbsupport/common-inferior.h              |   9 +-
 69 files changed, 1559 insertions(+), 1260 deletions(-)

-- 
2.32.0