This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Constify add_prefix_cmd


This changes add_prefix_cmd to accept a const-taking function as an
argument; then fixes up all the callers.

In a couple of spots I had to add a non-const overload of a function,
because the function is passed to two different command-adding
"constructors".  These overloads are temporary; once constification is
complete they can be removed.

This patch also fixes a typo I happened to notice while constifying.

Note that this touches a couple of files (gnu-nat.c and go32-nat.c)
that I can't build.  So, while I made a best-effort there, I am not
certain they will still compile.

Tested by rebuilding.

gdb/ChangeLog
2017-10-10  Tom Tromey  <tom@tromey.com>

	* gdbthread.h (thread_command): Constify.
	* inferior.h (detach_command): Constify.
	* top.h (set_history, show_history): Constify.
	* arm-tdep.c (set_arm_command, show_arm_command): Constify.
	* serial.c (serial_set_cmd, serial_show_cmd): Constify.
	* bsd-kvm.c (bsd_kvm_cmd): Constify.
	* printcmd.c (set_command): Constify.
	(non_const_set_command): New function.
	* dcache.c (set_dcache_command, show_dcache_command): Constify.
	* breakpoint.c (enable_command, disable_command, delete_command)
	(catch_command, tcatch_command, set_breakpoint_cmd)
	(show_breakpoint_cmd): Constify.
	* macrocmd.c (macro_command): Constify.
	* infcmd.c (unset_command, kill_command, detach_command)
	(info_proc_cmd): Constify.
	* i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify.
	* auto-load.c (show_auto_load_cmd, set_auto_load_cmd)
	(info_auto_load_cmd): Constify.
	* target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd)
	(unset_tdesc_cmd): Constify.
	* ada-lang.c (set_ada_command, show_ada_command)
	(maint_set_ada_cmd, maint_show_ada_cmd): Constify.
	* guile/guile.c (set_guile_command, show_guile_command)
	(info_guile_command): Constify.
	* tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd):
	Constify.
	* skip.c (skip_command): Constify.
	* compile/compile.c (_initialize_compile): Constify.
	* dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify.
	* btrace.c (maint_btrace_cmd, maint_btrace_set_cmd)
	(maint_btrace_show_cmd, maint_btrace_pt_set_cmd)
	(maint_btrace_pt_show_cmd): Constify.
	* remote.c (set_remote_cmd, show_remote_cmd, remote_command):
	Constify.
	* python/python.c (user_show_python, user_set_python): Constify.
	* mips-tdep.c (set_mips_command, show_mips_command)
	(set_mipsfpu_command): Constify.
	* record-btrace.c (cmd_record_btrace_start)
	(cmd_set_record_btrace, cmd_show_record_btrace)
	(cmd_set_record_btrace_bts, cmd_show_record_btrace_bts)
	(cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): Constify.
	* rs6000-tdep.c (set_powerpc_command, show_powerpc_command):
	Constify.
	* symfile.c (overlay_command): Constify.
	* spu-tdep.c (set_spu_command, show_spu_command): Constify.
	* cli/cli-logging.c (set_logging_command, show_logging_command):
	Constify.
	* cli/cli-dump.c (dump_command, append_command)
	(srec_dump_command, ihex_dump_command, verilog_dump_command)
	(tekhex_dump_command, binary_dump_command)
	(binary_append_command): Constify.
	* cli/cli-decode.c (struct cmd_list_element): Change type of
	"fun".
	* cli/cli-cmds.c (info_command, show_command, set_debug)
	(show_debug): Constify.
	(show_command): Add non-const overload.
	* top.c (set_history, show_history): Constify.
	* sh-tdep.c (set_sh_command, show_sh_command): Constify.
	* command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype.
	* target.c (target_command): Constify.
	* sparc64-tdep.c (info_adi_command): Constify.
	* record-full.c (cmd_record_full_start): Constify.
	(set_record_full_command): Constify.  Fix typo.
	(show_record_full_command): Constify.
	* thread.c (thread_command, thread_apply_command): Constify.
	* memattr.c (dummy_cmd): Constify.
	* value.c (function_command): Constify.
	* frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify.
	* probe.c (info_probes_command): Constify.
	* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify.
	* gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd)
	(show_thread_cmd, set_thread_default_cmd)
	(show_thread_default_cmd): Constify.
	(check_empty): Constify.
	* tracepoint.c (tfind_command): Constify.
	* cp-support.c (maint_cplus_command): Constify.
	* windows-tdep.c (info_w32_command): Constify.
	* record.c (cmd_record_start, set_record_command)
	(show_record_command, info_record_command, cmd_record_goto):
	Constify.
	* ravenscar-thread.c (set_ravenscar_command)
	(show_ravenscar_command): Constify.
	* utils.c (set_internal_problem_cmd, show_internal_problem_cmd):
	Constify.
	(add_internal_problem_command): Remove casts.
	* arc-tdep.c (maintenance_print_arc_command): Constify.
	* valprint.c (set_print, show_print, set_print_raw)
	(show_print_raw): Constify.
	* maint.c (maintenance_command, maintenance_info_command)
	(maintenance_print_command, maintenance_set_cmd)
	(maintenance_show_cmd, set_per_command_cmd)
	(show_per_command_cmd, maintenance_check_command): Constify.
	* language.c (set_check, show_check): Constify.
	* typeprint.c (show_print_type, set_print_type): Constify.
	* go32-nat.c (go32_info_dos_command): Constify.
---
 gdb/ChangeLog             | 98 +++++++++++++++++++++++++++++++++++++++++++++++
 gdb/ada-lang.c            |  8 ++--
 gdb/arc-tdep.c            |  2 +-
 gdb/arm-tdep.c            |  4 +-
 gdb/auto-load.c           |  6 +--
 gdb/breakpoint.c          | 24 ++++--------
 gdb/bsd-kvm.c             |  2 +-
 gdb/btrace.c              | 10 ++---
 gdb/cli/cli-cmds.c        | 23 +++++------
 gdb/cli/cli-decode.c      |  2 +-
 gdb/cli/cli-dump.c        | 16 ++++----
 gdb/cli/cli-logging.c     |  4 +-
 gdb/command.h             |  2 +-
 gdb/compile/compile.c     |  2 +-
 gdb/cp-support.c          |  6 +--
 gdb/dcache.c              |  4 +-
 gdb/dwarf2read.c          |  4 +-
 gdb/frame.c               |  4 +-
 gdb/gdbthread.h           |  2 +-
 gdb/gnu-nat.c             | 14 +++----
 gdb/go32-nat.c            |  2 +-
 gdb/guile/guile.c         |  6 +--
 gdb/i386-tdep.c           |  4 +-
 gdb/infcmd.c              | 10 ++---
 gdb/inferior.h            |  2 +-
 gdb/language.c            |  8 +---
 gdb/macrocmd.c            |  2 +-
 gdb/maint.c               | 22 ++++-------
 gdb/memattr.c             |  2 +-
 gdb/mips-tdep.c           |  6 +--
 gdb/printcmd.c            | 12 +++++-
 gdb/probe.c               |  2 +-
 gdb/python/python.c       |  4 +-
 gdb/ravenscar-thread.c    |  4 +-
 gdb/record-btrace.c       | 14 +++----
 gdb/record-full.c         |  8 ++--
 gdb/record.c              | 10 ++---
 gdb/remote.c              |  6 +--
 gdb/rs6000-tdep.c         |  4 +-
 gdb/ser-tcp.c             |  4 +-
 gdb/serial.c              |  4 +-
 gdb/sh-tdep.c             |  4 +-
 gdb/skip.c                |  2 +-
 gdb/sparc64-tdep.c        |  2 +-
 gdb/spu-tdep.c            |  6 +--
 gdb/symfile.c             |  4 +-
 gdb/target-descriptions.c |  6 +--
 gdb/target.c              |  4 +-
 gdb/thread.c              |  5 +--
 gdb/top.c                 |  4 +-
 gdb/top.h                 |  4 +-
 gdb/tracepoint.c          |  2 +-
 gdb/tui/tui-win.c         |  6 +--
 gdb/typeprint.c           |  4 +-
 gdb/utils.c               |  8 ++--
 gdb/valprint.c            | 12 ++----
 gdb/value.c               |  2 +-
 gdb/windows-tdep.c        |  2 +-
 58 files changed, 262 insertions(+), 188 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 1a0c769594..7409496ce7 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -352,7 +352,7 @@ static struct cmd_list_element *maint_show_ada_cmdlist;
 /* Implement the "maintenance set ada" (prefix) command.  */
 
 static void
