aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-07-05 19:06:38 +0000
committerMike Frysinger <vapier@gentoo.org>2011-07-05 19:06:38 +0000
commit2419798b808521c666c29abc9b816154a979d69e (patch)
tree17bb3de27399d93aa661d0ad8622ef4a3bbc7564
parent52cb9dfed024ca2df3a1a7f7340e7faa07321db3 (diff)
sim: start a unified sim_do_command
Since sim_do_command for many people simply calls sim_args_command, start a unified version of it. For people who handle their own options, they could switch to this by using sim_add_option_table instead. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--sim/bfin/ChangeLog4
-rw-r--r--sim/bfin/interp.c7
-rw-r--r--sim/common/ChangeLog6
-rw-r--r--sim/common/Make-common.in4
-rw-r--r--sim/common/sim-command.c33
-rw-r--r--sim/cris/ChangeLog4
-rw-r--r--sim/cris/sim-if.c7
-rw-r--r--sim/frv/ChangeLog4
-rw-r--r--sim/frv/sim-if.c9
-rw-r--r--sim/h8300/ChangeLog4
-rw-r--r--sim/h8300/compile.c7
-rw-r--r--sim/iq2000/ChangeLog4
-rw-r--r--sim/iq2000/sim-if.c12
-rwxr-xr-xsim/lm32/ChangeLog4
-rw-r--r--sim/lm32/sim-if.c9
-rw-r--r--sim/m32r/ChangeLog4
-rw-r--r--sim/m32r/sim-if.c48
-rw-r--r--sim/m68hc11/ChangeLog4
-rw-r--r--sim/m68hc11/interp.c27
-rw-r--r--sim/mips/ChangeLog4
-rw-r--r--sim/mips/interp.c10
-rw-r--r--sim/mn10300/ChangeLog4
-rw-r--r--sim/mn10300/interp.c17
-rw-r--r--sim/sh64/ChangeLog4
-rw-r--r--sim/sh64/sim-if.c10
-rw-r--r--sim/v850/ChangeLog4
-rw-r--r--sim/v850/interp.c19
27 files changed, 91 insertions, 182 deletions
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index bb79cde2db..4d246bad02 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-05 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_do_command): Delete.
+
2011-07-01 Mike Frysinger <vapier@gentoo.org>
* interp.c (cb_linux_stat_map_32, cb_linux_stat_map_64): Rename from
diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c
index f22c378dc7..4e7a45c6dc 100644
--- a/sim/bfin/interp.c
+++ b/sim/bfin/interp.c
@@ -1256,10 +1256,3 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
return SIM_RC_OK;
}
-
-void
-sim_do_command (SIM_DESC sd, char *cmd)
-{
- if (sim_args_command (sd, cmd) != SIM_RC_OK)
- sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
-}
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 821248d123..f4f823188e 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,9 @@
+2011-07-05 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-command.c: New file.
+ * Make-common.in (SIM_NEW_COMMON_OBJS): Add sim-command.o.
+ (sim-command.o): New rule.
+
2011-05-27 Mike Frysinger <vapier@gentoo.org>
* sim-options.c (standard_option_handler): Remove arg[0] check
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 351f4a078e..42e31928fd 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -162,6 +162,7 @@ SIM_COMMON_HW_OBJS = \
SIM_NEW_COMMON_OBJS = \
sim-arange.o \
sim-bits.o \
+ sim-command.o \
sim-config.o \
sim-core.o \
sim-endian.o \
@@ -425,6 +426,9 @@ sim-bits.o: $(srccom)/sim-bits.c $(sim-bits_h) $(sim-n-bits_h) \
$(SIM_EXTRA_DEPS)
$(CC) -c $(srccom)/sim-bits.c $(ALL_CFLAGS)
+sim-command.o: $(srccom)/sim-command.c $(sim_main_headers)
+ $(CC) -c $(srccom)/sim-command.c $(ALL_CFLAGS)
+
sim-config.o: $(srccom)/sim-config.c $(sim-config_h) sim-main.h \
$(SIM_EXTRA_DEPS)
$(CC) -c $(srccom)/sim-config.c $(ALL_CFLAGS)
diff --git a/sim/common/sim-command.c b/sim/common/sim-command.c
new file mode 100644
index 0000000000..b6d0a19f09
--- /dev/null
+++ b/sim/common/sim-command.c
@@ -0,0 +1,33 @@
+/* Miscellaneous simulator utilities.
+
+ Copyright (C) 2005-2011 Free Software Foundation, Inc.
+ Contributed by Analog Devices, Inc.
+
+ This file is part of simulators.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "sim-main.h"
+#include "sim-utils.h"
+
+/* Generic implementation of sim_do_command that works with simulators
+ which add custom options via sim_add_option_table(). */
+
+void
+sim_do_command (SIM_DESC sd, char *cmd)
+{
+ if (sim_args_command (sd, cmd) != SIM_RC_OK)
+ sim_io_eprintf (sd, "Unknown sim command: \"%s\". Try \"sim help\".\n",
+ cmd);
+}
diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog
index d9fdf60b0d..7e3abca738 100644
--- a/sim/cris/ChangeLog
+++ b/sim/cris/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-05 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_do_command): Delete.
+
2010-10-09 Alan Modra <amodra@gmail.com>
* cris-desc.h: Regenerate.
diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c
index 9dc7e3459c..64a758cbc0 100644
--- a/sim/cris/sim-if.c
+++ b/sim/cris/sim-if.c
@@ -1094,13 +1094,6 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
return SIM_RC_OK;
}
-
-void
-sim_do_command (SIM_DESC sd, char *cmd)
-{
- if (sim_args_command (sd, cmd) != SIM_RC_OK)
- sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
-}
/* Disassemble an instruction. */
diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog
index b35c6595d8..987791bd4a 100644
--- a/sim/frv/ChangeLog
+++ b/sim/frv/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-05 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_do_command): Delete.
+
2010-04-21 Mike Frysinger <vapier@gentoo.org>
* profile.c (sim_profile_print_bar): Add cpu argument.
diff --git a/sim/frv/sim-if.c b/sim/frv/sim-if.c
index 2d1596565b..37cc23a98c 100644
--- a/sim/frv/sim-if.c
+++ b/sim/frv/sim-if.c
@@ -240,12 +240,3 @@ sim_create_inferior (sd, abfd, argv, envp)
return SIM_RC_OK;
}
-
-void
-sim_do_command (sd, cmd)
- SIM_DESC sd;
- char *cmd;
-{
- if (sim_args_command (sd, cmd) != SIM_RC_OK)
- sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
-}
diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog
index 81d9d01683..04278f8151 100644
--- a/sim/h8300/ChangeLog
+++ b/sim/h8300/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-05 Mike Frysinger <vapier@gentoo.org>
+
+ * compile.c (sim_do_command): Delete.
+
2011-01-11 Andrew Burgess <aburgess@broadcom.com>
* compile.c (sim_store_register): Update return value to
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index b249080dd8..7b4a5fad31 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -5108,13 +5108,6 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env)
}
void
-sim_do_command (SIM_DESC sd, char *cmd)
-{
- (*sim_callback->printf_filtered) (sim_callback,
- "This simulator does not accept any commands.\n");
-}
-
-void
sim_set_callbacks (struct host_callback_struct *ptr)
{
sim_callback = ptr;
diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog
index c25f903170..1459841357 100644
--- a/sim/iq2000/ChangeLog
+++ b/sim/iq2000/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-05 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_do_command): Delete.
+
2011-02-14 Mike Frysinger <vapier@gentoo.org>
* iq2000.c (do_syscall): Change zfree to free.
diff --git a/sim/iq2000/sim-if.c b/sim/iq2000/sim-if.c
index 0efae1aed7..e0ff86b2ec 100644
--- a/sim/iq2000/sim-if.c
+++ b/sim/iq2000/sim-if.c
@@ -189,15 +189,3 @@ sim_create_inferior (sd, abfd, argv, envp)
return SIM_RC_OK;
}
-
-void
-sim_do_command (sd, cmd)
- SIM_DESC sd;
- char *cmd;
-{
- if (sim_args_command (sd, cmd) != SIM_RC_OK)
- sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
-}
-
-
-
diff --git a/sim/lm32/ChangeLog b/sim/lm32/ChangeLog
index 5bb114e02c..2c3561641a 100755
--- a/sim/lm32/ChangeLog
+++ b/sim/lm32/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-05 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_do_command): Delete.
+
2010-02-11 Doug Evans <dje@sebabeach.org>
* cpu.h, * decode.c, * model.c, * sem-switch.c, * sem.c: Regenerate.
diff --git a/sim/lm32/sim-if.c b/sim/lm32/sim-if.c
index 6d3c734e71..d9bb219450 100644
--- a/sim/lm32/sim-if.c
+++ b/sim/lm32/sim-if.c
@@ -279,12 +279,3 @@ sim_create_inferior (sd, abfd, argv, envp)
return SIM_RC_OK;
}
-
-void
-sim_do_command (sd, cmd)
- SIM_DESC sd;
- char *cmd;
-{
- if (sim_args_command (sd, cmd) != SIM_RC_OK)
- sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
-}
diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog
index 4c4ca6cbb9..801149ab1d 100644
--- a/sim/m32r/ChangeLog
+++ b/sim/m32r/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-05 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_do_command): Delete.
+
2010-03-30 Mike Frysinger <vapier@gentoo.org>
* devices.c (device_error): Add const to message.
diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c
index 6235abd952..610bd859c5 100644
--- a/sim/m32r/sim-if.c
+++ b/sim/m32r/sim-if.c
@@ -256,51 +256,3 @@ print_m32r_misc_cpu (SIM_CPU *cpu, int verbose)
CPU_M32R_MISC_PROFILE (cpu)->parallel_count));
}
}
-
-void
-sim_do_command (sd, cmd)
- SIM_DESC sd;
- char *cmd;
-{
- char **argv;
-
- if (cmd == NULL)
- return;
-
- argv = buildargv (cmd);
-
- if (argv[0] != NULL
- && strcasecmp (argv[0], "info") == 0
- && argv[1] != NULL
- && strncasecmp (argv[1], "reg", 3) == 0)
- {
- SI val;
-
- /* We only support printing bbpsw,bbpc here as there is no equivalent
- functionality in gdb. */
- if (argv[2] == NULL)
- sim_io_eprintf (sd, "Missing register in `%s'\n", cmd);
- else if (argv[3] != NULL)
- sim_io_eprintf (sd, "Too many arguments in `%s'\n", cmd);
- else if (strcasecmp (argv[2], "bbpsw") == 0)
- {
- val = m32rbf_h_cr_get (STATE_CPU (sd, 0), H_CR_BBPSW);
- sim_io_printf (sd, "bbpsw 0x%x %d\n", val, val);
- }
- else if (strcasecmp (argv[2], "bbpc") == 0)
- {
- val = m32rbf_h_cr_get (STATE_CPU (sd, 0), H_CR_BBPC);
- sim_io_printf (sd, "bbpc 0x%x %d\n", val, val);
- }
- else
- sim_io_eprintf (sd, "Printing of register `%s' not supported with `sim info'\n",
- argv[2]);
- }
- else
- {
- if (sim_args_command (sd, cmd) != SIM_RC_OK)
- sim_io_eprintf (sd, "Unknown sim command `%s'\n", cmd);
- }
-
- freeargv (argv);
-}
diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index 295173ea80..fe2f74a21e 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-05 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_do_command): Delete.
+
2010-01-09 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* configure: Regenerate.
diff --git a/sim/m68hc11/interp.c b/sim/m68hc11/interp.c
index b4d17c3fd6..d391286d0f 100644
--- a/sim/m68hc11/interp.c
+++ b/sim/m68hc11/interp.c
@@ -711,33 +711,6 @@ sim_size (int s)
;
}
-void
-sim_do_command (SIM_DESC sd, char *cmd)
-{
- char *mm_cmd = "memory-map";
- char *int_cmd = "interrupt";
- sim_cpu *cpu;
-
- cpu = STATE_CPU (sd, 0);
- /* Commands available from GDB: */
- if (sim_args_command (sd, cmd) != SIM_RC_OK)
- {
- if (strncmp (cmd, "info", sizeof ("info") - 1) == 0)
- sim_get_info (sd, &cmd[4]);
- else if (strncmp (cmd, mm_cmd, strlen (mm_cmd) == 0))
- sim_io_eprintf (sd,
- "`memory-map' command replaced by `sim memory'\n");
- else if (strncmp (cmd, int_cmd, strlen (int_cmd)) == 0)
- sim_io_eprintf (sd, "`interrupt' command replaced by `sim watch'\n");
- else
- sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
- }
-
- /* If the architecture changed, re-configure. */
- if (STATE_ARCHITECTURE (sd) != cpu->cpu_configured_arch)
- sim_hw_configure (sd);
-}
-
/* Halt the simulator after just one instruction */
static void
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index b19991fb43..2f4a8d5ebc 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-05 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_do_command): Delete.
+
2011-02-14 Mike Frysinger <vapier@gentoo.org>
* dv-tx3904sio.c (tx3904sio_fifo_push): Change zfree to free.
diff --git a/sim/mips/interp.c b/sim/mips/interp.c
index 492ae604af..edd4250e22 100644
--- a/sim/mips/interp.c
+++ b/sim/mips/interp.c
@@ -1142,16 +1142,6 @@ sim_create_inferior (sd, abfd, argv,env)
return SIM_RC_OK;
}
-void
-sim_do_command (sd,cmd)
- SIM_DESC sd;
- char *cmd;
-{
- if (sim_args_command (sd, cmd) != SIM_RC_OK)
- sim_io_printf (sd, "Error: \"%s\" is not a valid MIPS simulator command.\n",
- cmd);
-}
-
/*---------------------------------------------------------------------------*/
/*-- Private simulator support interface ------------------------------------*/
/*---------------------------------------------------------------------------*/
diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index 1543b03cfb..beb4194bb6 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-05 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_do_command): Delete.
+
2011-06-20 Nick Clifton <nickc@redhat.com>
* am33.igen (sub Rm,Rn,Rd): Fix computation of carry flag.
diff --git a/sim/mn10300/interp.c b/sim/mn10300/interp.c
index 1230bf55cb..e06ae59079 100644
--- a/sim/mn10300/interp.c
+++ b/sim/mn10300/interp.c
@@ -328,23 +328,6 @@ sim_create_inferior (SIM_DESC sd,
return SIM_RC_OK;
}
-void
-sim_do_command (SIM_DESC sd, char *cmd)
-{
- char *mm_cmd = "memory-map";
- char *int_cmd = "interrupt";
-
- if (sim_args_command (sd, cmd) != SIM_RC_OK)
- {
- if (strncmp (cmd, mm_cmd, strlen (mm_cmd) == 0))
- sim_io_eprintf (sd, "`memory-map' command replaced by `sim memory'\n");
- else if (strncmp (cmd, int_cmd, strlen (int_cmd)) == 0)
- sim_io_eprintf (sd, "`interrupt' command replaced by `sim watch'\n");
- else
- sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
- }
-}
-
/* FIXME These would more efficient to use than load_mem/store_mem,
but need to be changed to use the memory map. */
diff --git a/sim/sh64/ChangeLog b/sim/sh64/ChangeLog
index cc7d5d94bc..ea8948d336 100644
--- a/sim/sh64/ChangeLog
+++ b/sim/sh64/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-05 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (sim_do_command): Delete.
+
2011-02-14 Mike Frysinger <vapier@gentoo.org>
* sh64.c (trap_handler): Change zfree to free.
diff --git a/sim/sh64/sim-if.c b/sim/sh64/sim-if.c
index 3c3ce6e606..b85f20cc9b 100644
--- a/sim/sh64/sim-if.c
+++ b/sim/sh64/sim-if.c
@@ -193,16 +193,6 @@ sim_create_inferior (sd, abfd, argv, envp)
return SIM_RC_OK;
}
-
-void
-sim_do_command (sd, cmd)
- SIM_DESC sd;
- char *cmd;
-{
- if (sim_args_command (sd, cmd) != SIM_RC_OK)
- sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
-}
-
/* Disassemble an instruction. */
diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog
index e548f7c16b..ca2aeb0bd1 100644
--- a/sim/v850/ChangeLog
+++ b/sim/v850/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-05 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_do_command): Delete.
+
2011-03-21 Kevin Buettner <kevinb@redhat.com>
* simops (OP_10007E0): Update errno handling as most traps
diff --git a/sim/v850/interp.c b/sim/v850/interp.c
index 21b587eeed..2c113072a2 100644
--- a/sim/v850/interp.c
+++ b/sim/v850/interp.c
@@ -329,22 +329,3 @@ sim_store_register (sd, rn, memory, length)
State.regs[rn] = T2H_4 (*(unsigned32*)memory);
return length;
}
-
-void
-sim_do_command (sd, cmd)
- SIM_DESC sd;
- char *cmd;
-{
- char *mm_cmd = "memory-map";
- char *int_cmd = "interrupt";
-
- if (sim_args_command (sd, cmd) != SIM_RC_OK)
- {
- if (strncmp (cmd, mm_cmd, strlen (mm_cmd) == 0))
- sim_io_eprintf (sd, "`memory-map' command replaced by `sim memory'\n");
- else if (strncmp (cmd, int_cmd, strlen (int_cmd)) == 0)
- sim_io_eprintf (sd, "`interrupt' command replaced by `sim watch'\n");
- else
- sim_io_eprintf (sd, "Unknown command `%s'\n", cmd);
- }
-}