gdb: remove add_alias_cmd overload that accepts a string
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:08 +0000 (14:00 -0400)
Same idea as previous patch, but for add_alias_cmd.  Remove the overload
that accepts the target command as a string (the target command name),
leaving only the one that takes the cmd_list_element.

gdb/ChangeLog:

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

Change-Id: I546311f411e9e7da9302322d6ffad4e6c56df266

26 files changed:
gdb/ChangeLog
gdb/arch-utils.c
gdb/breakpoint.c
gdb/cli/cli-cmds.c
gdb/cli/cli-decode.c
gdb/command.h
gdb/corefile.c
gdb/cp-support.c
gdb/gnu-nat.c
gdb/guile/guile.c
gdb/language.c
gdb/macrocmd.c
gdb/maint.c
gdb/mips-tdep.c
gdb/printcmd.c
gdb/record-btrace.c
gdb/record-full.c
gdb/record.c
gdb/remote.c
gdb/solib.c
gdb/sparc64-tdep.c
gdb/symtab.c
gdb/tracepoint.c
gdb/valprint.c
gdb/value.c
gdb/windows-tdep.c

index 4279359ba33d8c0aa5193afa1b96122bd782ea68..b52d06012f2c31271c11ccd4c5552880d269cbff 100644 (file)
@@ -1,3 +1,8 @@
+2021-05-27  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * command.h (add_alias_cmd): Accept target as
+       cmd_list_element.  Update callers.
+
 2021-05-27  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * command.h (add_info_alias): Accept target as
index 5bb9c75844935c605c65eccc465d269ad46a6ff9..c75a79757ea24ff852231c3d381ebae39766e83d 100644 (file)
@@ -757,13 +757,15 @@ initialize_current_architecture (void)
     arches = XRESIZEVEC (const char *, arches, nr + 2);
     arches[nr + 0] = "auto";
     arches[nr + 1] = NULL;
-    add_setshow_enum_cmd ("architecture", class_support,
-                         arches, &set_architecture_string, 
-                         _("Set architecture of target."),
-                         _("Show architecture of target."), NULL,
-                         set_architecture, show_architecture,
-                         &setlist, &showlist);
-    add_alias_cmd ("processor", "architecture", class_support, 1, &setlist);
+    set_show_commands architecture_cmds
+      = add_setshow_enum_cmd ("architecture", class_support,
+                             arches, &set_architecture_string,
+                             _("Set architecture of target."),
+                             _("Show architecture of target."), NULL,
+                             set_architecture, show_architecture,
+                             &setlist, &showlist);
+    add_alias_cmd ("processor", architecture_cmds.set, class_support, 1,
+                  &setlist);
   }
 }
 
index ae05d1802a8c5317fa42fde51f23825b61073e78..dc00b4c735924920b07d436316cb6db56fd0613d 100644 (file)
@@ -16062,12 +16062,13 @@ last tracepoint set."));
 
   add_info_alias ("tp", info_tracepoints_cmd, 1);
 
