summaryrefslogtreecommitdiff
path: root/sim/mips
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-03-22 23:10:09 -0400
committerMike Frysinger <vapier@gentoo.org>2015-11-15 02:30:19 -0500
commit6e4f085c7f459e0777a71bcb61ed3aa8257fa386 (patch)
treee2d1bc33b00d55f6765b8cc8cebb41b4cda7cb81 /sim/mips
parent1bd1b714219e1c8324cc2fb5feb4496e80b6adfd (diff)
downloadbinutils-gdb-6e4f085c7f459e0777a71bcb61ed3aa8257fa386.tar.gz
sim: sim-close: unify sim_close logic
Other than the nice advantage of all sims having to declare one fewer common function, this also fixes leakage in pretty much every sim. Many were not freeing any resources, and a few were inconsistent as to the ones they did. Now we have a single module that takes care of all the logic for us. Most of the non-cgen based ones could be deleted outright. The cgen ones required adding a callback to the arch-specific cleanup func. The few that still have close callbacks are to manage their internal state. We do not convert erc32, m32c, ppc, rl78, or rx as they do not use the common sim core.
Diffstat (limited to 'sim/mips')
-rw-r--r--sim/mips/ChangeLog8
-rw-r--r--sim/mips/interp.c21
-rw-r--r--sim/mips/sim-main.h2
3 files changed, 11 insertions, 20 deletions
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index 2865266135c..149abb1eabe 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,11 @@
+2015-11-14 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_close): Rename to ...
+ (mips_sim_close): ... this. Delete calls to sim_module_uninstall and
+ sim_io_shutdown.
+ * sim-main.h (mips_sim_close): Declare.
+ (SIM_CLOSE_HOOK): Define.
+
2015-09-25 Andrew Bennett <andrew.bennett@imgtec.com>
Ali Lown <ali.lown@imgtec.com>
diff --git a/sim/mips/interp.c b/sim/mips/interp.c
index 9dc896434f8..8a584d3cd24 100644
--- a/sim/mips/interp.c
+++ b/sim/mips/interp.c
@@ -834,34 +834,15 @@ get_insn_name (sim_cpu *cpu, int i)
}
void
-sim_close (SIM_DESC sd, int quitting)
+mips_sim_close (SIM_DESC sd, int quitting)
{
-#ifdef DEBUG
- printf("DBG: sim_close: entered (quitting = %d)\n",quitting);
-#endif
-
-
- /* "quitting" is non-zero if we cannot hang on errors */
-
- /* shut down modules */
- sim_module_uninstall (sd);
-
- /* Ensure that any resources allocated through the callback
- mechanism are released: */
- sim_io_shutdown (sd);
-
#if WITH_TRACE_ANY_P
if (tracefh != NULL && tracefh != stderr)
fclose(tracefh);
tracefh = NULL;
#endif
-
- /* FIXME - free SD */
-
- return;
}
-
int
sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size)
{
diff --git a/sim/mips/sim-main.h b/sim/mips/sim-main.h
index 42d8db37c4b..adf60c7885c 100644
--- a/sim/mips/sim-main.h
+++ b/sim/mips/sim-main.h
@@ -474,6 +474,8 @@ struct _sim_cpu {
sim_cpu_base base;
};
+extern void mips_sim_close (SIM_DESC sd, int quitting);
+#define SIM_CLOSE_HOOK(...) mips_sim_close (__VA_ARGS__)
/* MIPS specific simulator watch config */