summaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-06-03 20:54:43 +0000
committerAndrew Cagney <cagney@redhat.com>2003-06-03 20:54:43 +0000
commit1684382a9110efd6523ce304cb99c869053323c8 (patch)
tree40364f6d12e4c278425f9de47c2f4e15c98e8076 /gdb/cli
parent2729fb2483899a9b69e0d73500c79373156f27a7 (diff)
downloadgdb-cvs/cagney_writestrings-20030508-branch.tar.gz
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-cmds.c58
-rw-r--r--gdb/cli/cli-cmds.h8
-rw-r--r--gdb/cli/cli-decode.c57
-rw-r--r--gdb/cli/cli-decode.h77
-rw-r--r--gdb/cli/cli-dump.c35
-rw-r--r--gdb/cli/cli-dump.h5
-rw-r--r--gdb/cli/cli-script.c24
-rw-r--r--gdb/cli/cli-script.h2
-rw-r--r--gdb/cli/cli-setshow.c2
-rw-r--r--gdb/cli/cli-setshow.h2
10 files changed, 139 insertions, 131 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 108329a50c7..fc7cf037d96 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -62,37 +62,37 @@ extern void show_commands (char *, int);
/* Prototypes for local command functions */
-static void complete_command (char *, int);
+static void complete_command (const char *, int);
-static void echo_command (char *, int);
+static void echo_command (const char *, int);
-static void pwd_command (char *, int);
+static void pwd_command (const char *, int);
static void show_version (char *, int);
static void validate_comname (char *);
-static void help_command (char *, int);
+static void help_command (const char *, int);
-static void show_command (char *, int);
+static void show_command (const char *, int);
-static void info_command (char *, int);
+static void info_command (const char *, int);
-static void show_debug (char *, int);
+static void show_debug (const char *, int);
-static void set_debug (char *, int);
+static void set_debug (const char *, int);
-static void show_user (char *, int);
+static void show_user (const char *, int);
-static void make_command (char *, int);
+static void make_command (const char *, int);
static void shell_escape (char *, int);
-static void edit_command (char *, int);
+static void edit_command (const char *, int);
-static void list_command (char *, int);
+static void list_command (const char *, int);
-void apropos_command (char *, int);
+void apropos_command (const char *, int);
/* Prototypes for local utility functions */
@@ -187,7 +187,7 @@ struct cmd_list_element *showchecklist;
none is supplied. */
void
-error_no_arg (char *why)
+error_no_arg (const char *why)
{
error ("Argument required (%s).", why);
}
@@ -197,7 +197,7 @@ error_no_arg (char *why)
/* ARGSUSED */
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");
help_list (infolist, "info ", -1, gdb_stdout);
@@ -207,7 +207,7 @@ info_command (char *arg, int from_tty)
/* ARGSUSED */
static void
-show_command (char *arg, int from_tty)
+show_command (const char *arg, int from_tty)
{
cmd_show_list (showlist, from_tty, "");
}
@@ -217,7 +217,7 @@ show_command (char *arg, int from_tty)
/* ARGSUSED */
static void
-help_command (char *command, int from_tty)
+help_command (const char *command, int from_tty)
{
help_cmd (command, gdb_stdout);
}
@@ -235,7 +235,7 @@ compare_strings (const void *arg1, const void *arg2)
/* ARGSUSED */
static void
-complete_command (char *arg, int from_tty)
+complete_command (const char *arg, int from_tty)
{
int i;
int argpoint;
@@ -299,7 +299,7 @@ show_version (char *args, int from_tty)
/* Handle the quit command. */
void
-quit_command (char *args, int from_tty)
+quit_command (const char *args, int from_tty)
{
if (!quit_confirm ())
error ("Not confirmed.");
@@ -308,7 +308,7 @@ quit_command (char *args, int from_tty)
/* ARGSUSED */
static void
-pwd_command (char *args, int from_tty)
+pwd_command (const char *args, int from_tty)
{
if (args)
error ("The \"pwd\" command does not take an argument: %s", args);
@@ -322,7 +322,7 @@ pwd_command (char *args, int from_tty)
}
void
-cd_command (char *dir, int from_tty)
+cd_command (const char *dir, int from_tty)
{
int len;
/* Found something other than leading repetitions of "/..". */
@@ -422,7 +422,7 @@ cd_command (char *dir, int from_tty)
}
void
-source_command (char *args, int from_tty)
+source_command (const char *args, int from_tty)
{
FILE *stream;
struct cleanup *old_cleanups;
@@ -452,7 +452,7 @@ source_command (char *args, int from_tty)
/* ARGSUSED */
static void
-echo_command (char *text, int from_tty)
+echo_command (const char *text, int from_tty)
{
char *p = text;
register int c;
@@ -543,7 +543,7 @@ shell_escape (char *arg, int from_tty)
}
static void
-edit_command (char *arg, int from_tty)
+edit_command (const char *arg, int from_tty)
{
struct symtabs_and_lines sals;
struct symtab_and_line sal;
@@ -648,7 +648,7 @@ edit_command (char *arg, int from_tty)
}
static void
-list_command (char *arg, int from_tty)
+list_command (const char *arg, int from_tty)
{
struct symtabs_and_lines sals, sals_end;
struct symtab_and_line sal, sal_end, cursal;
@@ -832,10 +832,10 @@ list_command (char *arg, int from_tty)
/* ARGSUSED */
static void
-disassemble_command (char *arg, int from_tty)
+disassemble_command (const char *arg, int from_tty)
{
CORE_ADDR low, high;
- char *name;
+ const char *name;
CORE_ADDR pc, pc_masked;
char *space_index;
#if 0
@@ -914,7 +914,7 @@ disassemble_command (char *arg, int from_tty)
}
static void
-make_command (char *arg, int from_tty)
+make_command (const char *arg, int from_tty)
{
char *p;
@@ -958,7 +958,7 @@ show_user (char *args, int from_tty)
regular expression.
*/
void
-apropos_command (char *searchstr, int from_tty)
+apropos_command (const char *searchstr, int from_tty)
{
extern struct cmd_list_element *cmdlist; /*This is the main command list*/
regex_t pattern;
diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h
index a6e574edd71..974565f0f5a 100644
--- a/gdb/cli/cli-cmds.h
+++ b/gdb/cli/cli-cmds.h
@@ -109,17 +109,17 @@ int is_complete_command (struct cmd_list_element *cmd);
/* Exported to gdb/main.c */
-extern void cd_command (char *, int);
+extern void cd_command (const char *, int);
/* Exported to gdb/top.c and gdb/main.c */
-extern void quit_command (char *, int);
+extern void quit_command (const char *, int);
-extern void source_command (char *, int);
+extern void source_command (const char *, int);
/* Used everywhere whenever at least one parameter is required and
none is specified. */
-extern NORETURN void error_no_arg (char *) ATTR_NORETURN;
+extern NORETURN void error_no_arg (const char *) ATTR_NORETURN;
#endif /* !defined (CLI_CMDS_H) */
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 2a6d196930e..d2fd03bfcae 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -130,8 +130,9 @@ set_cmd_completer (struct cmd_list_element *cmd,
of *LIST). */
struct cmd_list_element *
-add_cmd (char *name, enum command_class class, void (*fun) (char *, int),
- char *doc, struct cmd_list_element **list)
+add_cmd (const char *name, enum command_class class,
+ void (*fun) (const char *, int),
+ const char *doc, struct cmd_list_element **list)
{
register struct cmd_list_element *c
= (struct cmd_list_element *) xmalloc (sizeof (struct cmd_list_element));
@@ -187,7 +188,8 @@ add_cmd (char *name, enum command_class class, void (*fun) (char *, int),
/* Note: Doesn't seem to be used anywhere currently. */
struct cmd_list_element *
-add_abbrev_cmd (char *name, enum command_class class, void (*fun) (char *, int),
+add_abbrev_cmd (char *name, enum command_class class,
+ void (*fun) (const char *, int),
char *doc, struct cmd_list_element **list)
{
register struct cmd_list_element *c
@@ -221,11 +223,11 @@ deprecate_cmd (struct cmd_list_element *cmd, char *replacement)
}
struct cmd_list_element *
-add_alias_cmd (char *name, char *oldname, enum command_class class,
+add_alias_cmd (const char *name, const char *oldname, enum command_class class,
int abbrev_flag, struct cmd_list_element **list)
{
/* Must do this since lookup_cmd tries to side-effect its first arg */
- char *copied_name;
+ const char *copied_name;
register struct cmd_list_element *old;
register struct cmd_list_element *c;
copied_name = (char *) alloca (strlen (oldname) + 1);
@@ -256,9 +258,10 @@ add_alias_cmd (char *name, char *oldname, enum command_class class,
of the variable containing that list. */
struct cmd_list_element *
-add_prefix_cmd (char *name, enum command_class class, void (*fun) (char *, int),
- char *doc, struct cmd_list_element **prefixlist,
- char *prefixname, int allow_unknown,
+add_prefix_cmd (const char *name, enum command_class class,
+ void (*fun) (const char *, int),
+ const char *doc, struct cmd_list_element **prefixlist,
+ const char *prefixname, int allow_unknown,
struct cmd_list_element **list)
{
register struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
@@ -307,12 +310,12 @@ empty_sfunc (char *args, int from_tty, struct cmd_list_element *c)
DOC is the documentation string. */
static struct cmd_list_element *
-add_set_or_show_cmd (char *name,
+add_set_or_show_cmd (const char *name,
enum cmd_types type,
enum command_class class,
var_types var_type,
void *var,
- char *doc,
+ const char *doc,
struct cmd_list_element **list)
{
struct cmd_list_element *c = add_cmd (name, class, NULL, doc, list);
@@ -383,11 +386,11 @@ add_setshow_cmd (char *name,
}
struct cmd_list_element *
-add_set_cmd (char *name,
+add_set_cmd (const char *name,
enum command_class class,
var_types var_type,
void *var,
- char *doc,
+ const char *doc,
struct cmd_list_element **list)
{
return add_set_or_show_cmd (name, set_cmd, class, var_type, var, doc, list);
@@ -402,11 +405,11 @@ add_set_cmd (char *name,
DOC is the documentation string. */
struct cmd_list_element *
-add_set_enum_cmd (char *name,
+add_set_enum_cmd (const char *name,
enum command_class class,
const char *enumlist[],
const char **var,
- char *doc,
+ const char *doc,
struct cmd_list_element **list)
{
struct cmd_list_element *c
@@ -492,7 +495,7 @@ add_show_from_set (struct cmd_list_element *setcmd,
/* Remove the command named NAME from the command list. */
void
-delete_cmd (char *name, struct cmd_list_element **list)
+delete_cmd (const char *name, struct cmd_list_element **list)
{
register struct cmd_list_element *c;
struct cmd_list_element *p;
@@ -532,7 +535,7 @@ delete_cmd (char *name, struct cmd_list_element **list)
/* Add an element to the list of info subcommands. */
struct cmd_list_element *
-add_info (char *name, void (*fun) (char *, int), char *doc)
+add_info (const char *name, void (*fun) (char *, int), const char *doc)
{
return add_cmd (name, no_class, fun, doc, &infolist);
}
@@ -540,7 +543,7 @@ add_info (char *name, void (*fun) (char *, int), char *doc)
/* Add an alias to the list of info subcommands. */
struct cmd_list_element *
-add_info_alias (char *name, char *oldname, int abbrev_flag)
+add_info_alias (const char *name, const char *oldname, int abbrev_flag)
{
return add_alias_cmd (name, oldname, 0, abbrev_flag, &infolist);
}
@@ -548,8 +551,8 @@ add_info_alias (char *name, char *oldname, int abbrev_flag)
/* Add an element to the list of commands. */
struct cmd_list_element *
-add_com (char *name, enum command_class class, void (*fun) (char *, int),
- char *doc)
+add_com (const char *name, enum command_class class, void (*fun) (char *, int),
+ const char *doc)
{
return add_cmd (name, class, fun, doc, &cmdlist);
}
@@ -557,7 +560,7 @@ add_com (char *name, enum command_class class, void (*fun) (char *, int),
/* Add an alias or abbreviation command to the list of commands. */
struct cmd_list_element *
-add_com_alias (char *name, char *oldname, enum command_class class,
+add_com_alias (const char *name, const char *oldname, enum command_class class,
int abbrev_flag)
{
return add_alias_cmd (name, oldname, class, abbrev_flag, &cmdlist);
@@ -569,7 +572,7 @@ add_com_alias (char *name, char *oldname, enum command_class class,
*/
void
apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
- struct re_pattern_buffer *regex, char *prefix)
+ struct re_pattern_buffer *regex, const char *prefix)
{
register struct cmd_list_element *c;
int returnvalue=1; /*Needed to avoid double printing*/
@@ -705,7 +708,7 @@ help_cmd (char *command, struct ui_file *stream)
* If you call this routine with a class >= 0, it recurses.
*/
void
-help_list (struct cmd_list_element *list, char *cmdtype,
+help_list (struct cmd_list_element *list, const char *cmdtype,
enum command_class class, struct ui_file *stream)
{
int len;
@@ -776,11 +779,11 @@ help_all (struct ui_file *stream)
/* Print only the first line of STR on STREAM. */
void
-print_doc_line (struct ui_file *stream, char *str)
+print_doc_line (struct ui_file *stream, const char *str)
{
static char *line_buffer = 0;
static int line_size;
- register char *p;
+ const char *p;
if (!line_buffer)
{
@@ -822,7 +825,7 @@ print_doc_line (struct ui_file *stream, char *str)
*/
void
help_cmd_list (struct cmd_list_element *list, enum command_class class,
- char *prefix, int recurse, struct ui_file *stream)
+ const char *prefix, int recurse, struct ui_file *stream)
{
register struct cmd_list_element *c;
@@ -1046,7 +1049,7 @@ lookup_cmd_1 (char **text, struct cmd_list_element *clist,
/* All this hair to move the space to the front of cmdtype */
static void
-undef_cmd_error (char *cmdtype, char *q)
+undef_cmd_error (const char *cmdtype, char *q)
{
error ("Undefined %scommand: \"%s\". Try \"help%s%.*s\".",
cmdtype,
@@ -1109,7 +1112,7 @@ lookup_cmd (char **line, struct cmd_list_element *list, char *cmdtype,
values. */
int local_allow_unknown = (last_list ? last_list->allow_unknown :
allow_unknown);
- char *local_cmdtype = last_list ? last_list->prefixname : cmdtype;
+ const char *local_cmdtype = last_list ? last_list->prefixname : cmdtype;
struct cmd_list_element *local_list =
(last_list ? *(last_list->prefixlist) : list);
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index d8ab67d49f0..a80298ef0bb 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -56,7 +56,7 @@ struct cmd_list_element
struct cmd_list_element *next;
/* Name of this command. */
- char *name;
+ const char *name;
/* Command class; class values are chosen by application program. */
enum command_class class;
@@ -86,7 +86,7 @@ struct cmd_list_element
First line is brief documentation; remaining lines form, with it,
the full documentation. First line should end with a period.
Entire string should also end with a period, not a newline. */
- char *doc;
+ const char *doc;
/* flags : a bitfield
@@ -136,7 +136,7 @@ struct cmd_list_element
plus any others needed to get to it. Should end in a space.
It is used before the word "command" in describing the
commands reached through this prefix. */
- char *prefixname;
+ const char *prefixname;
/* For prefix commands only:
nonzero means do not get an error if subcommand is not
@@ -195,24 +195,27 @@ struct cmd_list_element
/* API to the manipulation of command lists. */
-extern struct cmd_list_element *add_cmd (char *, enum command_class,
- void (*fun) (char *, int), char *,
+extern struct cmd_list_element *add_cmd (const char *, enum command_class,
+ void (*fun) (const char *, int),
+ const char *,
struct cmd_list_element **);
-extern struct cmd_list_element *add_alias_cmd (char *, char *,
+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_prefix_cmd (char *, enum command_class,
- void (*fun) (char *, int),
- char *,
+extern struct cmd_list_element *add_prefix_cmd (const char *,
+ enum command_class,
+ void (*fun) (const char *,
+ int),
+ const char *,
struct cmd_list_element **,
- char *, int,
+ const char *, int,
struct cmd_list_element **);
extern struct cmd_list_element *add_abbrev_prefix_cmd (char *,
enum command_class,
- void (*fun) (char *,
+ void (*fun) (const char *,
int),
char *,
struct cmd_list_element
@@ -223,10 +226,10 @@ extern struct cmd_list_element *add_abbrev_prefix_cmd (char *,
/* Set the commands corresponding callback. */
extern void set_cmd_cfunc (struct cmd_list_element *cmd,
- void (*cfunc) (char *args, int from_tty));
+ void (*cfunc) (const char *args, int from_tty));
extern void set_cmd_sfunc (struct cmd_list_element *cmd,
- void (*sfunc) (char *args, int from_tty,
+ void (*sfunc) (const char *args, int from_tty,
struct cmd_list_element * c));
extern void set_cmd_completer (struct cmd_list_element *cmd,
@@ -235,13 +238,12 @@ extern void set_cmd_completer (struct cmd_list_element *cmd,
/* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs
around in cmd objects to test the value of the commands sfunc(). */
extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
- void (*cfunc) (char *args, int from_tty));
-
+ void (*cfunc) (const char *args, int from_tty));
/* Access to the command's local context. */
extern void set_cmd_context (struct cmd_list_element *cmd, void *context);
extern void *get_cmd_context (struct cmd_list_element *cmd);
-extern struct cmd_list_element *lookup_cmd (char **,
+extern struct cmd_list_element *lookup_cmd (const char **,
struct cmd_list_element *, char *,
int, int);
@@ -253,46 +255,47 @@ extern struct cmd_list_element *lookup_cmd_1 (char **,
extern struct cmd_list_element *
deprecate_cmd (struct cmd_list_element *, char * );
-extern void
- deprecated_cmd_warning (char **);
+extern void deprecated_cmd_warning (const char **);
-extern int
- lookup_cmd_composition (char *text,
- struct cmd_list_element **alias,
- struct cmd_list_element **prefix_cmd,
- struct cmd_list_element **cmd);
+extern int lookup_cmd_composition (const char *text,
+ struct cmd_list_element **alias,
+ struct cmd_list_element **prefix_cmd,
+ struct cmd_list_element **cmd);
-extern struct cmd_list_element *add_com (char *, enum command_class,
- void (*fun) (char *, int), char *);
+extern struct cmd_list_element *add_com (const char *, enum command_class,
+ void (*fun) (const char *, int),
+ const char *);
-extern struct cmd_list_element *add_com_alias (char *, char *,
+extern struct cmd_list_element *add_com_alias (const char *, const char *,
enum command_class, int);
-extern struct cmd_list_element *add_info (char *, void (*fun) (char *, int),
- char *);
+extern struct cmd_list_element *add_info (const char *,
+ void (*fun) (const char *, int),
+ const char *);
-extern struct cmd_list_element *add_info_alias (char *, char *, int);
+extern struct cmd_list_element *add_info_alias (const char *, const char *,
+ int);
extern char **complete_on_cmdlist (struct cmd_list_element *, char *, char *);
extern char **complete_on_enum (const char *enumlist[], char *, char *);
-extern void delete_cmd (char *, struct cmd_list_element **);
+extern void delete_cmd (const char *, struct cmd_list_element **);
extern void help_cmd_list (struct cmd_list_element *, enum command_class,
- char *, int, struct ui_file *);
+ const char *, int, struct ui_file *);
-extern struct cmd_list_element *add_set_cmd (char *name, enum
+extern struct cmd_list_element *add_set_cmd (const char *name, enum
command_class class,
var_types var_type, void *var,
- char *doc,
+ const char *doc,
struct cmd_list_element **list);
-extern struct cmd_list_element *add_set_enum_cmd (char *name,
+extern struct cmd_list_element *add_set_enum_cmd (const char *name,
enum command_class class,
const char *enumlist[],
const char **var,
- char *doc,
+ const char *doc,
struct cmd_list_element **list);
extern struct cmd_list_element *add_show_from_set (struct cmd_list_element *,
@@ -313,11 +316,11 @@ extern void apropos_cmd (struct ui_file *, struct cmd_list_element *,
function field NULL, the command is interpreted as a help topic, or
as a class of commands. */
-extern void not_just_help_class_command (char *arg, int from_tty);
+extern void not_just_help_class_command (const char *arg, int from_tty);
/* Exported to cli/cli-setshow.c */
-extern void print_doc_line (struct ui_file *, char *);
+extern void print_doc_line (struct ui_file *, const char *);
#endif /* !defined (CLI_DECODE_H) */
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 6bd40e033b1..367a7e6cba0 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -82,8 +82,8 @@ make_cleanup_fclose (FILE *file)
return make_cleanup (do_fclose_cleanup, file);
}
-char *
-scan_filename_with_cleanup (char **cmd, const char *defname)
+const char *
+scan_filename_with_cleanup (const char **cmd, const char *defname)
{
char *filename;
char *fullname;
@@ -178,14 +178,14 @@ struct cmd_list_element *binary_dump_cmdlist;
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 ", -1, 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 ", -1, gdb_stdout);
@@ -223,7 +223,7 @@ dump_bfd_file (char *filename, char *mode,
}
static void
-dump_memory_to_file (char *cmd, char *mode, char *file_format)
+dump_memory_to_file (const char *cmd, char *mode, char *file_format)
{
struct cleanup *old_cleanups = make_cleanup (null_cleanup, NULL);
CORE_ADDR lo;
@@ -274,13 +274,13 @@ dump_memory_to_file (char *cmd, char *mode, char *file_format)
}
static void
-dump_memory_command (char *cmd, char *mode)
+dump_memory_command (const char *cmd, char *mode)
{
dump_memory_to_file (cmd, mode, "binary");
}
static void
-dump_value_to_file (char *cmd, char *mode, char *file_format)
+dump_value_to_file (const char *cmd, char *mode, char *file_format)
{
struct cleanup *old_cleanups = make_cleanup (null_cleanup, NULL);
struct value *val;
@@ -325,7 +325,7 @@ dump_value_to_file (char *cmd, char *mode, char *file_format)
}
static void
-dump_value_command (char *cmd, char *mode)
+dump_value_command (const char *cmd, char *mode)
{
dump_value_to_file (cmd, mode, "binary");
}
@@ -422,19 +422,20 @@ append_binary_value (char *args, int from_tty)
struct dump_context
{
- void (*func) (char *cmd, char *mode);
+ void (*func) (const char *cmd, char *mode);
char *mode;
};
static void
-call_dump_func (struct cmd_list_element *c, char *args, int from_tty)
+call_dump_func (struct cmd_list_element *c, const char *args, int from_tty)
{
struct dump_context *d = get_cmd_context (c);
d->func (args, d->mode);
}
void
-add_dump_command (char *name, void (*func) (char *args, char *mode),
+add_dump_command (const char *name,
+ void (*func) (const char *args, char *mode),
char *descr)
{
@@ -596,7 +597,7 @@ restore_binary_file (char *filename, struct callback_data *data)
}
static void
-restore_command (char *args, int from_tty)
+restore_command (const char *args, int from_tty)
{
char *filename;
struct callback_data data;
@@ -664,35 +665,35 @@ restore_command (char *args, 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 ", -1, 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 ", -1, 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 ", -1, 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 ", -1, 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 ", -1, gdb_stdout);
diff --git a/gdb/cli/cli-dump.h b/gdb/cli/cli-dump.h
index 187e0e0a12e..afeee3215c3 100644
--- a/gdb/cli/cli-dump.h
+++ b/gdb/cli/cli-dump.h
@@ -23,11 +23,12 @@
#define CLI_DUMP_H
extern void add_dump_command (char *name,
- void (*func) (char *args, char *mode),
+ void (*func) (const char *args, char *mode),
char *descr);
/* Utilities for doing the dump. */
-extern char *scan_filename_with_cleanup (char **cmd, const char *defname);
+extern const char *scan_filename_with_cleanup (const char **cmd,
+ const char *defname);
extern char *scan_expression_with_cleanup (char **cmd, const char *defname);
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index d68c365959d..3911497ba51 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -52,7 +52,7 @@ static char *insert_args (char *line);
static struct cleanup * setup_user_args (char *p);
-static void validate_comname (char *);
+static void validate_comname (const char *);
/* Level of control structure. */
static int control_level;
@@ -80,7 +80,7 @@ struct user_args
control commands (if/while). */
static struct command_line *
-build_command_line (enum command_control_type type, char *args)
+build_command_line (enum command_control_type type, const char *args)
{
struct command_line *cmd;
@@ -446,7 +446,7 @@ execute_control_command (struct command_line *cmd)
loop condition is nonzero. */
void
-while_command (char *arg, int from_tty)
+while_command (const char *arg, int from_tty)
{
struct command_line *command = NULL;
@@ -464,7 +464,7 @@ while_command (char *arg, int from_tty)
on the value of the if conditional. */
void
-if_command (char *arg, int from_tty)
+if_command (const char *arg, int from_tty)
{
struct command_line *command = NULL;
@@ -1044,9 +1044,9 @@ copy_command_lines (struct command_line *cmds)
}
static void
-validate_comname (char *comname)
+validate_comname (const char *comname)
{
- register char *p;
+ const char *p;
if (comname == 0)
error_no_arg ("name of command to define");
@@ -1062,12 +1062,12 @@ validate_comname (char *comname)
/* This is just a placeholder in the command data structures. */
static void
-user_defined_command (char *ignore, int from_tty)
+user_defined_command (const char *ignore, int from_tty)
{
}
void
-define_command (char *comname, int from_tty)
+define_command (const char *comname, int from_tty)
{
#define MAX_TMPBUF 128
enum cmd_hook_type
@@ -1178,11 +1178,11 @@ define_command (char *comname, int from_tty)
}
void
-document_command (char *comname, int from_tty)
+document_command (const char *comname, int from_tty)
{
struct command_line *doclines;
register struct cmd_list_element *c;
- char *tem = comname;
+ const char *tem = comname;
char tmpbuf[128];
validate_comname (comname);
@@ -1223,8 +1223,8 @@ struct source_cleanup_lines_args
{
int old_line;
char *old_file;
- char *old_pre_error;
- char *old_error_pre_print;
+ const char *old_pre_error;
+ const char *old_error_pre_print;
};
static void
diff --git a/gdb/cli/cli-script.h b/gdb/cli/cli-script.h
index 03cb84137e5..8f1c441ef1c 100644
--- a/gdb/cli/cli-script.h
+++ b/gdb/cli/cli-script.h
@@ -27,7 +27,7 @@ struct cmd_list_element;
extern void script_from_file (FILE *stream, char *file);
-extern void document_command (char *, int);
+extern void document_command (const char *, int);
extern void define_command (char *, int);
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 1d68ae4aa1a..4403021053e 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -351,7 +351,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
/* Show all the settings in a list of show commands. */
void
-cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix)
+cmd_show_list (struct cmd_list_element *list, int from_tty, const char *prefix)
{
struct cleanup *showlist_chain;
diff --git a/gdb/cli/cli-setshow.h b/gdb/cli/cli-setshow.h
index 470b8b754c6..f94924691eb 100644
--- a/gdb/cli/cli-setshow.h
+++ b/gdb/cli/cli-setshow.h
@@ -33,6 +33,6 @@ extern void do_setshow_command (char *arg, int from_tty,
/* Exported to cli/cli-cmds.c and gdb/top.c, language.c and valprint.c */
extern void cmd_show_list (struct cmd_list_element *list, int from_tty,
- char *prefix);
+ const char *prefix);
#endif /* !defined (CLI_SETSHOW_H) */