[PATCH 0/8] Change alias creation functions to accept target as cmd_list_element

Simon Marchi simon.marchi@polymtl.ca
Tue May 18 20:23:25 GMT 2021


Following this patch:

    https://sourceware.org/pipermail/gdb-patches/2021-May/178881.html

I realized that we didn't support creating a command alias before the
command it aliases.  Although this doesn't happen normally, the fact
that alias creation functions accept the target command as a string (the
target command name) make it possible to happen.

I tried reversing the order of the calls of the initialize functions, to
see if there were any unintended dependencies between them.  For
example, a command created in a file and an alias for this command
created in another file.  This exposed one case where an alias is
created before a prefix of its target function, which made the alias
creation fail.

This fix this, this series changes all alias creation functions to take
the target command as a cmd_list_element.  This forces the target
command to be created before the alias.

Finally, it adds a runtime option (an environment variable) to reverse
the calls of the initialize functions, and a test is built using that.

Simon Marchi (8):
  gdb: make add_setshow commands return set_show_commands
  gdb: remove unnecessary lookup_cmd when deprecating commands
  gdb/python: use return values of add_setshow functions in
    add_setshow_generic
  gdb: make add_com_alias accept target as a cmd_list_element
  gdb: make add_info_alias accept target as a cmd_list_element
  gdb: remove add_alias_cmd overload that accepts a string
  gdb: add make-init-c script
  gdb: add option to reverse order of _initialize function calls

 gdb/Makefile.in                               |  51 ++--
 gdb/arch-utils.c                              |  16 +-
 gdb/bpf-tdep.c                                |   2 +-
 gdb/breakpoint.c                              |  78 +++---
 gdb/cli/cli-cmds.c                            |  67 ++---
 gdb/cli/cli-decode.c                          | 244 +++++++++---------
 gdb/command.h                                 | 229 ++++++----------
 gdb/compile/compile.c                         |   2 +-
 gdb/corefile.c                                |  14 +-
 gdb/cp-support.c                              |  12 +-
 gdb/disasm.c                                  |   9 +-
 gdb/gcore.c                                   |   5 +-
 gdb/gnu-nat.c                                 |  54 ++--
 gdb/guile/guile.c                             |  41 +--
 gdb/infcmd.c                                  |  60 +++--
 gdb/infrun.c                                  |   5 +-
 gdb/language.c                                |  24 +-
 gdb/macrocmd.c                                |  15 +-
 gdb/maint.c                                   |  19 +-
 gdb/make-init-c                               |  63 +++++
 gdb/mi/mi-main.c                              |  26 +-
 gdb/mips-tdep.c                               |  25 +-
 gdb/objc-lang.c                               |   7 +-
 gdb/printcmd.c                                |  16 +-
 gdb/python/py-auto-load.c                     |  29 +--
 gdb/python/py-param.c                         | 133 +++++-----
 gdb/python/python.c                           |   9 +-
 gdb/record-btrace.c                           |  30 ++-
 gdb/record-full.c                             |  69 ++---
 gdb/record.c                                  |  70 ++---
 gdb/regcache.c                                |   9 +-
 gdb/remote.c                                  |  37 ++-
 gdb/reverse.c                                 |  37 +--
 gdb/silent-rules.mk                           |   2 +-
 gdb/solib.c                                   |  22 +-
 gdb/source.c                                  |  21 +-
 gdb/sparc64-tdep.c                            |   7 +-
 gdb/stack.c                                   |  59 +++--
 gdb/symfile.c                                 |  11 +-
 gdb/symtab.c                                  |  11 +-
 .../gdb.base/reverse-init-functions.exp       |  29 +++
 gdb/thread.c                                  |   9 +-
 gdb/top.c                                     |   2 +-
 gdb/tracepoint.c                              |  12 +-
 gdb/tui/tui-win.c                             |  20 +-
 gdb/valprint.c                                |  24 +-
 gdb/value.c                                   |   5 +-
 gdb/windows-tdep.c                            |   9 +-
 48 files changed, 931 insertions(+), 819 deletions(-)
 create mode 100755 gdb/make-init-c
 create mode 100644 gdb/testsuite/gdb.base/reverse-init-functions.exp

-- 
2.31.1



More information about the Gdb-patches mailing list