aboutsummaryrefslogtreecommitdiff
path: root/sim/v850
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-09-12 02:44:03 +0000
committerAndrew Cagney <cagney@redhat.com>1997-09-12 02:44:03 +0000
commit93e7a1b5b74ce4e5a030378b5f39077aed9d0912 (patch)
tree7ba8a934d602cd9dae5417f8e943cfffe4ebe87e /sim/v850
parent11ac69e0139253d10771787a44adfecb9e4bef70 (diff)
downloadgdb-93e7a1b5b74ce4e5a030378b5f39077aed9d0912.zip
gdb-93e7a1b5b74ce4e5a030378b5f39077aed9d0912.tar.gz
gdb-93e7a1b5b74ce4e5a030378b5f39077aed9d0912.tar.bz2
Add profiling support to v850*.
Diffstat (limited to 'sim/v850')
-rw-r--r--sim/v850/ChangeLog11
-rw-r--r--sim/v850/Makefile.in10
-rw-r--r--sim/v850/interp.c12
-rw-r--r--sim/v850/sim-main.h8
4 files changed, 28 insertions, 13 deletions
diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog
index b330611..feab6ef 100644
--- a/sim/v850/ChangeLog
+++ b/sim/v850/ChangeLog
@@ -1,5 +1,16 @@
Thu Sep 11 08:40:03 1997 Andrew Cagney <cagney@b1.cygnus.com>
+ * interp.c (sim_open): Use sim_do_commandf instead of asprintf.
+
+ * sim-main.h (INSN_NAME):
+
+ * Makefile.in (INCLUDE): Add SIM_EXTRA_DEPS.
+ (SIM_EXTRA_DEPS): Add itable.h
+ (tmp-gencode): Does not depend on simops.h
+
+ * sim-main.h (itable.h): Include.
+ (MAX_INSNS, INSN_NAME): Define.
+
* interp.c: Compute inttype from the interrupt_names index that
was passed in.
diff --git a/sim/v850/Makefile.in b/sim/v850/Makefile.in
index f0c5521..cadd913 100644
--- a/sim/v850/Makefile.in
+++ b/sim/v850/Makefile.in
@@ -45,7 +45,7 @@ SIM_RUN_OBJS = nrun.o
# List of extra dependencies.
# Generally this consists of simulator specific files included by sim-main.h.
-SIM_EXTRA_DEPS = v850_sim.h sim-main.h simops.h
+SIM_EXTRA_DEPS = v850_sim.h sim-main.h simops.h itable.h
# List of flags to always pass to $(CC)
SIM_WARNINGS=@sim_warnings@
@@ -59,18 +59,18 @@ SIM_EXTRA_CFLAGS = \
$(SIM_HOSTENDIAN)
SIM_EXTRA_CLEAN = clean-extra
-INCLUDE = simops.h v850_sim.h sim-main.h $(srcdir)/../../include/callback.h
+INCLUDE = $(sim_main_headers) $(SIM_EXTRA_DEPS)
## COMMON_POST_CONFIG_FRAG
simops.h table.c: tmp-gencode
-tmp-gencode: gencode simops.h
+tmp-gencode: gencode
./gencode >tmp-table.c
mv tmp-table.c table.c
./gencode -h >tmp-simops.h
mv tmp-simops.h simops.h
touch tmp-gencode
-gencode.o: gencode.c $(INCLUDE)
+gencode.o: gencode.c
$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gencode.c
v850-opc.o: $(srcdir)/../../opcodes/v850-opc.c
$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $<
@@ -151,5 +151,5 @@ clean-extra: clean-igen
rm -f table.c simops.h gencode
#interp.o: interp.c table.c $(INCLUDE)
-simops.o: simops.c simops.h
+simops.o: simops.c $(INCLUDE)
#table.o: table.c
diff --git a/sim/v850/interp.c b/sim/v850/interp.c
index 753996f..485a15f 100644
--- a/sim/v850/interp.c
+++ b/sim/v850/interp.c
@@ -219,7 +219,6 @@ sim_open (kind, cb, abfd, argv)
struct _bfd *abfd;
char **argv;
{
- char *buf;
SIM_DESC sd = sim_state_alloc (kind, cb);
#if 0
struct simops *s;
@@ -239,14 +238,11 @@ sim_open (kind, cb, abfd, argv)
return 0;
/* Allocate core managed memory */
+
/* "Mirror" the ROM addresses below 1MB. */
- asprintf (&buf, "memory region 0,0x100000,0x%lx", V850_ROM_SIZE);
- sim_do_command (sd, buf);
- free (buf);
+ sim_do_commandf (sd, "memory region 0,0x100000,0x%lx", V850_ROM_SIZE);
/* Chunk of ram adjacent to rom */
- asprintf (&buf, "memory region 0x100000,0x%lx", V850_LOW_END - 0x100000);
- sim_do_command (sd, buf);
- free (buf);
+ sim_do_commandf (sd, "memory region 0x100000,0x%lx", V850_LOW_END-0x100000);
/* peripheral I/O region - mirror 1K across 4k (0x1000) */
sim_do_command (sd, "memory region 0xfff000,0x1000,1024");
/* similarly if in the internal RAM region */
@@ -394,7 +390,7 @@ sim_info (sd, verbose)
SIM_DESC sd;
int verbose;
{
- /* do nothing */
+ profile_print (sd, STATE_VERBOSE_P (sd), NULL, NULL);
}
SIM_RC
diff --git a/sim/v850/sim-main.h b/sim/v850/sim-main.h
index 52f3086..66e8995 100644
--- a/sim/v850/sim-main.h
+++ b/sim/v850/sim-main.h
@@ -1,3 +1,4 @@
+#define WITH_CORE
#define WITH_MODULO_MEMORY 1
#define WITH_WATCHPOINTS 1
#define WITH_TARGET_WORD_MSB 31
@@ -6,10 +7,17 @@
typedef address_word sim_cia;
+
/* This simulator doesn't cache state */
#define SIM_ENGINE_HALT_HOOK(sd,last_cpu,cia) while (0)
#define SIM_ENGINE_RESTART_HOOK(sd,last_cpu,cia) while (0)
+/* Get the number of instructions. FIXME: must be a more elegant way
+ of doing this. */
+#include "itable.h"
+#define MAX_INSNS (nr_itable_entries)
+#define INSN_NAME(i) itable[(i)].name
+
#include "sim-base.h"
typedef signed8 int8;