-  add_cmd ("tracepoints", class_trace, delete_trace_command, _("\
+  cmd_list_element *delete_tracepoints_cmd
+    = add_cmd ("tracepoints", class_trace, delete_trace_command, _("\
 Delete specified tracepoints.\n\
 Arguments are tracepoint numbers, separated by spaces.\n\
 No argument means delete all tracepoints."),
           &deletelist);
-  add_alias_cmd ("tr", "tracepoints", class_trace, 1, &deletelist);
+  add_alias_cmd ("tr", delete_tracepoints_cmd, class_trace, 1, &deletelist);
 
   c = add_cmd ("tracepoints", class_trace, disable_trace_command, _("\
 Disable specified tracepoints.\n\
index 8b2aa5aad5a9f0edd855d22bc0009362a8c0b1e6..56ae12a0c19d6c75a40b605de92380c933035908 100644 (file)
@@ -1908,8 +1908,7 @@ alias_command (const char *args, int from_tty)
 
       /* add_cmd requires *we* allocate space for name, hence the xstrdup.  */
       alias_cmd = add_alias_cmd (xstrdup (alias_argv[alias_argc - 1]),
-                                command_argv[command_argc - 1],
-                                class_alias, a_opts.abbrev_flag,
+                                target_cmd, class_alias, a_opts.abbrev_flag,
                                 c_command->subcommands);
     }
 
index 2c2d72e20906f506e2f37d58f00bf403a32b87a0..009986c9cb1056287177a4c225213fcadb6748ac 100644 (file)
@@ -333,18 +333,6 @@ add_alias_cmd (const char *name, cmd_list_element *target,
   return c;
 }
 
-struct cmd_list_element *
-add_alias_cmd (const char *name, const char *target_name,
-              enum command_class theclass, int abbrev_flag,
-              struct cmd_list_element **list)
-{
-  const char *tmp = target_name;
-  cmd_list_element *target = lookup_cmd (&tmp, *list, "", NULL, 1, 1);
-
-  return add_alias_cmd (name, target, theclass, abbrev_flag, list);
-}
-
-
 /* Update the prefix field of all sub-commands of the prefix command C.
    We must do this when a prefix command is defined as the GDB init sequence
    does not guarantee that a prefix command is created before its sub-commands.
index e14f27b5f9a77e07417c48ca9954bb3abfa1f37e..f8988e4149438486df70763d47b6e3faba58f348 100644 (file)
@@ -174,10 +174,6 @@ extern struct cmd_list_element *add_cmd_suppress_notification
                         struct cmd_list_element **list,
                         int *suppress_notification);
 
-extern struct cmd_list_element *add_alias_cmd (const char *, const char *,
-                                              enum command_class, int,
-                                              struct cmd_list_element **);
-
 extern struct cmd_list_element *add_alias_cmd (const char *,
                                               cmd_list_element *,
                                               enum command_class, int,
index ddaa77272a93c935a164696ff6e2169e579599f6..ff2494738b0d29713a78eebb933ff437ff59e4df 100644 (file)
@@ -478,7 +478,7 @@ Use `set gnutarget auto' to specify automatic detection."),
                                       &setlist, &showlist);
   set_cmd_completer (set_show_gnutarget.set, complete_set_gnutarget);
 
-  add_alias_cmd ("g", "gnutarget", class_files, 1, &setlist);
+  add_alias_cmd ("g", set_show_gnutarget.set, class_files, 1, &setlist);
 
   if (getenv ("GNUTARGET"))
     set_gnutarget (getenv ("GNUTARGET"));
index e87c9d420e40dfd627931ab28fbcb07c544f9a23..5bd8fd4e9408afe7c6c6c0d47b1c5d865cbec3d7 100644 (file)
@@ -2209,12 +2209,12 @@ void _initialize_cp_support ();
 void
 _initialize_cp_support ()
 {
-  add_basic_prefix_cmd ("cplus", class_maintenance,
-                       _("C++ maintenance commands."),
-                       &maint_cplus_cmd_list,
-                       0, &maintenancelist);
-  add_alias_cmd ("cp", "cplus",
-                class_maintenance, 1,
+  cmd_list_element *maintenance_cplus
+    = add_basic_prefix_cmd ("cplus", class_maintenance,
+                           _("C++ maintenance commands."),
+                           &maint_cplus_cmd_list,
+                           0, &maintenancelist);
+  add_alias_cmd ("cp", maintenance_cplus, class_maintenance, 1,
                 &maintenancelist);
 
   add_cmd ("first_component",
index aadd3e894ce1244e379ad57808cda45c9e0e8d99..67ce00e9c302e9b9ee6017315f6ce9dfdfdf4eb6 100644 (file)
@@ -3197,25 +3197,31 @@ Show whether new threads are allowed to run (once gdb has noticed them)."),
           _("Show the default detach-suspend-count value for new threads."),
           &show_thread_default_cmd_list);
 
-  add_cmd ("signals", class_run, set_signals_cmd, _("\
+  cmd_list_element *set_signals_cmd
+    = add_cmd ("signals", class_run, set_signals_cmd, _("\
 Set whether the inferior process's signals will be intercepted.\n\
 Mach exceptions (such as breakpoint traps) are not affected."),
-          &setlist);
-  add_alias_cmd ("sigs", "signals", class_run, 1, &setlist);
-  add_cmd ("signals", no_class, show_signals_cmd, _("\
+              &setlist);
+  add_alias_cmd ("sigs", set_signals_cmd, class_run, 1, &setlist);
+
+  cmd_list_element *show_signals_cmd
+    = add_cmd ("signals", no_class, show_signals_cmd, _("\
 Show whether the inferior process's signals will be intercepted."),
-          &showlist);
-  add_alias_cmd ("sigs", "signals", no_class, 1, &showlist);
+              &showlist);
+  add_alias_cmd ("sigs", show_signals_cmd, no_class, 1, &showlist);
 
-  add_cmd ("signal-thread", class_run, set_sig_thread_cmd, _("\
+  cmd_list_element *set_signal_thread_cmd
+    = add_cmd ("signal-thread", class_run, set_sig_thread_cmd, _("\
 Set the thread that gdb thinks is the libc signal thread.\n\
 This thread is run when delivering a signal to a non-stopped process."),
-          &setlist);
-  add_alias_cmd ("sigthread", "signal-thread", class_run, 1, &setlist);
-  add_cmd ("signal-thread", no_class, show_sig_thread_cmd, _("\
+              &setlist);
+  add_alias_cmd ("sigthread", set_signal_thread_cmd, class_run, 1, &setlist);
+
+  cmd_list_element *show_signal_thread_cmd
+    = add_cmd ("signal-thread", no_class, show_sig_thread_cmd, _("\
 Set the thread that gdb thinks is the libc signal thread."),
-          &showlist);
-  add_alias_cmd ("sigthread", "signal-thread", no_class, 1, &showlist);
+              &showlist);
+  add_alias_cmd ("sigthread", show_signal_thread_cmd, no_class, 1, &showlist);
 
   add_cmd ("stopped", class_run, set_stopped_cmd, _("\
 Set whether gdb thinks the inferior process is stopped as with SIGSTOP.\n\
@@ -3225,13 +3231,14 @@ Stopped process will be continued by sending them a signal."),
 Show whether gdb thinks the inferior process is stopped as with SIGSTOP."),
           &showlist);
 
-  add_cmd ("exceptions", class_run, set_exceptions_cmd, _("\
+  cmd_list_element *set_exceptions_cmd
+    = add_cmd ("exceptions", class_run, set_exceptions_cmd, _("\
 Set whether exceptions in the inferior process will be trapped.\n\
 When exceptions are turned off, neither breakpoints nor single-stepping\n\
-will work."),
-          &setlist);
+will work."), &setlist);
   /* Allow `set exc' despite conflict with `set exception-port'.  */
-  add_alias_cmd ("exc", "exceptions", class_run, 1, &setlist);
+  add_alias_cmd ("exc", set_exceptions_cmd, class_run, 1, &setlist);
+
   add_cmd ("exceptions", no_class, show_exceptions_cmd, _("\
 Show whether exceptions in the inferior process will be trapped."),
           &showlist);
@@ -3262,12 +3269,14 @@ used to pause individual threads by default instead."),
             "on the thread when detaching."),
           &show_task_cmd_list);
 
-  add_cmd ("exception-port", no_class, set_task_exc_port_cmd, _("\
+  cmd_list_element *set_task_exception_port_cmd
+    = add_cmd ("exception-port", no_class, set_task_exc_port_cmd, _("\
 Set the task exception port to which we forward exceptions.\n\
 The argument should be the value of the send right in the task."),
-          &set_task_cmd_list);
-  add_alias_cmd ("excp", "exception-port", no_class, 1, &set_task_cmd_list);
-  add_alias_cmd ("exc-port", "exception-port", no_class, 1,
+              &set_task_cmd_list);
+  add_alias_cmd ("excp", set_task_exception_port_cmd, no_class, 1,
+                &set_task_cmd_list);
+  add_alias_cmd ("exc-port", set_task_exception_port_cmd, no_class, 1,
                 &set_task_cmd_list);
 
   /* A convenient way of turning on all options require to noninvasively
@@ -3458,8 +3467,9 @@ Set the thread exception port to which we forward exceptions.\n\
 This overrides the task exception port.\n\
 The argument should be the value of the send right in the task."),
           &set_thread_cmd_list);
-  add_alias_cmd ("excp", "exception-port", no_class, 1, &set_thread_cmd_list);
-  add_alias_cmd ("exc-port", "exception-port", no_class, 1,
+  add_alias_cmd ("excp", set_thread_exception_port_cmd, no_class, 1,
+                &set_thread_cmd_list);
+  add_alias_cmd ("exc-port", set_thread_exception_port_cmd, no_class, 1,
                 &set_thread_cmd_list);
 
   add_cmd ("takeover-suspend-count", no_class, thread_takeover_sc_cmd, _("\
index 3b1fca3d20cc34201dae095ac30806d9d2a2c5a7..a28dee37ed875cb9ad839094a22e6dede42b5b88 100644 (file)
@@ -780,15 +780,17 @@ This command is only a placeholder.")
           );
   add_com_alias ("gu", guile_cmd_element, class_obscure, 1);
 
-  add_basic_prefix_cmd ("guile", class_obscure,
-                       _("Prefix command for Guile preference settings."),
-                       &set_guile_list, 0, &setlist);
-  add_alias_cmd ("gu", "guile", class_obscure, 1, &setlist);
-
-  add_show_prefix_cmd ("guile", class_obscure,
-                      _("Prefix command for Guile preference settings."),
-                      &show_guile_list, 0, &showlist);
-  add_alias_cmd ("gu", "guile", class_obscure, 1, &showlist);
+  cmd_list_element *set_guile_cmd
+    = add_basic_prefix_cmd ("guile", class_obscure,
+                           _("Prefix command for Guile preference settings."),
+                           &set_guile_list, 0, &setlist);
+  add_alias_cmd ("gu", set_guile_cmd, class_obscure, 1, &setlist);
+
+  cmd_list_element *show_guile_cmd
+    = add_show_prefix_cmd ("guile", class_obscure,
+                          _("Prefix command for Guile preference settings."),
+                          &show_guile_list, 0, &showlist);
+  add_alias_cmd ("gu", show_guile_cmd, class_obscure, 1, &showlist);
 
   cmd_list_element *info_guile_cmd
     = add_basic_prefix_cmd ("guile", class_obscure,
index a3f96ecd6ff77bf607106775766ce2e229a14c72..0d1e3848de858c0113e8f608768155a86f602fd4 100644 (file)
@@ -1164,17 +1164,19 @@ _initialize_language ()
 
   /* GDB commands for language specific stuff.  */
 
-  add_basic_prefix_cmd ("check", no_class,
-                       _("Set the status of the type/range checker."),
-                       &setchecklist, 0, &setlist);
-  add_alias_cmd ("c", "check", no_class, 1, &setlist);
-  add_alias_cmd ("ch", "check", no_class, 1, &setlist);
-
-  add_show_prefix_cmd ("check", no_class,
-                      _("Show the status of the type/range checker."),
-                      &showchecklist, 0, &showlist);
-  add_alias_cmd ("c", "check", no_class, 1, &showlist);
-  add_alias_cmd ("ch", "check", no_class, 1, &showlist);
+  cmd_list_element *set_check_cmd
+    = add_basic_prefix_cmd ("check", no_class,
+                           _("Set the status of the type/range checker."),
+                           &setchecklist, 0, &setlist);
+  add_alias_cmd ("c", set_check_cmd, no_class, 1, &setlist);
+  add_alias_cmd ("ch", set_check_cmd, no_class, 1, &setlist);
+
+  cmd_list_element *show_check_cmd
+    = add_show_prefix_cmd ("check", no_class,
+                        _("Show the status of the type/range checker."),
+                        &showchecklist, 0, &showlist);
+  add_alias_cmd ("c", show_check_cmd, no_class, 1, &showlist);
+  add_alias_cmd ("ch", show_check_cmd, no_class, 1, &showlist);
 
   add_setshow_enum_cmd ("range", class_support, type_or_range_names,
                        &range,
index 4e4a68d5c1d55d8b6062a0430871847a1b907613..28a57f7bac95ed5f9e9cf85199130d123f10902a 100644 (file)
@@ -457,12 +457,15 @@ _initialize_macrocmd ()
                        _("Prefix for commands dealing with C preprocessor macros."),
                        &macrolist, 0, &cmdlist);
 
-  add_cmd ("expand", no_class, macro_expand_command, _("\
+  cmd_list_element *macro_expand_cmd
+    = add_cmd ("expand", no_class, macro_expand_command, _("\
 Fully expand any C/C++ preprocessor macro invocations in EXPRESSION.\n\
 Show the expanded expression."),
-          &macrolist);
-  add_alias_cmd ("exp", "expand", no_class, 1, &macrolist);
-  add_cmd ("expand-once", no_class, macro_expand_once_command, _("\
+              &macrolist);
+  add_alias_cmd ("exp", macro_expand_cmd, no_class, 1, &macrolist);
+
+  cmd_list_element *macro_expand_once_cmd
+    = add_cmd ("expand-once", no_class, macro_expand_once_command, _("\
 Expand C/C++ preprocessor macro invocations appearing directly in EXPRESSION.\n\
 Show the expanded expression.\n\
 \n\
@@ -473,8 +476,8 @@ introduces further macro invocations, those are left unexpanded.\n\
 `macro expand-once' helps you see how a particular macro expands,\n\
 whereas `macro expand' shows you how all the macros involved in an\n\
 expression work together to yield a pre-processed expression."),
-          &macrolist);
-  add_alias_cmd ("exp1", "expand-once", no_class, 1, &macrolist);
+              &macrolist);
+  add_alias_cmd ("exp1", macro_expand_once_cmd, no_class, 1, &macrolist);
 
   add_info ("macro", info_macro_command,
            _("Show the definition of MACRO, and it's source location.\n\
index 91a7f77d0eb0dae44911d53b42fcccb2eb7cf143..26bacbfeb76897f682d18dedb8f3a6e37c4514b4 100644 (file)
@@ -1143,11 +1143,13 @@ a human readable form, to cause GDB to deliberately dump core, etc."),
 
   add_com_alias ("mt", maintenance_cmd, class_maintenance, 1);
 
-  add_basic_prefix_cmd ("info", class_maintenance, _("\
+  cmd_list_element *maintenance_info_cmd
+    = add_basic_prefix_cmd ("info", class_maintenance, _("\
 Commands for showing internal info about the program being debugged."),
-                       &maintenanceinfolist, 0,
-                       &maintenancelist);
-  add_alias_cmd ("i", "info", class_maintenance, 1, &maintenancelist);
+                           &maintenanceinfolist, 0,
+                           &maintenancelist);
+  add_alias_cmd ("i", maintenance_info_cmd, class_maintenance, 1,
+                &maintenancelist);
 
   const auto opts = make_maint_info_sections_options_def_group (nullptr);
   static std::string maint_info_sections_command_help
index 2fe83324738f98c200d878471a309edaf0b543cf..31cac9384e9ee4121aad3d03438717fa20ea9d58 100644 (file)
@@ -8994,17 +8994,20 @@ and is updated automatically from ELF file flags if available."),
   add_cmd ("single", class_support, set_mipsfpu_single_command,
           _("Select single-precision MIPS floating-point coprocessor."),
           &mipsfpulist);
-  add_cmd ("double", class_support, set_mipsfpu_double_command,
-          _("Select double-precision MIPS floating-point coprocessor."),
-          &mipsfpulist);
-  add_alias_cmd ("on", "double", class_support, 1, &mipsfpulist);
-  add_alias_cmd ("yes", "double", class_support, 1, &mipsfpulist);
-  add_alias_cmd ("1", "double", class_support, 1, &mipsfpulist);
-  add_cmd ("none", class_support, set_mipsfpu_none_command,
-          _("Select no MIPS floating-point coprocessor."), &mipsfpulist);
-  add_alias_cmd ("off", "none", class_support, 1, &mipsfpulist);
-  add_alias_cmd ("no", "none", class_support, 1, &mipsfpulist);
-  add_alias_cmd ("0", "none", class_support, 1, &mipsfpulist);
+  cmd_list_element *set_mipsfpu_double_cmd
+    = add_cmd ("double", class_support, set_mipsfpu_double_command,
+              _("Select double-precision MIPS floating-point coprocessor."),
+              &mipsfpulist);
+  add_alias_cmd ("on", set_mipsfpu_double_cmd, class_support, 1, &mipsfpulist);
+  add_alias_cmd ("yes", set_mipsfpu_double_cmd, class_support, 1, &mipsfpulist);
+  add_alias_cmd ("1", set_mipsfpu_double_cmd, class_support, 1, &mipsfpulist);
+
+  cmd_list_element *set_mipsfpu_none_cmd
+    = add_cmd ("none", class_support, set_mipsfpu_none_command,
+              _("Select no MIPS floating-point coprocessor."), &mipsfpulist);
+  add_alias_cmd ("off", set_mipsfpu_none_cmd, class_support, 1, &mipsfpulist);
+  add_alias_cmd ("no", set_mipsfpu_none_cmd, class_support, 1, &mipsfpulist);
+  add_alias_cmd ("0", set_mipsfpu_none_cmd, class_support, 1, &mipsfpulist);
   add_cmd ("auto", class_support, set_mipsfpu_auto_command,
           _("Select MIPS floating-point coprocessor automatically."),
           &mipsfpulist);
index 8daa87cf978f086e941ba89b5894818790b6b2c9..7eba2993fb2e4a187e95c23e075b6783eb2e3850 100644 (file)
@@ -3304,7 +3304,8 @@ current working language.  The result is printed and saved in the value\n\
 history, if it is not void."));
   set_cmd_completer_handle_brkchars (c, print_command_completer);
 
-  add_cmd ("variable", class_vars, set_command, _("\
+  cmd_list_element *set_variable_cmd
+    = add_cmd ("variable", class_vars, set_command, _("\
 Evaluate expression EXP and assign result to variable VAR.\n\
 Usage: set variable VAR = EXP\n\
 This uses assignment syntax appropriate for the current language\n\
@@ -3313,8 +3314,8 @@ VAR may be a debugger \"convenience\" variable (names starting\n\
 with $), a register (a few standard names starting with $), or an actual\n\
 variable in the program being debugged.  EXP is any valid expression.\n\
 This may usually be abbreviated to simply \"set\"."),
-          &setlist);
-  add_alias_cmd ("var", "variable", class_vars, 0, &setlist);
+              &setlist);
+  add_alias_cmd ("var", set_variable_cmd, class_vars, 0, &setlist);
 
   const auto print_opts = make_value_print_options_def_group (nullptr);
 
index c04e1cde72181ec8c6e2ff022421bc6288c2fdff..00affb85d22ea680b738a25f66b0ef8b2b5d8b99 100644 (file)
@@ -3109,25 +3109,29 @@ void _initialize_record_btrace ();
 void
 _initialize_record_btrace ()
 {
-  add_prefix_cmd ("btrace", class_obscure, cmd_record_btrace_start,
-                 _("Start branch trace recording."), &record_btrace_cmdlist,
-                 0, &record_cmdlist);
-  add_alias_cmd ("b", "btrace", class_obscure, 1, &record_cmdlist);
-
-  add_cmd ("bts", class_obscure, cmd_record_btrace_bts_start,
-          _("\
+  cmd_list_element *record_btrace_cmd
+    = add_prefix_cmd ("btrace", class_obscure, cmd_record_btrace_start,
+                     _("Start branch trace recording."),
+                     &record_btrace_cmdlist, 0, &record_cmdlist);
+  add_alias_cmd ("b", record_btrace_cmd, class_obscure, 1, &record_cmdlist);
+
+  cmd_list_element *record_btrace_bts_cmd
+    = add_cmd ("bts", class_obscure, cmd_record_btrace_bts_start,
+              _("\
 Start branch trace recording in Branch Trace Store (BTS) format.\n\n\
 The processor stores a from/to record for each branch into a cyclic buffer.\n\
 This format may not be available on all processors."),
-          &record_btrace_cmdlist);
-  add_alias_cmd ("bts", "btrace bts", class_obscure, 1, &record_cmdlist);
+            &record_btrace_cmdlist);
+  add_alias_cmd ("bts", record_btrace_bts_cmd, class_obscure, 1,
+                &record_cmdlist);
 
-  add_cmd ("pt", class_obscure, cmd_record_btrace_pt_start,
-          _("\
+  cmd_list_element *record_btrace_pt_cmd
+    = add_cmd ("pt", class_obscure, cmd_record_btrace_pt_start,
+              _("\
 Start branch trace recording in Intel Processor Trace format.\n\n\
 This format may not be available on all processors."),
-          &record_btrace_cmdlist);
-  add_alias_cmd ("pt", "btrace pt", class_obscure, 1, &record_cmdlist);
+            &record_btrace_cmdlist);
+  add_alias_cmd ("pt", record_btrace_pt_cmd, class_obscure, 1, &record_cmdlist);
 
   add_basic_prefix_cmd ("btrace", class_support,
                        _("Set record options."), &set_record_btrace_cmdlist,
index 91da1076194ffb16735f1646af3bb9d8bf45b67a..03e39eeaf3a2fedca358c64cd22c142d8a706190 100644 (file)
@@ -2796,14 +2796,15 @@ _initialize_record_full ()
                  _("Start full execution recording."), &record_full_cmdlist,
                  0, &record_cmdlist);
 
-  c = add_cmd ("restore", class_obscure, cmd_record_full_restore,
+  cmd_list_element *record_full_restore_cmd
+    = add_cmd ("restore", class_obscure, cmd_record_full_restore,
               _("Restore the execution log from a file.\n\
 Argument is filename.  File must be created with 'record save'."),
               &record_full_cmdlist);
-  set_cmd_completer (c, filename_completer);
+  set_cmd_completer (record_full_restore_cmd, filename_completer);
 
   /* Deprecate the old version without "full" prefix.  */
-  c = add_alias_cmd ("restore", "full restore", class_obscure, 1,
+  c = add_alias_cmd ("restore", record_full_restore_cmd, class_obscure, 1,
                     &record_cmdlist);
   set_cmd_completer (c, filename_completer);
   deprecate_cmd (c, "record full restore");
@@ -2817,61 +2818,67 @@ Argument is filename.  File must be created with 'record save'."),
                       0, &show_record_cmdlist);
 
   /* Record instructions number limit command.  */
-  add_setshow_boolean_cmd ("stop-at-limit", no_class,
-                          &record_full_stop_at_limit, _("\
+  set_show_commands set_record_full_stop_at_limit_cmds
+    = add_setshow_boolean_cmd ("stop-at-limit", no_class,
+                              &record_full_stop_at_limit, _("\
 Set whether record/replay stops when record/replay buffer becomes full."), _("\
 Show whether record/replay stops when record/replay buffer becomes full."),
                           _("Default is ON.\n\
 When ON, if the record/replay buffer becomes full, ask user what to do.\n\
 When OFF, if the record/replay buffer becomes full,\n\
 delete the oldest recorded instruction to make room for each new one."),
-                          NULL, NULL,
-                          &set_record_full_cmdlist, &show_record_full_cmdlist);
+                              NULL, NULL,
+                              &set_record_full_cmdlist,
+                              &show_record_full_cmdlist);
 
-  c = add_alias_cmd ("stop-at-limit", "full stop-at-limit", no_class, 1,
+  c = add_alias_cmd ("stop-at-limit",
+                    set_record_full_stop_at_limit_cmds.set, no_class, 1,
                     &set_record_cmdlist);
   deprecate_cmd (c, "set record full stop-at-limit");
 
-  c = add_alias_cmd ("stop-at-limit", "full stop-at-limit", no_class, 1,
+  c = add_alias_cmd ("stop-at-limit",
+                    set_record_full_stop_at_limit_cmds.show, no_class, 1,
                     &show_record_cmdlist);
   deprecate_cmd (c, "show record full stop-at-limit");
 
-  add_setshow_uinteger_cmd ("insn-number-max", no_class,
-                           &record_full_insn_max_num,
-                           _("Set record/replay buffer limit."),
-                           _("Show record/replay buffer limit."), _("\
+  set_show_commands record_full_insn_number_max_cmds
+    = add_setshow_uinteger_cmd ("insn-number-max", no_class,
+                               &record_full_insn_max_num,
+                               _("Set record/replay buffer limit."),
+                               _("Show record/replay buffer limit."), _("\
 Set the maximum number of instructions to be stored in the\n\
 record/replay buffer.  A value of either \"unlimited\" or zero means no\n\
 limit.  Default is 200000."),
-                           set_record_full_insn_max_num,
-                           NULL, &set_record_full_cmdlist,
-                           &show_record_full_cmdlist);
+                               set_record_full_insn_max_num,
+                               NULL, &set_record_full_cmdlist,
+                               &show_record_full_cmdlist);
 
-  c = add_alias_cmd ("insn-number-max", "full insn-number-max", no_class, 1,
-                    &set_record_cmdlist);
+  c = add_alias_cmd ("insn-number-max", record_full_insn_number_max_cmds.set,
+                    no_class, 1, &set_record_cmdlist);
   deprecate_cmd (c, "set record full insn-number-max");
 
-  c = add_alias_cmd ("insn-number-max", "full insn-number-max", no_class, 1,
-                    &show_record_cmdlist);
+  c = add_alias_cmd ("insn-number-max", record_full_insn_number_max_cmds.show,
+                    no_class, 1, &show_record_cmdlist);
   deprecate_cmd (c, "show record full insn-number-max");
 
-  add_setshow_boolean_cmd ("memory-query", no_class,
-                          &record_full_memory_query, _("\
+  set_show_commands record_full_memory_query_cmds
+    = add_setshow_boolean_cmd ("memory-query", no_class,
+                              &record_full_memory_query, _("\
 Set whether query if PREC cannot record memory change of next instruction."),
-                          _("\
+                              _("\
 Show whether query if PREC cannot record memory change of next instruction."),
-                          _("\
+                              _("\
 Default is OFF.\n\
 When ON, query if PREC cannot record memory change of next instruction."),
-                          NULL, NULL,
-                          &set_record_full_cmdlist,
-                          &show_record_full_cmdlist);
+                              NULL, NULL,
+                              &set_record_full_cmdlist,
+                              &show_record_full_cmdlist);
 
-  c = add_alias_cmd ("memory-query", "full memory-query", no_class, 1,
-                    &set_record_cmdlist);
+  c = add_alias_cmd ("memory-query", record_full_memory_query_cmds.set,
+                    no_class, 1, &set_record_cmdlist);
   deprecate_cmd (c, "set record full memory-query");
 
-  c = add_alias_cmd ("memory-query", "full memory-query", no_class, 1,
-                    &show_record_cmdlist);
+  c = add_alias_cmd ("memory-query", record_full_memory_query_cmds.show,
+                    no_class, 1,&show_record_cmdlist);
   deprecate_cmd (c, "show record full memory-query");
 }
index a09137b34feb395cd90ed5964fbd16a1c1fe76f5..6968c30d930dbc0f029b10755dd7a79efc248152 100644 (file)
@@ -792,18 +792,24 @@ A size of \"unlimited\" means unlimited lines.  The default is 10."),
   set_cmd_completer (record_cmd, filename_completer);
 
   add_com_alias ("rec", record_cmd, class_obscure, 1);
-  add_basic_prefix_cmd ("record", class_support,
-                       _("Set record options."), &set_record_cmdlist,
-                       0, &setlist);
-  add_alias_cmd ("rec", "record", class_obscure, 1, &setlist);
-  add_show_prefix_cmd ("record", class_support,
-                      _("Show record options."), &show_record_cmdlist,
-                      0, &showlist);
-  add_alias_cmd ("rec", "record", class_obscure, 1, &showlist);
-  add_prefix_cmd ("record", class_support, info_record_command,
-                 _("Info record options."), &info_record_cmdlist,
-                 0, &infolist);
-  add_alias_cmd ("rec", "record", class_obscure, 1, &infolist);
+
+  cmd_list_element *set_record_cmd
+    = add_basic_prefix_cmd ("record", class_support,
+                           _("Set record options."), &set_record_cmdlist,
+                           0, &setlist);
+  add_alias_cmd ("rec", set_record_cmd, class_obscure, 1, &setlist);
+
+  cmd_list_element *show_record_cmd
+    = add_show_prefix_cmd ("record", class_support,
+                          _("Show record options."), &show_record_cmdlist,
+                          0, &showlist);
+  add_alias_cmd ("rec", show_record_cmd, class_obscure, 1, &showlist);
+
+  cmd_list_element *info_record_cmd
+    = add_prefix_cmd ("record", class_support, info_record_command,
+                     _("Info record options."), &info_record_cmdlist,
+                     0, &infolist);
+  add_alias_cmd ("rec", info_record_cmd, class_obscure, 1, &infolist);
 
   c = add_cmd ("save", class_obscure, cmd_record_save,
               _("Save the execution log to a file.\n\
@@ -812,26 +818,31 @@ Default filename is 'gdb_record.PROCESS_ID'."),
               &record_cmdlist);
   set_cmd_completer (c, filename_completer);
 
-  add_cmd ("delete", class_obscure, cmd_record_delete,
-          _("Delete the rest of execution log and start recording it anew."),
-          &record_cmdlist);
-  add_alias_cmd ("d", "delete", class_obscure, 1, &record_cmdlist);
-  add_alias_cmd ("del", "delete", class_obscure, 1, &record_cmdlist);
-
-  add_cmd ("stop", class_obscure, cmd_record_stop,
-          _("Stop the record/replay target."),
-          &record_cmdlist);
-  add_alias_cmd ("s", "stop", class_obscure, 1, &record_cmdlist);
+  cmd_list_element *record_delete_cmd
+    =  add_cmd ("delete", class_obscure, cmd_record_delete,
+               _("Delete the rest of execution log and start recording it \
+anew."),
+           &record_cmdlist);
+  add_alias_cmd ("d", record_delete_cmd, class_obscure, 1, &record_cmdlist);
+  add_alias_cmd ("del", record_delete_cmd, class_obscure, 1, &record_cmdlist);
+
+  cmd_list_element *record_stop_cmd
+    = add_cmd ("stop", class_obscure, cmd_record_stop,
+              _("Stop the record/replay target."),
+              &record_cmdlist);
+  add_alias_cmd ("s", record_stop_cmd, class_obscure, 1, &record_cmdlist);
 
   add_prefix_cmd ("goto", class_obscure, cmd_record_goto, _("\
 Restore the program to its state at instruction number N.\n\
 Argument is instruction number, as shown by 'info record'."),
                  &record_goto_cmdlist, 1, &record_cmdlist);
 
-  add_cmd ("begin", class_obscure, cmd_record_goto_begin,
-          _("Go to the beginning of the execution log."),
-          &record_goto_cmdlist);
-  add_alias_cmd ("start", "begin", class_obscure, 1, &record_goto_cmdlist);
+  cmd_list_element *record_goto_begin_cmd
+    = add_cmd ("begin", class_obscure, cmd_record_goto_begin,
+              _("Go to the beginning of the execution log."),
+              &record_goto_cmdlist);
+  add_alias_cmd ("start", record_goto_begin_cmd, class_obscure, 1,
+                &record_goto_cmdlist);
 
   add_cmd ("end", class_obscure, cmd_record_goto_end,
           _("Go to the end of the execution log."),
index f2cb35116c89ece8dba026618c1273067bc03262..8379f514738a3e8f3908e5964116d8550c635193 100644 (file)
@@ -1928,24 +1928,27 @@ add_packet_config_cmd (struct packet_config *config, const char *name,
                         name, title);
   /* set/show TITLE-packet {auto,on,off} */
   cmd_name = xstrprintf ("%s-packet", title);
-  add_setshow_auto_boolean_cmd (cmd_name, class_obscure,
-                               &config->detect, set_doc,
-                               show_doc, NULL, /* help_doc */
-                               NULL,
-                               show_remote_protocol_packet_cmd,
-                               &remote_set_cmdlist, &remote_show_cmdlist);
+  set_show_commands cmds
+    = add_setshow_auto_boolean_cmd (cmd_name, class_obscure,
+                                   &config->detect, set_doc,
+                                   show_doc, NULL, /* help_doc */
+                                   NULL,
+                                   show_remote_protocol_packet_cmd,
+                                   &remote_set_cmdlist, &remote_show_cmdlist);
+
   /* The command code copies the documentation strings.  */
   xfree (set_doc);
   xfree (show_doc);
+
   /* set/show remote NAME-packet {auto,on,off} -- legacy.  */
   if (legacy)
     {
       char *legacy_name;
 
       legacy_name = xstrprintf ("%s-packet", name);
-      add_alias_cmd (legacy_name, cmd_name, class_obscure, 0,
+      add_alias_cmd (legacy_name, cmds.set, class_obscure, 0,
                     &remote_set_cmdlist);
-      add_alias_cmd (legacy_name, cmd_name, class_obscure, 0,
+      add_alias_cmd (legacy_name, cmds.show, class_obscure, 0,
                     &remote_show_cmdlist);
     }
 }
index 5c8e6ca636626f68f5c5ce8c8048dbd40bcb734c..2df521181438257a4a3c930b5377e355c62afd33 100644 (file)
@@ -1585,20 +1585,21 @@ inferior.  Otherwise, symbols must be loaded manually, using \
                           show_auto_solib_add,
                           &setlist, &showlist);
 
-  add_setshow_optional_filename_cmd ("sysroot", class_support,
-                                    &gdb_sysroot, _("\
+  set_show_commands sysroot_cmds
+    = add_setshow_optional_filename_cmd ("sysroot", class_support,
+                                        &gdb_sysroot, _("\
 Set an alternate system root."), _("\
 Show the current system root."), _("\
 The system root is used to load absolute shared library symbol files.\n\
 For other (relative) files, you can add directories using\n\
 `set solib-search-path'."),
-                                    gdb_sysroot_changed,
-                                    NULL,
-                                    &setlist, &showlist);
+                                        gdb_sysroot_changed,
+                                        NULL,
+                                        &setlist, &showlist);
 
-  add_alias_cmd ("solib-absolute-prefix", "sysroot", class_support, 0,
+  add_alias_cmd ("solib-absolute-prefix", sysroot_cmds.set, class_support, 0,
                 &setlist);
-  add_alias_cmd ("solib-absolute-prefix", "sysroot", class_support, 0,
+  add_alias_cmd ("solib-absolute-prefix", sysroot_cmds.show, class_support, 0,
                 &showlist);
 
   add_setshow_optional_filename_cmd ("solib-search-path", class_support,
index 3f9600f387938026e8545d230c2b8806d912c478..4157594d1533b20c5bd945c66d37286d6a2b778b 100644 (file)
@@ -535,9 +535,10 @@ _initialize_sparc64_adi_tdep ()
   add_basic_prefix_cmd ("adi", class_support,
                        _("ADI version related commands."),
                        &sparc64adilist, 0, &cmdlist);
-  add_cmd ("examine", class_support, adi_examine_command,
-          _("Examine ADI versions."), &sparc64adilist);
-  add_alias_cmd ("x", "examine", no_class, 1, &sparc64adilist);
+  cmd_list_element *adi_examine_cmd
+    = add_cmd ("examine", class_support, adi_examine_command,
+              _("Examine ADI versions."), &sparc64adilist);
+  add_alias_cmd ("x", adi_examine_cmd, no_class, 1, &sparc64adilist);
   add_cmd ("assign", class_support, adi_assign_command,
           _("Assign ADI versions."), &sparc64adilist);
 
index 9555f94707de526144e0586dcafa5b2602b53a41..655b3dabf62d1c3cff64aac5e98dab4c96af3bb9 100644 (file)
@@ -6897,11 +6897,12 @@ If zero then the symbol cache is disabled."),
           _("Print symbol cache statistics for each program space."),
           &maintenanceprintlist);
 
-  add_cmd ("symbol-cache", class_maintenance,
-          maintenance_flush_symbol_cache,
-          _("Flush the symbol cache for each program space."),
-          &maintenanceflushlist);
-  c = add_alias_cmd ("flush-symbol-cache", "flush symbol-cache",
+  cmd_list_element *maintenance_flush_symbol_cache_cmd
+    = add_cmd ("symbol-cache", class_maintenance,
+              maintenance_flush_symbol_cache,
+              _("Flush the symbol cache for each program space."),
+              &maintenanceflushlist);
+  c = add_alias_cmd ("flush-symbol-cache", maintenance_flush_symbol_cache_cmd,
                     class_maintenance, 0, &maintenancelist);
   deprecate_cmd (c, "maintenancelist flush symbol-cache");
 
index abbd507c8b22f51bc1d2b2c6fdb7e3c2f0e39e53..eca1a9d385cba91580b2b8dc5c6dcdb49f2eb875 100644 (file)
@@ -4075,11 +4075,11 @@ Select a trace frame by PC.\n\
 Default is the current PC, or the PC of the current trace frame."),
           &tfindlist);
 
-  add_cmd ("end", class_trace, tfind_end_command, _("\
-De-select any trace frame and resume 'live' debugging."),
-          &tfindlist);
+  cmd_list_element *tfind_end_cmd
+    = add_cmd ("end", class_trace, tfind_end_command, _("\
+De-select any trace frame and resume 'live' debugging."), &tfindlist);
 
-  add_alias_cmd ("none", "end", class_trace, 0, &tfindlist);
+  add_alias_cmd ("none", tfind_end_cmd, class_trace, 0, &tfindlist);
 
   add_cmd ("start", class_trace, tfind_start_command,
           _("Select the first trace frame in the trace buffer."),
index e191c357fcaecbc2e0a5ebe101cbdcd1d6a291ee..fa2b64ef10ac3ff905e0162925603763edc66f8d 100644 (file)
@@ -3143,18 +3143,20 @@ _initialize_valprint ()
 {
   cmd_list_element *cmd;
 
-  add_basic_prefix_cmd ("print", no_class,
-                       _("Generic command for setting how things print."),
-                       &setprintlist, 0, &setlist);
-  add_alias_cmd ("p", "print", no_class, 1, &setlist);
+  cmd_list_element *set_print_cmd
+    = add_basic_prefix_cmd ("print", no_class,
+                           _("Generic command for setting how things print."),
+                           &setprintlist, 0, &setlist);
+  add_alias_cmd ("p", set_print_cmd, no_class, 1, &setlist);
   /* Prefer set print to set prompt.  */
-  add_alias_cmd ("pr", "print", no_class, 1, &setlist);
-
-  add_show_prefix_cmd ("print", no_class,
-                      _("Generic command for showing print settings."),
-                      &showprintlist, 0, &showlist);
-  add_alias_cmd ("p", "print", no_class, 1, &showlist);
-  add_alias_cmd ("pr", "print", no_class, 1, &showlist);
+  add_alias_cmd ("pr", set_print_cmd, no_class, 1, &setlist);
+
+  cmd_list_element *show_print_cmd
+    = add_show_prefix_cmd ("print", no_class,
+                          _("Generic command for showing print settings."),
+                          &showprintlist, 0, &showlist);
+  add_alias_cmd ("p", show_print_cmd, no_class, 1, &showlist);
+  add_alias_cmd ("pr", show_print_cmd, no_class, 1, &showlist);
 
   cmd = add_basic_prefix_cmd ("raw", no_class,
                              _("\
index 9822cec209b250af7a89a64277abea33b87cdbfb..9df035a50b3ba286adc805079d80c4af09833b6d 100644 (file)
@@ -4231,7 +4231,8 @@ void _initialize_values ();
 void
 _initialize_values ()
 {
-  add_cmd ("convenience", no_class, show_convenience, _("\
+  cmd_list_element *show_convenience_cmd
+    = add_cmd ("convenience", no_class, show_convenience, _("\
 Debugger convenience (\"$foo\") variables and functions.\n\
 Convenience variables are created when you assign them values;\n\
 thus, \"set $foo=1\" gives \"$foo\" the value 1.  Values may be any type.\n\
@@ -4244,7 +4245,7 @@ A few convenience variables are given values automatically:\n\
 Convenience functions are defined via the Python API."
 #endif
           ), &showlist);
-  add_alias_cmd ("conv", "convenience", no_class, 1, &showlist);
+  add_alias_cmd ("conv", show_convenience_cmd, no_class, 1, &showlist);
 
   add_cmd ("values", no_set_class, show_values, _("\
 Elements of value history around item number IDX (or last ten)."),
index e6644843a95127681fdbab169372a940ad2b643e..88601e106f57617cc6aad2cd7c9298ee85ad8f5b 100644 (file)
@@ -1212,10 +1212,11 @@ _initialize_windows_tdep ()
     = gdbarch_data_register_post_init (init_windows_gdbarch_data);
 
   init_w32_command_list ();
-  add_cmd ("thread-information-block", class_info, display_tib,
-          _("Display thread information block."),
-          &info_w32_cmdlist);
-  add_alias_cmd ("tib", "thread-information-block", class_info, 1,
+  cmd_list_element *info_w32_thread_information_block_cmd
+    = add_cmd ("thread-information-block", class_info, display_tib,
+              _("Display thread information block."),
+              &info_w32_cmdlist);
+  add_alias_cmd ("tib", info_w32_thread_information_block_cmd, class_info, 1,
                 &info_w32_cmdlist);
 
   add_setshow_boolean_cmd ("show-all-tib", class_maintenance,