aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-cmds.c48
-rw-r--r--gdb/cli/cli-cmds.h2
-rw-r--r--gdb/cli/cli-decode.c3
-rw-r--r--gdb/cli/cli-dump.c3
-rw-r--r--gdb/cli/cli-script.c34
5 files changed, 33 insertions, 57 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index a8edb13..be022d3 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -58,24 +58,6 @@
#include <algorithm>
#include <string>
-/* Prototypes for local command functions */
-
-static void complete_command (char *, int);
-
-static void echo_command (char *, int);
-
-static void pwd_command (char *, int);
-
-static void help_command (char *, int);
-
-static void make_command (char *, int);
-
-static void shell_escape (const char *, int);
-
-static void edit_command (char *, int);
-
-static void list_command (char *, int);
-
/* Prototypes for local utility functions */
static void print_sal_location (const symtab_and_line &sal);
@@ -238,7 +220,7 @@ show_command (char *arg, int from_tty)
is ignored. */
static void
-help_command (char *command, int from_tty)
+help_command (const char *command, int from_tty)
{
help_cmd (command, gdb_stdout);
}
@@ -248,10 +230,8 @@ help_command (char *command, int from_tty)
[Is that why this function writes output with *_unfiltered?] */
static void
-complete_command (char *arg_entry, int from_tty)
+complete_command (const char *arg, int from_tty)
{
- const char *arg = arg_entry;
-
dont_repeat ();
if (max_completions == 0)
@@ -356,7 +336,7 @@ show_configuration (const 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)
{
int exit_code = 0;
@@ -378,7 +358,7 @@ quit_command (char *args, int from_tty)
}
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);
@@ -693,7 +673,7 @@ source_command (const char *args, int from_tty)
static void
-echo_command (char *text, int from_tty)
+echo_command (const char *text, int from_tty)
{
const char *p = text;
int c;
@@ -785,13 +765,13 @@ shell_escape (const char *arg, int from_tty)
/* Implementation of the "shell" command. */
static void
-shell_command (char *arg, int from_tty)
+shell_command (const char *arg, int from_tty)
{
shell_escape (arg, from_tty);
}
static void
-edit_command (char *arg, int from_tty)
+edit_command (const char *arg, int from_tty)
{
struct symtab_and_line sal;
struct symbol *sym;
@@ -891,7 +871,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 symbol *sym;
const char *arg1;
@@ -899,7 +879,7 @@ list_command (char *arg, int from_tty)
int dummy_end = 0;
int dummy_beg = 0;
int linenum_beg = 0;
- char *p;
+ const char *p;
/* Pull in the current default source line if necessary. */
if (arg == NULL || ((arg[0] == '+' || arg[0] == '-') && arg[1] == '\0'))
@@ -1205,7 +1185,7 @@ disassemble_current_function (gdb_disassembly_flags flags)
2) File names and contents for all relevant source files are displayed. */
static void
-disassemble_command (char *arg, int from_tty)
+disassemble_command (const char *arg, int from_tty)
{
struct gdbarch *gdbarch = get_current_arch ();
CORE_ADDR low, high;
@@ -1295,7 +1275,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)
{
if (arg == 0)
shell_escape ("make", from_tty);
@@ -1336,7 +1316,7 @@ show_user (const char *args, int from_tty)
regular expression. */
static void
-apropos_command (char *searchstr, int from_tty)
+apropos_command (const char *searchstr, int from_tty)
{
if (searchstr == NULL)
error (_("REGEXP string is empty"));
@@ -1405,11 +1385,11 @@ alias_usage_error (void)
/* Make an alias of an existing command. */
static void
-alias_command (char *args, int from_tty)
+alias_command (const char *args, int from_tty)
{
int i, alias_argc, command_argc;
int abbrev_flag = 0;
- char *equals;
+ const char *equals;
const char *alias, *command;
if (args == NULL || strchr (args, '=') == NULL)
diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h
index 34d19f5..14fc931 100644
--- a/gdb/cli/cli-cmds.h
+++ b/gdb/cli/cli-cmds.h
@@ -114,7 +114,7 @@ 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_script (const char *, int);
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 76be7d3..e9baf38 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -931,7 +931,8 @@ add_info_alias (const char *name, const char *oldname, int abbrev_flag)
/* Add an element to the list of commands. */
struct cmd_list_element *
-add_com (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
+add_com (const char *name, enum command_class theclass,
+ cmd_const_cfunc_ftype *fun,
const char *doc)
{
return add_cmd (name, theclass, fun, doc, &cmdlist);
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 4eafffa..3443299 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -513,12 +513,11 @@ restore_binary_file (const char *filename, struct callback_data *data)
}
static void
-restore_command (char *args_in, int from_tty)
+restore_command (const char *args, int from_tty)
{
struct callback_data data;
bfd *ibfd;
int binary_flag = 0;
- const char *args = args_in;
if (!target_has_execution)
noprocess ();
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index bbdfa40..b06dbc2 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -673,7 +673,7 @@ execute_control_command_untraced (struct command_line *cmd)
loop condition is nonzero. */
static void
-while_command (char *arg, int from_tty)
+while_command (const char *arg, int from_tty)
{
control_level = 1;
command_line_up command = get_command_line (while_control, arg);
@@ -690,7 +690,7 @@ while_command (char *arg, int from_tty)
on the value of the if conditional. */
static void
-if_command (char *arg, int from_tty)
+if_command (const char *arg, int from_tty)
{
control_level = 1;
command_line_up command = get_command_line (if_control, arg);
@@ -1366,10 +1366,10 @@ copy_command_lines (struct command_line *cmds)
prefix. */
static struct cmd_list_element **
-validate_comname (char **comname)
+validate_comname (const char **comname)
{
struct cmd_list_element **list = &cmdlist;
- char *p, *last_word;
+ const char *p, *last_word;
if (*comname == 0)
error_no_arg (_("name of command to define"));
@@ -1386,19 +1386,16 @@ validate_comname (char **comname)
if (last_word != *comname)
{
struct cmd_list_element *c;
- char saved_char;
- const char *tem = *comname;
/* Separate the prefix and the command. */
- saved_char = last_word[-1];
- last_word[-1] = '\0';
+ std::string prefix (*comname, last_word - 1);
+ const char *tem = prefix.c_str ();
c = lookup_cmd (&tem, cmdlist, "", 0, 1);
if (c->prefixlist == NULL)
- error (_("\"%s\" is not a prefix command."), *comname);
+ error (_("\"%s\" is not a prefix command."), prefix.c_str ());
list = c->prefixlist;
- last_word[-1] = saved_char;
*comname = last_word;
}
@@ -1420,7 +1417,7 @@ user_defined_command (const char *ignore, int from_tty)
}
static void
-define_command (char *comname, int from_tty)
+define_command (const char *comname, int from_tty)
{
#define MAX_TMPBUF 128
enum cmd_hook_type
@@ -1430,8 +1427,7 @@ define_command (char *comname, int from_tty)
CMD_POST_HOOK
};
struct cmd_list_element *c, *newc, *hookc = 0, **list;
- char *tem, *comfull;
- const char *tem_c;
+ const char *tem, *comfull;
char tmpbuf[MAX_TMPBUF];
int hook_type = CMD_NO_HOOK;
int hook_name_size = 0;
@@ -1445,8 +1441,8 @@ define_command (char *comname, int from_tty)
list = validate_comname (&comname);
/* Look it up, and verify that we got an exact match. */
- tem_c = comname;
- c = lookup_cmd (&tem_c, *list, "", -1, 1);
+ tem = comname;
+ c = lookup_cmd (&tem, *list, "", -1, 1);
if (c && strcmp (comname, c->name) != 0)
c = 0;
@@ -1480,8 +1476,8 @@ define_command (char *comname, int from_tty)
if (hook_type != CMD_NO_HOOK)
{
/* Look up cmd it hooks, and verify that we got an exact match. */
- tem_c = comname + hook_name_size;
- hookc = lookup_cmd (&tem_c, *list, "", -1, 0);
+ tem = comname + hook_name_size;
+ hookc = lookup_cmd (&tem, *list, "", -1, 0);
if (hookc && strcmp (comname + hook_name_size, hookc->name) != 0)
hookc = 0;
if (!hookc)
@@ -1531,11 +1527,11 @@ define_command (char *comname, int from_tty)
}
static void
-document_command (char *comname, int from_tty)
+document_command (const char *comname, int from_tty)
{
struct cmd_list_element *c, **list;
const char *tem;
- char *comfull;
+ const char *comfull;
char tmpbuf[128];
comfull = comname;