gdb: make add_com_alias accept target as a cmd_list_element
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 27 May 2021 17:59:01 +0000 (13:59 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 27 May 2021 18:00:07 +0000 (14:00 -0400)
commit3947f654eabb1b6ccf8aad11ece46dc4b027f0f0
treece1f687f4929daf2ce5aa10741c244cb1ab6e7ab
parent7bd22f56a3cf47c6743f7f7989a6fa07f935d31b
gdb: make add_com_alias accept target as a cmd_list_element

The alias creation functions currently accept a name to specify the
target command.  They pass this to add_alias_cmd, which needs to lookup
the target command by name.

Given that:

 - We don't support creating an alias for a command before that command
   exists.
 - We always use add_info_alias just after creating that target command,
   and therefore have access to the target command's cmd_list_element.

... change add_com_alias to accept the target command as a
cmd_list_element (other functions are done in subsequent patches).  This
ensures we don't create the alias before the target command, because you
need to get the cmd_list_element from somewhere when you call the alias
creation function.  And it avoids an unecessary command lookup.  So it
seems better to me in every aspect.

gdb/ChangeLog:

* command.h (add_com_alias): Accept target as
cmd_list_element.  Update callers.

Change-Id: I24bed7da57221cc77606034de3023fedac015150
22 files changed:
gdb/ChangeLog
gdb/breakpoint.c
gdb/cli/cli-cmds.c
gdb/cli/cli-decode.c
gdb/command.h
gdb/compile/compile.c
gdb/gcore.c
gdb/guile/guile.c
gdb/infcmd.c
gdb/maint.c
gdb/objc-lang.c
gdb/printcmd.c
gdb/python/python.c
gdb/record.c
gdb/regcache.c
gdb/reverse.c
gdb/source.c
gdb/stack.c
gdb/symfile.c
gdb/thread.c
gdb/tracepoint.c
gdb/tui/tui-win.c
This page took 0.027097 seconds and 4 git commands to generate.