mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2025-01-20 07:54:19 +00:00
sim: constify arg to sim_do_command
It is rare for people to want to modify the cmd arg. In general, they really shouldn't be, but a few still do. For those who misbehave, dupe the string locally so they can bang on it.
This commit is contained in:
parent
61d1ce24e8
commit
60d847df0b
@ -1,3 +1,7 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* remote-sim.h (sim_do_command): Add const to cmd.
|
||||
|
||||
2014-03-05 Alan Modra <amodra@gmail.com>
|
||||
|
||||
Update copyright notice.
|
||||
|
@ -273,7 +273,7 @@ void sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc);
|
||||
Simulators should be prepared to deal with any combination of NULL
|
||||
or empty CMD. */
|
||||
|
||||
void sim_do_command (SIM_DESC sd, char *cmd);
|
||||
void sim_do_command (SIM_DESC sd, const char *cmd);
|
||||
|
||||
/* Complete a command based on the available sim commands. Returns an
|
||||
array of possible matches. */
|
||||
|
@ -1,3 +1,7 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* wrapper.c (sim_do_command): Add const to cmd.
|
||||
|
||||
2014-03-05 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* wrapper.c (sim_load): Add const to prog.
|
||||
|
@ -936,7 +936,7 @@ sim_stop_reason (sd, reason, sigrc)
|
||||
void
|
||||
sim_do_command (sd, cmd)
|
||||
SIM_DESC sd ATTRIBUTE_UNUSED;
|
||||
char *cmd ATTRIBUTE_UNUSED;
|
||||
const char *cmd ATTRIBUTE_UNUSED;
|
||||
{
|
||||
(*sim_callback->printf_filtered)
|
||||
(sim_callback,
|
||||
|
@ -1,3 +1,7 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_do_command): Add const to cmd.
|
||||
|
||||
2014-03-05 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_load): Add const to prog.
|
||||
|
@ -1831,7 +1831,7 @@ sim_kill (SIM_DESC sd)
|
||||
}
|
||||
|
||||
void
|
||||
sim_do_command (SIM_DESC sd, char *cmd)
|
||||
sim_do_command (SIM_DESC sd, const char *cmd)
|
||||
{
|
||||
/* Nothing there yet; it's all an error. */
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* sim-command.c (sim_do_command): Add const to cmd.
|
||||
* sim-options.c (sim_args_command): Add const to cmd.
|
||||
* sim-options.h (sim_args_command): Add const to cmd.
|
||||
|
||||
2014-03-05 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* sim-hload.c (sim_load): Add const to prog.
|
||||
|
@ -26,7 +26,7 @@
|
||||
which add custom options via sim_add_option_table(). */
|
||||
|
||||
void
|
||||
sim_do_command (SIM_DESC sd, char *cmd)
|
||||
sim_do_command (SIM_DESC sd, const char *cmd)
|
||||
{
|
||||
if (sim_args_command (sd, cmd) != SIM_RC_OK)
|
||||
sim_io_eprintf (sd, "Unknown sim command: \"%s\". Try \"sim help\".\n",
|
||||
|
@ -971,7 +971,7 @@ sim_complete_command (SIM_DESC sd, const char *text, const char *word)
|
||||
}
|
||||
|
||||
SIM_RC
|
||||
sim_args_command (SIM_DESC sd, char *cmd)
|
||||
sim_args_command (SIM_DESC sd, const char *cmd)
|
||||
{
|
||||
/* something to do? */
|
||||
if (cmd == NULL)
|
||||
|
@ -143,6 +143,6 @@ void sim_print_help (SIM_DESC sd, int is_command);
|
||||
|
||||
/* Try to parse the command as if it is an option, Only fail when
|
||||
totally unsuccessful */
|
||||
SIM_RC sim_args_command (SIM_DESC sd, char *cmd);
|
||||
SIM_RC sim_args_command (SIM_DESC sd, const char *cmd);
|
||||
|
||||
#endif /* SIM_OPTIONS_H */
|
||||
|
@ -1,3 +1,7 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_do_command): Add const to cmd.
|
||||
|
||||
2014-03-05 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_load): Add const to prog.
|
||||
|
@ -1561,7 +1561,7 @@ sim_complete_command (SIM_DESC sd, const char *text, const char *word)
|
||||
void
|
||||
sim_do_command (sd, cmd)
|
||||
SIM_DESC sd;
|
||||
char *cmd;
|
||||
const char *cmd;
|
||||
{
|
||||
(*cr16_callback->printf_filtered) (cr16_callback, "sim_do_command: %s\n",cmd);
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_do_command): Add const to cmd.
|
||||
|
||||
2014-03-05 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_load): Add const to prog.
|
||||
|
@ -1482,7 +1482,7 @@ sim_store_register (sd, rn, memory, length)
|
||||
void
|
||||
sim_do_command (sd, cmd)
|
||||
SIM_DESC sd;
|
||||
char *cmd;
|
||||
const char *cmd;
|
||||
{
|
||||
(*d10v_callback->printf_filtered) (d10v_callback, "sim_do_command: %s\n",cmd);
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interf.c (sim_do_command): Add const to cmd.
|
||||
|
||||
2014-03-05 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interf.c (sim_load): Add const to prog.
|
||||
|
@ -479,7 +479,7 @@ sim_trace (sd)
|
||||
void
|
||||
sim_do_command(sd, cmd)
|
||||
SIM_DESC sd;
|
||||
char *cmd;
|
||||
const char *cmd;
|
||||
{
|
||||
exec_cmd(&sregs, cmd);
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* gdb-if.c (sim_do_command): Add const to cmd. Move args
|
||||
to top and add const. Call strdup on cmd and free at end.
|
||||
|
||||
2014-03-05 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* gdb-if.c (sim_load): Add const to prog.
|
||||
|
@ -650,11 +650,12 @@ sim_stop_reason (SIM_DESC sd, enum sim_stop *reason_p, int *sigrc_p)
|
||||
}
|
||||
|
||||
void
|
||||
sim_do_command (SIM_DESC sd, char *cmd)
|
||||
sim_do_command (SIM_DESC sd, const char *cmd)
|
||||
{
|
||||
check_desc (sd);
|
||||
const char *args;
|
||||
char *p = strdup (cmd);
|
||||
|
||||
char *p = cmd;
|
||||
check_desc (sd);
|
||||
|
||||
/* Skip leading whitespace. */
|
||||
while (isspace (*p))
|
||||
@ -667,7 +668,6 @@ sim_do_command (SIM_DESC sd, char *cmd)
|
||||
|
||||
/* Null-terminate the command word, and record the start of any
|
||||
further arguments. */
|
||||
char *args;
|
||||
if (*p)
|
||||
{
|
||||
*p = '\0';
|
||||
@ -701,6 +701,8 @@ sim_do_command (SIM_DESC sd, char *cmd)
|
||||
else
|
||||
printf ("The 'sim' command expects either 'trace' or 'verbose'"
|
||||
" as a subcommand.\n");
|
||||
|
||||
free (p);
|
||||
}
|
||||
|
||||
char **
|
||||
|
@ -1,3 +1,7 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_do_command): Add const to cmd.
|
||||
|
||||
2014-03-05 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_load): Add const to prog.
|
||||
|
@ -2130,7 +2130,7 @@ sim_kill (sd)
|
||||
void
|
||||
sim_do_command (sd, cmd)
|
||||
SIM_DESC sd;
|
||||
char * cmd;
|
||||
const char *cmd;
|
||||
{
|
||||
/* Nothing there yet; it's all an error. */
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_do_command): Add const to cmd.
|
||||
|
||||
2014-03-05 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_load): Add const to prog.
|
||||
|
@ -1006,7 +1006,7 @@ sim_kill (SIM_DESC sd)
|
||||
}
|
||||
|
||||
void
|
||||
sim_do_command (SIM_DESC sd, char * cmd)
|
||||
sim_do_command (SIM_DESC sd, const char *cmd)
|
||||
{
|
||||
/* Nothing there yet; it's all an error. */
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_do_command): Add const to cmd.
|
||||
|
||||
2014-03-05 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_load): Add const to prog.
|
||||
|
@ -1350,7 +1350,7 @@ sim_kill (sd)
|
||||
void
|
||||
sim_do_command (sd, cmd)
|
||||
SIM_DESC sd;
|
||||
char * cmd;
|
||||
const char *cmd;
|
||||
{
|
||||
if (sim_args_command (sd, cmd) != SIM_RC_OK)
|
||||
sim_io_printf (sd,
|
||||
|
@ -1,3 +1,7 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* sim_calls.c (sim_do_command): Add const to cmd.
|
||||
|
||||
2014-03-05 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* sim_calls.c (sim_load): Add const to prog.
|
||||
|
@ -247,7 +247,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
|
||||
}
|
||||
|
||||
void
|
||||
sim_do_command (SIM_DESC sd, char *cmd)
|
||||
sim_do_command (SIM_DESC sd, const char *cmd)
|
||||
{
|
||||
TRACE(trace_gdb, ("sim_do_commands(cmd=%s) called\n",
|
||||
cmd ? cmd : "(null)"));
|
||||
|
@ -1,3 +1,8 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* gdb-if.c (sim_do_command): Add const to cmd. Move args
|
||||
to top and add const. Call strdup on cmd and free at end.
|
||||
|
||||
2014-03-05 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* gdb-if.c (sim_load): Add const to prog.
|
||||
|
@ -499,9 +499,10 @@ sim_stop_reason (SIM_DESC sd, enum sim_stop *reason_p, int *sigrc_p)
|
||||
command. */
|
||||
|
||||
void
|
||||
sim_do_command (SIM_DESC sd, char *cmd)
|
||||
sim_do_command (SIM_DESC sd, const char *cmd)
|
||||
{
|
||||
char *args;
|
||||
const char *args;
|
||||
char *p = strdup (cmd);
|
||||
|
||||
check_desc (sd);
|
||||
|
||||
@ -512,8 +513,6 @@ sim_do_command (SIM_DESC sd, char *cmd)
|
||||
}
|
||||
else
|
||||
{
|
||||
char *p = cmd;
|
||||
|
||||
/* Skip leading whitespace. */
|
||||
while (isspace (*p))
|
||||
p++;
|
||||
@ -561,6 +560,8 @@ sim_do_command (SIM_DESC sd, char *cmd)
|
||||
else
|
||||
printf ("The 'sim' command expects either 'trace' or 'verbose'"
|
||||
" as a subcommand.\n");
|
||||
|
||||
free (p);
|
||||
}
|
||||
|
||||
/* Stub for command completion. */
|
||||
|
@ -1,3 +1,8 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* gdb-if.c (sim_do_command): Add const to cmd. Move args
|
||||
to top and add const. Call strdup on cmd and free at end.
|
||||
|
||||
2014-03-05 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* gdb-if.c (sim_load): Add const to prog.
|
||||
|
@ -791,11 +791,12 @@ sim_stop_reason (SIM_DESC sd, enum sim_stop *reason_p, int *sigrc_p)
|
||||
}
|
||||
|
||||
void
|
||||
sim_do_command (SIM_DESC sd, char *cmd)
|
||||
sim_do_command (SIM_DESC sd, const char *cmd)
|
||||
{
|
||||
check_desc (sd);
|
||||
const char *args;
|
||||
char *p = strdup (cmd);
|
||||
|
||||
char *p = cmd;
|
||||
check_desc (sd);
|
||||
|
||||
/* Skip leading whitespace. */
|
||||
while (isspace (*p))
|
||||
@ -808,7 +809,6 @@ sim_do_command (SIM_DESC sd, char *cmd)
|
||||
|
||||
/* Null-terminate the command word, and record the start of any
|
||||
further arguments. */
|
||||
char *args;
|
||||
if (*p)
|
||||
{
|
||||
*p = '\0';
|
||||
@ -844,6 +844,8 @@ sim_do_command (SIM_DESC sd, char *cmd)
|
||||
else
|
||||
printf ("The 'sim' command expects either 'trace' or 'verbose'"
|
||||
" as a subcommand.\n");
|
||||
|
||||
free (p);
|
||||
}
|
||||
|
||||
char **
|
||||
|
@ -1,3 +1,8 @@
|
||||
2014-03-10 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (parse_and_set_memory_size): Add const to str.
|
||||
(sim_do_command): Add const to cmd and sms_cmd.
|
||||
|
||||
2014-03-05 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_load): Add const to prog.
|
||||
|
@ -473,7 +473,7 @@ int valid[16];
|
||||
#define UNDEF(x)
|
||||
#endif
|
||||
|
||||
static void parse_and_set_memory_size (char *str);
|
||||
static void parse_and_set_memory_size (const char *str);
|
||||
static int IOMEM (int addr, int write, int value);
|
||||
static struct loop_bounds get_loop_bounds (int, int, unsigned char *,
|
||||
unsigned char *, int, int);
|
||||
@ -2663,7 +2663,7 @@ sim_open (kind, cb, abfd, argv)
|
||||
|
||||
static void
|
||||
parse_and_set_memory_size (str)
|
||||
char *str;
|
||||
const char *str;
|
||||
{
|
||||
int n;
|
||||
|
||||
@ -2739,9 +2739,9 @@ sim_create_inferior (sd, prog_bfd, argv, env)
|
||||
void
|
||||
sim_do_command (sd, cmd)
|
||||
SIM_DESC sd;
|
||||
char *cmd;
|
||||
const char *cmd;
|
||||
{
|
||||
char *sms_cmd = "set-memory-size";
|
||||
const char *sms_cmd = "set-memory-size";
|
||||
int cmdsize;
|
||||
|
||||
if (cmd == NULL || *cmd == '\0')
|
||||
|
Loading…
x
Reference in New Issue
Block a user