-maint_set_ada_cmd (char *args, int from_tty)
+maint_set_ada_cmd (const char *args, int from_tty)
 {
   help_list (maint_set_ada_cmdlist, "maintenance set ada ", all_commands,
 	     gdb_stdout);
@@ -361,7 +361,7 @@ maint_set_ada_cmd (char *args, int from_tty)
 /* Implement the "maintenance show ada" (prefix) command.  */
 
 static void
-maint_show_ada_cmd (char *args, int from_tty)
+maint_show_ada_cmd (const char *args, int from_tty)
 {
   cmd_show_list (maint_show_ada_cmdlist, from_tty, "");
 }
@@ -13969,7 +13969,7 @@ static struct cmd_list_element *show_ada_list;
 /* Implement the "set ada" prefix command.  */
 
 static void
-set_ada_command (char *arg, int from_tty)
+set_ada_command (const char *arg, int from_tty)
 {
   printf_unfiltered (_(\
 "\"set ada\" must be followed by the name of a setting.\n"));
@@ -13979,7 +13979,7 @@ set_ada_command (char *arg, int from_tty)
 /* Implement the "show ada" prefix command.  */
 
 static void
-show_ada_command (char *args, int from_tty)
+show_ada_command (const char *args, int from_tty)
 {
   cmd_show_list (show_ada_list, from_tty, "");
 }
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 1d05c5a20f..9a726e34ed 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -2110,7 +2110,7 @@ arc_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
 /* Wrapper for "maintenance print arc" list of commands.  */
 
 static void
-maintenance_print_arc_command (char *args, int from_tty)
+maintenance_print_arc_command (const char *args, int from_tty)
 {
   cmd_show_list (maintenance_print_arc_list, from_tty, "");
 }
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index d8569e051a..f760b618ec 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -8365,7 +8365,7 @@ arm_skip_stub (struct frame_info *frame, CORE_ADDR pc)
 }
 
 static void
-set_arm_command (char *args, int from_tty)
+set_arm_command (const char *args, int from_tty)
 {
   printf_unfiltered (_("\
 \"set arm\" must be followed by an apporpriate subcommand.\n"));
@@ -8373,7 +8373,7 @@ set_arm_command (char *args, int from_tty)
 }
 
 static void
-show_arm_command (char *args, int from_tty)
+show_arm_command (const char *args, int from_tty)
 {
   cmd_show_list (showarmcmdlist, from_tty, "");
 }
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index ddd060182f..9b1111d066 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -1451,7 +1451,7 @@ Use `info auto-load %s-scripts [REGEXP]' to list them."),
 /* The only valid "set auto-load" argument is off|0|no|disable.  */
 
 static void
-set_auto_load_cmd (char *args, int from_tty)
+set_auto_load_cmd (const char *args, int from_tty)
 {
   struct cmd_list_element *list;
   size_t length;
@@ -1500,7 +1500,7 @@ automatic loading of Python scripts."),
    "show auto-load " settings.  */
 
 static void
-show_auto_load_cmd (char *args, int from_tty)
+show_auto_load_cmd (const char *args, int from_tty)
 {
   cmd_show_list (*auto_load_show_cmdlist_get (), from_tty, "");
 }
@@ -1528,7 +1528,7 @@ automatic loading of Python scripts."),
    newlines at proper places.  */
 
 static void
-info_auto_load_cmd (char *args, int from_tty)
+info_auto_load_cmd (const char *args, int from_tty)
 {
   struct cmd_list_element *list;
   struct cleanup *infolist_chain;
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 9997d3fc82..0687880b20 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -93,10 +93,6 @@ enum exception_event_kind
 
 /* Prototypes for local functions.  */
 
-static void disable_command (char *, int);
-
-static void enable_command (char *, int);
-
 static void map_breakpoint_numbers (const char *,
 				    gdb::function_view<void (breakpoint *)>);
 
@@ -125,8 +121,6 @@ static std::vector<symtab_and_line> decode_location_default
 
 static void clear_command (char *, int);
 
-static void catch_command (char *, int);
-
 static int can_use_hardware_watchpoint (struct value *);
 
 static void mention (struct breakpoint *);
@@ -203,8 +197,6 @@ static void enable_breakpoint_disp (struct breakpoint *, enum bpdisp,
 
 static void stop_command (char *arg, int from_tty);
 
-static void tcatch_command (char *arg, int from_tty);
-
 static void free_bp_location (struct bp_location *loc);
 static void incref_bp_location (struct bp_location *loc);
 static void decref_bp_location (struct bp_location **loc);
@@ -11565,14 +11557,14 @@ init_ada_exception_breakpoint (struct breakpoint *b,
 }
 
 static void
-catch_command (char *arg, int from_tty)
+catch_command (const char *arg, int from_tty)
 {
   error (_("Catch requires an event name."));
 }
 
 
 static void
-tcatch_command (char *arg, int from_tty)
+tcatch_command (const char *arg, int from_tty)
 {
   error (_("Catch requires an event name."));
 }
@@ -13522,7 +13514,7 @@ iterate_over_related_breakpoints (struct breakpoint *b,
 }
 
 static void
-delete_command (char *arg, int from_tty)
+delete_command (const char *arg, int from_tty)
 {
   struct breakpoint *b, *b_tmp;
 
@@ -14383,7 +14375,7 @@ disable_breakpoint (struct breakpoint *bpt)
 }
 
 static void
-disable_command (char *args, int from_tty)
+disable_command (const char *args, int from_tty)
 {
   if (args == 0)
     {
@@ -14503,7 +14495,7 @@ enable_breakpoint (struct breakpoint *bpt)
    in stopping the inferior.  */
 
 static void
-enable_command (char *args, int from_tty)
+enable_command (const char *args, int from_tty)
 {
   if (args == 0)
     {
@@ -14598,12 +14590,12 @@ enable_delete_command (const char *args, int from_tty)
 }
 
 static void
-set_breakpoint_cmd (char *args, int from_tty)
+set_breakpoint_cmd (const char *args, int from_tty)
 {
 }
 
 static void
-show_breakpoint_cmd (char *args, int from_tty)
+show_breakpoint_cmd (const char *args, int from_tty)
 {
 }
 
@@ -15383,7 +15375,7 @@ add_catch_command (const char *name, const char *docstring,
 }
 
 static void
-save_command (char *arg, int from_tty)
+save_command (const char *arg, int from_tty)
 {
   printf_unfiltered (_("\"save\" must be followed by "
 		       "the name of a save subcommand.\n"));
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index 04e5622db8..3d013b4e1d 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -271,7 +271,7 @@ bsd_kvm_fetch_registers (struct target_ops *ops,
 struct cmd_list_element *bsd_kvm_cmdlist;
 
 static void
-bsd_kvm_cmd (char *arg, int fromtty)
+bsd_kvm_cmd (const char *arg, int fromtty)
 {
   /* ??? Should this become an alias for "target kvm"?  */
 }
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 7990d5f886..8338ebfb0a 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -3374,7 +3374,7 @@ maint_btrace_clear_cmd (const char *args, int from_tty)
 /* The "maintenance btrace" command.  */
 
 static void
-maint_btrace_cmd (char *args, int from_tty)
+maint_btrace_cmd (const char *args, int from_tty)
 {
   help_list (maint_btrace_cmdlist, "maintenance btrace ", all_commands,
 	     gdb_stdout);
@@ -3383,7 +3383,7 @@ maint_btrace_cmd (char *args, int from_tty)
 /* The "maintenance set btrace" command.  */
 
 static void
-maint_btrace_set_cmd (char *args, int from_tty)
+maint_btrace_set_cmd (const char *args, int from_tty)
 {
   help_list (maint_btrace_set_cmdlist, "maintenance set btrace ", all_commands,
 	     gdb_stdout);
@@ -3392,7 +3392,7 @@ maint_btrace_set_cmd (char *args, int from_tty)
 /* The "maintenance show btrace" command.  */
 
 static void
-maint_btrace_show_cmd (char *args, int from_tty)
+maint_btrace_show_cmd (const char *args, int from_tty)
 {
   help_list (maint_btrace_show_cmdlist, "maintenance show btrace ",
 	     all_commands, gdb_stdout);
@@ -3401,7 +3401,7 @@ maint_btrace_show_cmd (char *args, int from_tty)
 /* The "maintenance set btrace pt" command.  */
 
 static void
-maint_btrace_pt_set_cmd (char *args, int from_tty)
+maint_btrace_pt_set_cmd (const char *args, int from_tty)
 {
   help_list (maint_btrace_pt_set_cmdlist, "maintenance set btrace pt ",
 	     all_commands, gdb_stdout);
@@ -3410,7 +3410,7 @@ maint_btrace_pt_set_cmd (char *args, int from_tty)
 /* The "maintenance show btrace pt" command.  */
 
 static void
-maint_btrace_pt_show_cmd (char *args, int from_tty)
+maint_btrace_pt_show_cmd (const char *args, int from_tty)
 {
   help_list (maint_btrace_pt_show_cmdlist, "maintenance show btrace pt ",
 	     all_commands, gdb_stdout);
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 51271adffe..a1c308a38d 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -68,14 +68,6 @@ static void pwd_command (char *, int);
 
 static void help_command (char *, int);
 
-static void show_command (char *, int);
-
-static void info_command (char *, int);
-
-static void show_debug (char *, int);
-
-static void set_debug (char *, int);
-
 static void make_command (char *, int);
 
 static void shell_escape (const char *, int);
@@ -218,7 +210,7 @@ error_no_arg (const char *why)
    args.  */
 
 static void
-info_command (char *arg, int from_tty)
+info_command (const char *arg, int from_tty)
 {
   printf_unfiltered (_("\"info\" must be followed by "
 		       "the name of an info command.\n"));
@@ -228,10 +220,19 @@ info_command (char *arg, int from_tty)
 /* The "show" command with no arguments shows all the settings.  */
 
 static void
+show_command (const char *arg, int from_tty)
+{
+  cmd_show_list (showlist, from_tty, "");
+}
+
+/* A temporary non-const overload of show_command.  */
+
+static void
 show_command (char *arg, int from_tty)
 {
   cmd_show_list (showlist, from_tty, "");
 }
+
 
 /* Provide documentation on command or list given by COMMAND.  FROM_TTY
    is ignored.  */
@@ -1616,7 +1617,7 @@ filter_sals (std::vector<symtab_and_line> &sals)
 }
 
 static void
-set_debug (char *arg, int from_tty)
+set_debug (const char *arg, int from_tty)
 {
   printf_unfiltered (_("\"set debug\" must be followed by "
 		       "the name of a debug subcommand.\n"));
@@ -1624,7 +1625,7 @@ set_debug (char *arg, int from_tty)
 }
 
 static void
-show_debug (char *args, int from_tty)
+show_debug (const char *args, int from_tty)
 {
   cmd_show_list (showdebuglist, from_tty, "");
 }
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index f161c86ebc..87ebed5f6e 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -396,7 +396,7 @@ add_alias_cmd (const char *name, const char *oldname,
 
 struct cmd_list_element *
 add_prefix_cmd (const char *name, enum command_class theclass,
-		cmd_cfunc_ftype *fun,
+		cmd_const_cfunc_ftype *fun,
 		const char *doc, struct cmd_list_element **prefixlist,
 		const char *prefixname, int allow_unknown,
 		struct cmd_list_element **list)
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index f4ea2d7342..4eafffac90 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -129,14 +129,14 @@ static struct cmd_list_element *binary_dump_cmdlist;
 static struct cmd_list_element *binary_append_cmdlist;
 
 static void
-dump_command (char *cmd, int from_tty)
+dump_command (const char *cmd, int from_tty)
 {
   printf_unfiltered (_("\"dump\" must be followed by a subcommand.\n\n"));
   help_list (dump_cmdlist, "dump ", all_commands, gdb_stdout);
 }
 
 static void
-append_command (char *cmd, int from_tty)
+append_command (const char *cmd, int from_tty)
 {
   printf_unfiltered (_("\"append\" must be followed by a subcommand.\n\n"));
   help_list (dump_cmdlist, "append ", all_commands, gdb_stdout);
@@ -581,42 +581,42 @@ restore_command (char *args_in, int from_tty)
 }
 
 static void
-srec_dump_command (char *cmd, int from_tty)
+srec_dump_command (const char *cmd, int from_tty)
 {
   printf_unfiltered (_("\"dump srec\" must be followed by a subcommand.\n"));
   help_list (srec_cmdlist, "dump srec ", all_commands, gdb_stdout);
 }
 
 static void
-ihex_dump_command (char *cmd, int from_tty)
+ihex_dump_command (const char *cmd, int from_tty)
 {
   printf_unfiltered (_("\"dump ihex\" must be followed by a subcommand.\n"));
   help_list (ihex_cmdlist, "dump ihex ", all_commands, gdb_stdout);
 }
 
 static void
-verilog_dump_command (char *cmd, int from_tty)
+verilog_dump_command (const char *cmd, int from_tty)
 {
   printf_unfiltered (_("\"dump verilog\" must be followed by a subcommand.\n"));
   help_list (verilog_cmdlist, "dump verilog ", all_commands, gdb_stdout);
 }
 
 static void
-tekhex_dump_command (char *cmd, int from_tty)
+tekhex_dump_command (const char *cmd, int from_tty)
 {
   printf_unfiltered (_("\"dump tekhex\" must be followed by a subcommand.\n"));
   help_list (tekhex_cmdlist, "dump tekhex ", all_commands, gdb_stdout);
 }
 
 static void
-binary_dump_command (char *cmd, int from_tty)
+binary_dump_command (const char *cmd, int from_tty)
 {
   printf_unfiltered (_("\"dump binary\" must be followed by a subcommand.\n"));
   help_list (binary_dump_cmdlist, "dump binary ", all_commands, gdb_stdout);
 }
 
 static void
-binary_append_command (char *cmd, int from_tty)
+binary_append_command (const char *cmd, int from_tty)
 {
   printf_unfiltered (_("\"append binary\" must be followed by a subcommand.\n"));
   help_list (binary_append_cmdlist, "append binary ", all_commands,
diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
index 14242e0474..ee31659389 100644
--- a/gdb/cli/cli-logging.c
+++ b/gdb/cli/cli-logging.c
@@ -172,7 +172,7 @@ set_logging_off (const char *args, int from_tty)
 }
 
 static void
-set_logging_command (char *args, int from_tty)
+set_logging_command (const char *args, int from_tty)
 {
   printf_unfiltered (_("\"set logging\" lets you log output to a file.\n"
 		       "Usage: set logging on [FILENAME]\n"
@@ -183,7 +183,7 @@ set_logging_command (char *args, int from_tty)
 }
 
 static void
-show_logging_command (char *args, int from_tty)
+show_logging_command (const char *args, int from_tty)
 {
   if (saved_filename)
     printf_unfiltered (_("Currently logging to \"%s\".\n"), saved_filename);
diff --git a/gdb/command.h b/gdb/command.h
index b40cd7e496..32ee73af62 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -165,7 +165,7 @@ extern struct cmd_list_element *add_alias_cmd (const char *,
 
 
 extern struct cmd_list_element *add_prefix_cmd (const char *, enum command_class,
-						cmd_cfunc_ftype *fun,
+						cmd_const_cfunc_ftype *fun,
 						const char *,
 						struct cmd_list_element **,
 						const char *, int,
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 35d8c86ced..cd8ce6a1c1 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -609,7 +609,7 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
 /* The "compile" prefix command.  */
 
 static void
-compile_command (char *args, int from_tty)
+compile_command (const char *args, int from_tty)
 {
   /* If a sub-command is not specified to the compile prefix command,
      assume it is a direct code compilation.  */
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 7bcb155a7f..37b2b4af97 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -65,10 +65,6 @@ static void make_symbol_overload_list_qualified (const char *func_name);
 
 struct cmd_list_element *maint_cplus_cmd_list = NULL;
 
-/* The actual commands.  */
-
-static void maint_cplus_command (char *arg, int from_tty);
-
 /* A list of typedefs which should not be substituted by replace_typedefs.  */
 static const char * const ignore_typedefs[] =
   {
@@ -1586,7 +1582,7 @@ gdb_sniff_from_mangled_name (const char *mangled, char **demangled)
 /* Don't allow just "maintenance cplus".  */
 
 static  void
-maint_cplus_command (char *arg, int from_tty)
+maint_cplus_command (const char *arg, int from_tty)
 {
   printf_unfiltered (_("\"maintenance cplus\" must be followed "
 		       "by the name of a command.\n"));
diff --git a/gdb/dcache.c b/gdb/dcache.c
index 891fa02fbd..c8832fd36b 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -672,7 +672,7 @@ set_dcache_line_size (char *args, int from_tty,
 }
 
 static void
-set_dcache_command (char *arg, int from_tty)
+set_dcache_command (const char *arg, int from_tty)
 {
   printf_unfiltered (
      "\"set dcache\" must be followed by the name of a subcommand.\n");
@@ -680,7 +680,7 @@ set_dcache_command (char *arg, int from_tty)
 }
 
 static void
-show_dcache_command (char *args, int from_tty)
+show_dcache_command (const char *args, int from_tty)
 {
   cmd_show_list (dcache_show_list, from_tty, "");
 }
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index ca5b3a8d08..979dae2d52 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -23212,14 +23212,14 @@ static struct cmd_list_element *set_dwarf_cmdlist;
 static struct cmd_list_element *show_dwarf_cmdlist;
 
 static void
-set_dwarf_cmd (char *args, int from_tty)
+set_dwarf_cmd (const char *args, int from_tty)
 {
   help_list (set_dwarf_cmdlist, "maintenance set dwarf ", all_commands,
 	     gdb_stdout);
 }
 
 static void
-show_dwarf_cmd (char *args, int from_tty)
+show_dwarf_cmd (const char *args, int from_tty)
 {
   cmd_show_list (show_dwarf_cmdlist, from_tty, "");
 }
diff --git a/gdb/frame.c b/gdb/frame.c
index 17f7397aee..8d481694cd 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2906,14 +2906,14 @@ static struct cmd_list_element *set_backtrace_cmdlist;
 static struct cmd_list_element *show_backtrace_cmdlist;
 
 static void
-set_backtrace_cmd (char *args, int from_tty)
+set_backtrace_cmd (const char *args, int from_tty)
 {
   help_list (set_backtrace_cmdlist, "set backtrace ", all_commands,
 	     gdb_stdout);
 }
 
 static void
-show_backtrace_cmd (char *args, int from_tty)
+show_backtrace_cmd (const char *args, int from_tty)
 {
   cmd_show_list (show_backtrace_cmdlist, from_tty, "");
 }
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index fb314c2645..aa346610f1 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -577,7 +577,7 @@ extern void finish_thread_state_cleanup (void *ptid_p);
 /* Commands with a prefix of `thread'.  */
 extern struct cmd_list_element *thread_cmd_list;
 
-extern void thread_command (char *tidstr, int from_tty);
+extern void thread_command (const char *tidstr, int from_tty);
 
 /* Print notices on thread events (attach, detach, etc.), set with
    `set print thread-events'.  */
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 0ad35ca33a..7cb6e4a0dd 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2721,28 +2721,28 @@ struct cmd_list_element *set_thread_default_cmd_list = NULL;
 struct cmd_list_element *show_thread_default_cmd_list = NULL;
 
 static void
-set_thread_cmd (char *args, int from_tty)
+set_thread_cmd (const char *args, int from_tty)
 {
   printf_unfiltered ("\"set thread\" must be followed by the "
 		     "name of a thread property, or \"default\".\n");
 }
 
 static void
-show_thread_cmd (char *args, int from_tty)
+show_thread_cmd (const char *args, int from_tty)
 {
   printf_unfiltered ("\"show thread\" must be followed by the "
 		     "name of a thread property, or \"default\".\n");
 }
 
 static void
-set_thread_default_cmd (char *args, int from_tty)
+set_thread_default_cmd (const char *args, int from_tty)
 {
   printf_unfiltered ("\"set thread default\" must be followed "
 		     "by the name of a thread property.\n");
 }
 
 static void
-show_thread_default_cmd (char *args, int from_tty)
+show_thread_default_cmd (const char *args, int from_tty)
 {
   printf_unfiltered ("\"show thread default\" must be followed "
 		     "by the name of a thread property.\n");
@@ -2780,7 +2780,7 @@ _parse_bool_arg (char *args, char *t_val, char *f_val, char *cmd_prefix)
   _parse_bool_arg (args, "on", "off", cmd_prefix)
 
 static void
-check_empty (char *args, char *cmd_prefix)
+check_empty (const char *args, char *cmd_prefix)
 {
   if (args)
     error (_("Garbage after \"%s\" command: `%s'"), cmd_prefix, args);
@@ -3071,14 +3071,14 @@ show_exceptions_cmd (char *args, int from_tty)
 
 
 static void
-set_task_cmd (char *args, int from_tty)
+set_task_cmd (const char *args, int from_tty)
 {
   printf_unfiltered ("\"set task\" must be followed by the name"
 		     " of a task property.\n");
 }
 
 static void
-show_task_cmd (char *args, int from_tty)
+show_task_cmd (const char *args, int from_tty)
 {
   struct inf *inf = cur_inf ();
 
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 92f7381ef6..582b0073a1 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -2053,7 +2053,7 @@ go32_pte_for_address (char *arg, int from_tty)
 static struct cmd_list_element *info_dos_cmdlist = NULL;
 
 static void
-go32_info_dos_command (char *args, int from_tty)
+go32_info_dos_command (const char *args, int from_tty)
 {
   help_list (info_dos_cmdlist, "info dos ", class_info, gdb_stdout);
 }
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index d6252d6855..5c514f6ace 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -425,7 +425,7 @@ static struct cmd_list_element *info_guile_list;
 /* Function for use by 'set guile' prefix command.  */
 
 static void
-set_guile_command (char *args, int from_tty)
+set_guile_command (const char *args, int from_tty)
 {
   help_list (set_guile_list, "set guile ", all_commands, gdb_stdout);
 }
@@ -433,7 +433,7 @@ set_guile_command (char *args, int from_tty)
 /* Function for use by 'show guile' prefix command.  */
 
 static void
-show_guile_command (char *args, int from_tty)
+show_guile_command (const char *args, int from_tty)
 {
   cmd_show_list (show_guile_list, from_tty, "");
 }
@@ -443,7 +443,7 @@ show_guile_command (char *args, int from_tty)
    "info scheme" with no args.  */
 
 static void
-info_guile_command (char *args, int from_tty)
+info_guile_command (const char *args, int from_tty)
 {
   printf_unfiltered (_("\"info guile\" must be followed"
 		       " by the name of an info command.\n"));
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index f26d624483..9eb1192ff5 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -8971,7 +8971,7 @@ static struct cmd_list_element *mpx_set_cmdlist, *mpx_show_cmdlist;
 /* Helper function for the CLI commands.  */
 
 static void
-set_mpx_cmd (char *args, int from_tty)
+set_mpx_cmd (const char *args, int from_tty)
 {
   help_list (mpx_set_cmdlist, "set mpx ", all_commands, gdb_stdout);
 }
@@ -8979,7 +8979,7 @@ set_mpx_cmd (char *args, int from_tty)
 /* Helper function for the CLI commands.  */
 
 static void
-show_mpx_cmd (char *args, int from_tty)
+show_mpx_cmd (const char *args, int from_tty)
 {
   cmd_show_list (mpx_show_cmdlist, from_tty, "");
 }
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 187c71f344..669631bdb4 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -70,8 +70,6 @@ static void until_command (char *, int);
 
 static void path_command (char *, int);
 
-static void unset_command (char *, int);
-
 static void info_float_command (char *, int);
 
 static void disconnect_command (char *, int);
@@ -2624,7 +2622,7 @@ info_vector_command (char *args, int from_tty)
 /* Kill the inferior process.  Make us have no inferior.  */
 
 static void
-kill_command (char *arg, int from_tty)
+kill_command (const char *arg, int from_tty)
 {
   /* FIXME:  This should not really be inferior_ptid (or target_has_execution).
      It should be a distinct flag that indicates that a target is active, cuz
@@ -3028,7 +3026,7 @@ notice_new_inferior (ptid_t ptid, int leave_running, int from_tty)
  */
 
 void
-detach_command (char *args, int from_tty)
+detach_command (const char *args, int from_tty)
 {
   dont_repeat ();		/* Not for the faint of heart.  */
 
@@ -3172,7 +3170,7 @@ info_float_command (char *args, int from_tty)
 }
 
 static void
-unset_command (char *args, int from_tty)
+unset_command (const char *args, int from_tty)
 {
   printf_filtered (_("\"unset\" must be followed by the "
 		     "name of an unset subcommand.\n"));
@@ -3198,7 +3196,7 @@ info_proc_cmd_1 (const char *args, enum info_proc_what what, int from_tty)
 /* Implement `info proc' when given without any futher parameters.  */
 
 static void
-info_proc_cmd (char *args, int from_tty)
+info_proc_cmd (const char *args, int from_tty)
 {
   info_proc_cmd_1 (args, IP_MINIMAL, from_tty);
 }
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 498d74706a..39a8877b22 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -168,7 +168,7 @@ extern void interrupt_target_1 (int all_threads);
 
 extern void delete_longjmp_breakpoint_cleanup (void *arg);
 
-extern void detach_command (char *, int);
+extern void detach_command (const char *, int);
 
 extern void notice_new_inferior (ptid_t, int, int);
 
diff --git a/gdb/language.c b/gdb/language.c
index e92c3c55a5..ecdf431743 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -50,10 +50,6 @@ static void unk_lang_error (const char *);
 
 static int unk_lang_parser (struct parser_state *);
 
-static void show_check (char *, int);
-
-static void set_check (char *, int);
-
 static void set_range_case (void);
 
 static void unk_lang_emit_char (int c, struct type *type,
@@ -507,7 +503,7 @@ language_str (enum language lang)
 }
 
 static void
-set_check (char *ignore, int from_tty)
+set_check (const char *ignore, int from_tty)
 {
   printf_unfiltered (
      "\"set check\" must be followed by the name of a check subcommand.\n");
@@ -515,7 +511,7 @@ set_check (char *ignore, int from_tty)
 }
 
 static void
-show_check (char *ignore, int from_tty)
+show_check (const char *ignore, int from_tty)
 {
   cmd_show_list (showchecklist, from_tty, "");
 }
diff --git a/gdb/macrocmd.c b/gdb/macrocmd.c
index 0db43dc760..2bb8705fd6 100644
--- a/gdb/macrocmd.c
+++ b/gdb/macrocmd.c
@@ -33,7 +33,7 @@
 static struct cmd_list_element *macrolist;
 
 static void
-macro_command (char *arg, int from_tty)
+macro_command (const char *arg, int from_tty)
 {
   printf_unfiltered
     ("\"macro\" must be followed by the name of a macro command.\n");
diff --git a/gdb/maint.c b/gdb/maint.c
index 6c0dec2856..65a056b25f 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -44,16 +44,10 @@
 #include "cli/cli-utils.h"
 #include "cli/cli-setshow.h"
 
-static void maintenance_command (char *, int);
-
 static void maintenance_internal_error (char *args, int from_tty);
 
 static void maintenance_space_display (char *, int);
 
-static void maintenance_info_command (char *, int);
-
-static void maintenance_print_command (char *, int);
-
 static void maintenance_do_deprecate (const char *, int);
 
 /* Set this to the maximum number of seconds to wait instead of waiting forever
@@ -73,7 +67,7 @@ show_watchdog (struct ui_file *file, int from_tty,
 /* Access the maintenance subcommands.  */
 
 static void
-maintenance_command (char *args, int from_tty)
+maintenance_command (const char *args, int from_tty)
 {
   printf_unfiltered (_("\"maintenance\" must be followed by "
 		       "the name of a maintenance command.\n"));
@@ -162,7 +156,7 @@ maintenance_space_display (char *args, int from_tty)
    "maintenance info" with no args.  */
 
 static void
-maintenance_info_command (char *arg, int from_tty)
+maintenance_info_command (const char *arg, int from_tty)
 {
   printf_unfiltered (_("\"maintenance info\" must be followed "
 		       "by the name of an info command.\n"));
@@ -175,7 +169,7 @@ maintenance_info_command (char *arg, int from_tty)
    "maintenance check" with no args.  */
 
 static void
-maintenance_check_command (char *arg, int from_tty)
+maintenance_check_command (const char *arg, int from_tty)
 {
   printf_unfiltered (_("\"maintenance check\" must be followed "
 		       "by the name of a check command.\n"));
@@ -421,7 +415,7 @@ maintenance_print_architecture (char *args, int from_tty)
    "maintenance print" with no args.  */
 
 static void
-maintenance_print_command (char *arg, int from_tty)
+maintenance_print_command (const char *arg, int from_tty)
 {
   printf_unfiltered (_("\"maintenance print\" must be followed "
 		       "by the name of a print command.\n"));
@@ -644,7 +638,7 @@ struct cmd_list_element *maintenance_set_cmdlist;
 struct cmd_list_element *maintenance_show_cmdlist;
 
 static void
-maintenance_set_cmd (char *args, int from_tty)
+maintenance_set_cmd (const char *args, int from_tty)
 {
   printf_unfiltered (_("\"maintenance set\" must be followed "
 		       "by the name of a set command.\n"));
@@ -653,7 +647,7 @@ maintenance_set_cmd (char *args, int from_tty)
 }
 
 static void
-maintenance_show_cmd (char *args, int from_tty)
+maintenance_show_cmd (const char *args, int from_tty)
 {
   cmd_show_list (maintenance_show_cmdlist, from_tty, "");
 }
@@ -916,7 +910,7 @@ scoped_command_stats::scoped_command_stats (bool msg_type)
    In this case have "mt set per-command on|off" affect every setting.  */
 
 static void
-set_per_command_cmd (char *args, int from_tty)
+set_per_command_cmd (const char *args, int from_tty)
 {
   struct cmd_list_element *list;
   int val;
@@ -937,7 +931,7 @@ set_per_command_cmd (char *args, int from_tty)
    "show per-command " settings.  */
 
 static void
-show_per_command_cmd (char *args, int from_tty)
+show_per_command_cmd (const char *args, int from_tty)
 {
   cmd_show_list (per_command_showlist, from_tty, "");
 }
diff --git a/gdb/memattr.c b/gdb/memattr.c
index 5be6397bd0..6ed126b75b 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -684,7 +684,7 @@ delete_mem_command (const char *args, int from_tty)
 }
 
 static void
-dummy_cmd (char *args, int from_tty)
+dummy_cmd (const char *args, int from_tty)
 {
 }
 
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 05d7ae1e87..4eafe3e308 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -6877,13 +6877,13 @@ mips_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
    used for all MIPS-specific commands.  */
 
 static void
-show_mips_command (char *args, int from_tty)
+show_mips_command (const char *args, int from_tty)
 {
   help_list (showmipscmdlist, "show mips ", all_commands, gdb_stdout);
 }
 
 static void
-set_mips_command (char *args, int from_tty)
+set_mips_command (const char *args, int from_tty)
 {
   printf_unfiltered
     ("\"set mips\" must be followed by an appropriate subcommand.\n");
@@ -6930,7 +6930,7 @@ show_mipsfpu_command (const char *args, int from_tty)
 
 
 static void
-set_mipsfpu_command (char *args, int from_tty)
+set_mipsfpu_command (const char *args, int from_tty)
 {
   printf_unfiltered ("\"set mipsfpu\" must be followed by \"double\", "
 		     "\"single\",\"none\" or \"auto\".\n");
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index a8743f1f71..77a05e5d9f 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1262,7 +1262,7 @@ output_command_const (const char *exp, int from_tty)
 }
 
 static void
-set_command (char *exp, int from_tty)
+set_command (const char *exp, int from_tty)
 {
   expression_up expr = parse_expression (exp);
 
@@ -1285,6 +1285,14 @@ set_command (char *exp, int from_tty)
   evaluate_expression (expr.get ());
 }
 
+/* Temporary non-const version of set_command.  */
+
+static void
+non_const_set_command (char *exp, int from_tty)
+{
+  set_command (exp, from_tty);
+}
+
 static void
 info_symbol_command (char *arg, int from_tty)
 {
@@ -2749,7 +2757,7 @@ With a subcommand, this command modifies parts of the gdb environment.\n\
 You can see these environment settings with the \"show\" command."),
 		  &setlist, "set ", 1, &cmdlist);
   if (dbx_commands)
-    add_com ("assign", class_vars, set_command, _("\
+    add_com ("assign", class_vars, non_const_set_command, _("\
 Evaluate expression EXP and assign result to variable VAR, using assignment\n\
 syntax appropriate for the current language (VAR = EXP or VAR := EXP for\n\
 example).  VAR may be a debugger \"convenience\" variable (names starting\n\
diff --git a/gdb/probe.c b/gdb/probe.c
index c6435e48ba..b3dbf896b9 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -666,7 +666,7 @@ info_probes_for_ops (const char *arg, int from_tty,
 /* Implementation of the `info probes' command.  */
 
 static void
-info_probes_command (char *arg, int from_tty)
+info_probes_command (const char *arg, int from_tty)
 {
   info_probes_for_ops (arg, from_tty, NULL);
 }
diff --git a/gdb/python/python.c b/gdb/python/python.c
index b04057ec4a..5bb642a50a 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1428,7 +1428,7 @@ static struct cmd_list_element *user_show_python_list;
 /* Function for use by 'set python' prefix command.  */
 
 static void
-user_set_python (char *args, int from_tty)
+user_set_python (const char *args, int from_tty)
 {
   help_list (user_set_python_list, "set python ", all_commands,
 	     gdb_stdout);
@@ -1437,7 +1437,7 @@ user_set_python (char *args, int from_tty)
 /* Function for use by 'show python' prefix command.  */
 
 static void
-user_show_python (char *args, int from_tty)
+user_show_python (const char *args, int from_tty)
 {
   cmd_show_list (user_show_python_list, from_tty, "");
 }
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 1f93e3df0e..7e3015d1c7 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -391,7 +391,7 @@ static struct cmd_list_element *show_ravenscar_list;
 /* Implement the "set ravenscar" prefix command.  */
 
 static void
-set_ravenscar_command (char *arg, int from_tty)
+set_ravenscar_command (const char *arg, int from_tty)
 {
   printf_unfiltered (_(\
 "\"set ravenscar\" must be followed by the name of a setting.\n"));
@@ -401,7 +401,7 @@ set_ravenscar_command (char *arg, int from_tty)
 /* Implement the "show ravenscar" prefix command.  */
 
 static void
-show_ravenscar_command (char *args, int from_tty)
+show_ravenscar_command (const char *args, int from_tty)
 {
   cmd_show_list (show_ravenscar_list, from_tty, "");
 }
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 77844bc52a..36ddf1c223 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -2927,7 +2927,7 @@ cmd_record_btrace_pt_start (const char *args, int from_tty)
 /* Alias for "target record".  */
 
 static void
-cmd_record_btrace_start (char *args, int from_tty)
+cmd_record_btrace_start (const char *args, int from_tty)
 {
   if (args != NULL && *args != 0)
     error (_("Invalid argument."));
@@ -2959,7 +2959,7 @@ cmd_record_btrace_start (char *args, int from_tty)
 /* The "set record btrace" command.  */
 
 static void
-cmd_set_record_btrace (char *args, int from_tty)
+cmd_set_record_btrace (const char *args, int from_tty)
 {
   cmd_show_list (set_record_btrace_cmdlist, from_tty, "");
 }
@@ -2967,7 +2967,7 @@ cmd_set_record_btrace (char *args, int from_tty)
 /* The "show record btrace" command.  */
 
 static void
-cmd_show_record_btrace (char *args, int from_tty)
+cmd_show_record_btrace (const char *args, int from_tty)
 {
   cmd_show_list (show_record_btrace_cmdlist, from_tty, "");
 }
@@ -2985,7 +2985,7 @@ cmd_show_replay_memory_access (struct ui_file *file, int from_tty,
 /* The "set record btrace bts" command.  */
 
 static void
-cmd_set_record_btrace_bts (char *args, int from_tty)
+cmd_set_record_btrace_bts (const char *args, int from_tty)
 {
   printf_unfiltered (_("\"set record btrace bts\" must be followed "
 		       "by an appropriate subcommand.\n"));
@@ -2996,7 +2996,7 @@ cmd_set_record_btrace_bts (char *args, int from_tty)
 /* The "show record btrace bts" command.  */
 
 static void
-cmd_show_record_btrace_bts (char *args, int from_tty)
+cmd_show_record_btrace_bts (const char *args, int from_tty)
 {
   cmd_show_list (show_record_btrace_bts_cmdlist, from_tty, "");
 }
@@ -3004,7 +3004,7 @@ cmd_show_record_btrace_bts (char *args, int from_tty)
 /* The "set record btrace pt" command.  */
 
 static void
-cmd_set_record_btrace_pt (char *args, int from_tty)
+cmd_set_record_btrace_pt (const char *args, int from_tty)
 {
   printf_unfiltered (_("\"set record btrace pt\" must be followed "
 		       "by an appropriate subcommand.\n"));
@@ -3015,7 +3015,7 @@ cmd_set_record_btrace_pt (char *args, int from_tty)
 /* The "show record btrace pt" command.  */
 
 static void
-cmd_show_record_btrace_pt (char *args, int from_tty)
+cmd_show_record_btrace_pt (const char *args, int from_tty)
 {
   cmd_show_list (show_record_btrace_pt_cmdlist, from_tty, "");
 }
diff --git a/gdb/record-full.c b/gdb/record-full.c
index a3283d3942..37836e75d0 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2755,7 +2755,7 @@ record_full_goto_insn (struct record_full_entry *entry,
 /* Alias for "target record-full".  */
 
 static void
-cmd_record_full_start (char *args, int from_tty)
+cmd_record_full_start (const char *args, int from_tty)
 {
   execute_command ((char *) "target record-full", from_tty);
 }
@@ -2778,10 +2778,10 @@ set_record_full_insn_max_num (char *args, int from_tty,
 /* The "set record full" command.  */
 
 static void
-set_record_full_command (char *args, int from_tty)
+set_record_full_command (const char *args, int from_tty)
 {
   printf_unfiltered (_("\"set record full\" must be followed "
-		       "by an apporpriate subcommand.\n"));
+		       "by an appropriate subcommand.\n"));
   help_list (set_record_full_cmdlist, "set record full ", all_commands,
 	     gdb_stdout);
 }
@@ -2789,7 +2789,7 @@ set_record_full_command (char *args, int from_tty)
 /* The "show record full" command.  */
 
 static void
-show_record_full_command (char *args, int from_tty)
+show_record_full_command (const char *args, int from_tty)
 {
   cmd_show_list (show_record_full_cmdlist, from_tty, "");
 }
diff --git a/gdb/record.c b/gdb/record.c
index f4ef2692a1..5ecdcfc5f9 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -263,7 +263,7 @@ show_record_debug (struct ui_file *file, int from_tty,
 /* Alias for "target record".  */
 
 static void
-cmd_record_start (char *args, int from_tty)
+cmd_record_start (const char *args, int from_tty)
 {
   execute_command ((char *) "target record-full", from_tty);
 }
@@ -316,7 +316,7 @@ cmd_record_stop (const char *args, int from_tty)
 /* The "set record" command.  */
 
 static void
-set_record_command (char *args, int from_tty)
+set_record_command (const char *args, int from_tty)
 {
   printf_unfiltered (_("\"set record\" must be followed "
 		       "by an apporpriate subcommand.\n"));
@@ -326,7 +326,7 @@ set_record_command (char *args, int from_tty)
 /* The "show record" command.  */
 
 static void
-show_record_command (char *args, int from_tty)
+show_record_command (const char *args, int from_tty)
 {
   cmd_show_list (show_record_cmdlist, from_tty, "");
 }
@@ -334,7 +334,7 @@ show_record_command (char *args, int from_tty)
 /* The "info record" command.  */
 
 static void
-info_record_command (char *args, int from_tty)
+info_record_command (const char *args, int from_tty)
 {
   struct target_ops *t;
 
@@ -394,7 +394,7 @@ record_goto (const char *arg)
    Rewinds the recording (forward or backward) to the given instruction.  */
 
 static void
-cmd_record_goto (char *arg, int from_tty)
+cmd_record_goto (const char *arg, int from_tty)
 {
   record_goto (arg);
 }
diff --git a/gdb/remote.c b/gdb/remote.c
index 3ceabcf1aa..e06e807712 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -12252,7 +12252,7 @@ remote_delete_command (const char *args, int from_tty)
 }
 
 static void
-remote_command (char *args, int from_tty)
+remote_command (const char *args, int from_tty)
 {
   help_list (remote_cmdlist, "remote ", all_commands, gdb_stdout);
 }
@@ -13964,13 +13964,13 @@ remote_thread_events (struct target_ops *ops, int enable)
 }
 
 static void
-set_remote_cmd (char *args, int from_tty)
+set_remote_cmd (const char *args, int from_tty)
 {
   help_list (remote_set_cmdlist, "set remote ", all_commands, gdb_stdout);
 }
 
 static void
-show_remote_cmd (char *args, int from_tty)
+show_remote_cmd (const char *args, int from_tty)
 {
   /* We can't just use cmd_show_list here, because we want to skip
      the redundant "show remote Z-packet" and the legacy aliases.  */
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 95b2ca71c9..92395adb1a 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -6618,7 +6618,7 @@ rs6000_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
 /* PowerPC-specific commands.  */
 
 static void
-set_powerpc_command (char *args, int from_tty)
+set_powerpc_command (const char *args, int from_tty)
 {
   printf_unfiltered (_("\
 \"set powerpc\" must be followed by an appropriate subcommand.\n"));
@@ -6626,7 +6626,7 @@ set_powerpc_command (char *args, int from_tty)
 }
 
 static void
-show_powerpc_command (char *args, int from_tty)
+show_powerpc_command (const char *args, int from_tty)
 {
   cmd_show_list (showpowerpccmdlist, from_tty, "");
 }
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index c5bc6bdd11..7ff588b09d 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -368,13 +368,13 @@ ser_tcp_send_break (struct serial *scb)
 /* Support for "set tcp" and "show tcp" commands.  */
 
 static void
-set_tcp_cmd (char *args, int from_tty)
+set_tcp_cmd (const char *args, int from_tty)
 {
   help_list (tcp_set_cmdlist, "set tcp ", all_commands, gdb_stdout);
 }
 
 static void
-show_tcp_cmd (char *args, int from_tty)
+show_tcp_cmd (const char *args, int from_tty)
 {
   help_list (tcp_show_cmdlist, "show tcp ", all_commands, gdb_stdout);
 }
diff --git a/gdb/serial.c b/gdb/serial.c
index 91fdcbb367..6866549130 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -627,7 +627,7 @@ static struct cmd_list_element *serial_set_cmdlist;
 static struct cmd_list_element *serial_show_cmdlist;
 
 static void
-serial_set_cmd (char *args, int from_tty)
+serial_set_cmd (const char *args, int from_tty)
 {
   printf_unfiltered ("\"set serial\" must be followed "
 		     "by the name of a command.\n");
@@ -635,7 +635,7 @@ serial_set_cmd (char *args, int from_tty)
 }
 
 static void
-serial_show_cmd (char *args, int from_tty)
+serial_show_cmd (const char *args, int from_tty)
 {
   cmd_show_list (serial_show_cmdlist, from_tty, "");
 }
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 7d941e6235..dc89caee5e 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -2436,13 +2436,13 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 }
 
 static void
-show_sh_command (char *args, int from_tty)
+show_sh_command (const char *args, int from_tty)
 {
   help_list (showshcmdlist, "show sh ", all_commands, gdb_stdout);
 }
 
 static void
-set_sh_command (char *args, int from_tty)
+set_sh_command (const char *args, int from_tty)
 {
   printf_unfiltered
     ("\"set sh\" must be followed by an appropriate subcommand.\n");
diff --git a/gdb/skip.c b/gdb/skip.c
index 6e82a33163..af60eb7404 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -226,7 +226,7 @@ skip_function_command (const char *arg, int from_tty)
 /* Process "skip ..." that does not match "skip file" or "skip function".  */
 
 static void
-skip_command (char *arg, int from_tty)
+skip_command (const char *arg, int from_tty)
 {
   const char *file = NULL;
   const char *gfile = NULL;
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index b4ae165678..2fbeec0e98 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -187,7 +187,7 @@ sparc64_forget_process (pid_t pid)
 }
 
 static void
-info_adi_command (char *args, int from_tty)
+info_adi_command (const char *args, int from_tty)
 {
   printf_unfiltered ("\"adi\" must be followed by \"examine\" "
                      "or \"assign\".\n");
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index a7eb27d638..736993e1ca 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -2596,7 +2596,7 @@ info_spu_proxydma_command (const char *args, int from_tty)
 }
 
 static void
-info_spu_command (char *args, int from_tty)
+info_spu_command (const char *args, int from_tty)
 {
   printf_unfiltered (_("\"info spu\" must be followed by "
 		       "the name of an SPU facility.\n"));
@@ -2607,13 +2607,13 @@ info_spu_command (char *args, int from_tty)
 /* Root of all "set spu "/"show spu " commands.  */
 
 static void
-show_spu_command (char *args, int from_tty)
+show_spu_command (const char *args, int from_tty)
 {
   help_list (showspucmdlist, "show spu ", all_commands, gdb_stdout);
 }
 
 static void
-set_spu_command (char *args, int from_tty)
+set_spu_command (const char *args, int from_tty)
 {
   help_list (setspucmdlist, "set spu ", all_commands, gdb_stdout);
 }
diff --git a/gdb/symfile.c b/gdb/symfile.c
index a74165456e..ae7417ca4d 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -92,8 +92,6 @@ static const struct sym_fns *find_sym_fns (bfd *);
 
 static void overlay_invalidate_all (void);
 
-static void overlay_command (char *, int);
-
 static void simple_free_overlay_table (void);
 
 static void read_target_long_array (CORE_ADDR, unsigned int *, int, int,
@@ -3390,7 +3388,7 @@ overlay_load_command (const char *args, int from_tty)
 static struct cmd_list_element *overlaylist;
 
 static void
-overlay_command (char *args, int from_tty)
+overlay_command (const char *args, int from_tty)
 {
   printf_unfiltered
     ("\"overlay\" must be followed by the name of an overlay command.\n");
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 06cfbb50e2..4f5e9d60a6 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1856,19 +1856,19 @@ static struct cmd_list_element *tdesc_unset_cmdlist;
 /* Helper functions for the CLI commands.  */
 
 static void
-set_tdesc_cmd (char *args, int from_tty)
+set_tdesc_cmd (const char *args, int from_tty)
 {
   help_list (tdesc_set_cmdlist, "set tdesc ", all_commands, gdb_stdout);
 }
 
 static void
-show_tdesc_cmd (char *args, int from_tty)
+show_tdesc_cmd (const char *args, int from_tty)
 {
   cmd_show_list (tdesc_show_cmdlist, from_tty, "");
 }
 
 static void
-unset_tdesc_cmd (char *args, int from_tty)
+unset_tdesc_cmd (const char *args, int from_tty)
 {
   help_list (tdesc_unset_cmdlist, "unset tdesc ", all_commands, gdb_stdout);
 }
diff --git a/gdb/target.c b/gdb/target.c
index f2dccd23ce..4a7589d445 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -90,8 +90,6 @@ static int return_zero (struct target_ops *);
 
 static int return_zero_has_execution (struct target_ops *, ptid_t);
 
-static void target_command (char *, int);
-
 static struct target_ops *find_default_run_target (const char *);
 
 static struct gdbarch *default_thread_architecture (struct target_ops *ops,
@@ -188,7 +186,7 @@ static void setup_target_debug (void);
 /* The user just typed 'target' without the name of a target.  */
 
 static void
-target_command (char *arg, int from_tty)
+target_command (const char *arg, int from_tty)
 {
   fputs_filtered ("Argument required (target name).  Try `help target'\n",
 		  gdb_stdout);
diff --git a/gdb/thread.c b/gdb/thread.c
index 16688629ee..df04b4ed6a 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -63,7 +63,6 @@ static int threads_executing;
 static void thread_apply_all_command (char *, int);
 static int thread_alive (struct thread_info *);
 static void info_threads_command (char *, int);
-static void thread_apply_command (char *, int);
 
 /* RAII type used to increase / decrease the refcount of each thread
    in a given list of threads.  */
@@ -1721,7 +1720,7 @@ thread_apply_all_command (char *cmd, int from_tty)
 /* Implementation of the "thread apply" command.  */
 
 static void
-thread_apply_command (char *tidlist, int from_tty)
+thread_apply_command (const char *tidlist, int from_tty)
 {
   char *cmd = NULL;
   tid_range_parser parser;
@@ -1814,7 +1813,7 @@ thread_apply_command (char *tidlist, int from_tty)
    if prefix of arg is `apply'.  */
 
 void
-thread_command (char *tidstr, int from_tty)
+thread_command (const char *tidstr, int from_tty)
 {
   if (tidstr == NULL)
     {
diff --git a/gdb/top.c b/gdb/top.c
index ed109344b2..3b3bbee4ac 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1758,7 +1758,7 @@ set_history_size_command (char *args, int from_tty, struct cmd_list_element *c)
 }
 
 void
-set_history (char *args, int from_tty)
+set_history (const char *args, int from_tty)
 {
   printf_unfiltered (_("\"set history\" must be followed "
 		       "by the name of a history subcommand.\n"));
@@ -1766,7 +1766,7 @@ set_history (char *args, int from_tty)
 }
 
 void
-show_history (char *args, int from_tty)
+show_history (const char *args, int from_tty)
 {
   cmd_show_list (showhistlist, from_tty, "");
 }
diff --git a/gdb/top.h b/gdb/top.h
index 99ba010821..ab21e5e013 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -282,9 +282,9 @@ extern void gdb_add_history (const char *);
 
 extern void show_commands (char *args, int from_tty);
 
-extern void set_history (char *, int);
+extern void set_history (const char *, int);
 
-extern void show_history (char *, int);
+extern void show_history (const char *, int);
 
 extern void set_verbose (char *, int, struct cmd_list_element *);
 
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 72e920b1db..c66a4b39c5 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2332,7 +2332,7 @@ tfind_command_1 (const char *args, int from_tty)
 }
 
 static void
-tfind_command (char *args, int from_tty)
+tfind_command (const char *args, int from_tty)
 {
   tfind_command_1 (const_cast<char *> (args), from_tty);
 }
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index cb8e475b72..7dbd76b043 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -316,19 +316,19 @@ tui_update_variables (void)
 }
 
 static void
-set_tui_cmd (char *args, int from_tty)
+set_tui_cmd (const char *args, int from_tty)
 {
 }
 
 static void
-show_tui_cmd (char *args, int from_tty)
+show_tui_cmd (const char *args, int from_tty)
 {
 }
 
 static struct cmd_list_element *tuilist;
 
 static void
-tui_command (char *args, int from_tty)
+tui_command (const char *args, int from_tty)
 {
   printf_unfiltered (_("\"tui\" must be followed by the name of a "
                      "tui command.\n"));
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 8ee44af9b9..441cbb8742 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -662,7 +662,7 @@ struct cmd_list_element *setprinttypelist;
 struct cmd_list_element *showprinttypelist;
 
 static void
-set_print_type (char *arg, int from_tty)
+set_print_type (const char *arg, int from_tty)
 {
   printf_unfiltered (
      "\"set print type\" must be followed by the name of a subcommand.\n");
@@ -670,7 +670,7 @@ set_print_type (char *arg, int from_tty)
 }
 
 static void
-show_print_type (char *args, int from_tty)
+show_print_type (const char *args, int from_tty)
 {
   cmd_show_list (showprinttypelist, from_tty, "");
 }
diff --git a/gdb/utils.c b/gdb/utils.c
index 07841afb8f..dd746849c7 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -550,12 +550,12 @@ demangler_warning (const char *file, int line, const char *string, ...)
 /* Dummy functions to keep add_prefix_cmd happy.  */
 
 static void
-set_internal_problem_cmd (char *args, int from_tty)
+set_internal_problem_cmd (const char *args, int from_tty)
 {
 }
 
 static void
-show_internal_problem_cmd (char *args, int from_tty)
+show_internal_problem_cmd (const char *args, int from_tty)
 {
 }
 
@@ -593,14 +593,14 @@ add_internal_problem_command (struct internal_problem *problem)
   show_doc = xstrprintf (_("Show what GDB does when %s is detected."),
 			 problem->name);
 
-  add_prefix_cmd ((char*) problem->name,
+  add_prefix_cmd (problem->name,
 		  class_maintenance, set_internal_problem_cmd, set_doc,
 		  set_cmd_list,
 		  concat ("maintenance set ", problem->name, " ",
 			  (char *) NULL),
 		  0/*allow-unknown*/, &maintenance_set_cmdlist);
 
-  add_prefix_cmd ((char*) problem->name,
+  add_prefix_cmd (problem->name,
 		  class_maintenance, show_internal_problem_cmd, show_doc,
 		  show_cmd_list,
 		  concat ("maintenance show ", problem->name, " ",
diff --git a/gdb/valprint.c b/gdb/valprint.c
index ca0c4768c9..2dd383f6d4 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -84,10 +84,6 @@ struct cmd_list_element *showprintrawlist;
 static int partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr,
 				int len, int *errptr);
 
-static void show_print (char *, int);
-
-static void set_print (char *, int);
-
 static void set_input_radix (char *, int, struct cmd_list_element *);
 
 static void set_input_radix_1 (int, unsigned);
@@ -3129,7 +3125,7 @@ show_radix (const char *arg, int from_tty)
 
 
 static void
-set_print (char *arg, int from_tty)
+set_print (const char *arg, int from_tty)
 {
   printf_unfiltered (
      "\"set print\" must be followed by the name of a print subcommand.\n");
@@ -3137,13 +3133,13 @@ set_print (char *arg, int from_tty)
 }
 
 static void
-show_print (char *args, int from_tty)
+show_print (const char *args, int from_tty)
 {
   cmd_show_list (showprintlist, from_tty, "");
 }
 
 static void
-set_print_raw (char *arg, int from_tty)
+set_print_raw (const char *arg, int from_tty)
 {
   printf_unfiltered (
      "\"set print raw\" must be followed by the name of a \"print raw\" subcommand.\n");
@@ -3151,7 +3147,7 @@ set_print_raw (char *arg, int from_tty)
 }
 
 static void
-show_print_raw (char *args, int from_tty)
+show_print_raw (const char *args, int from_tty)
 {
   cmd_show_list (showprintrawlist, from_tty, "");
 }
diff --git a/gdb/value.c b/gdb/value.c
index 90423ed002..7d0966c8fe 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2558,7 +2558,7 @@ call_internal_function (struct gdbarch *gdbarch,
    the implementation of the sub-command that is created when
    registering an internal function.  */
 static void
-function_command (char *command, int from_tty)
+function_command (const char *command, int from_tty)
 {
   /* Do nothing.  */
 }
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 98b6d2b932..698794fd19 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -444,7 +444,7 @@ show_maint_show_all_tib (struct ui_file *file, int from_tty,
 }
 
 static void
-info_w32_command (char *args, int from_tty)
+info_w32_command (const char *args, int from_tty)
 {
   help_list (info_w32_cmdlist, "info w32 ", class_info, gdb_stdout);
 }
-- 
2.13.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]