aboutsummaryrefslogtreecommitdiff
path: root/sim/msp430
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/msp430
parent1bd1b714219e1c8324cc2fb5feb4496e80b6adfd (diff)
downloadfsf-binutils-gdb-6e4f085c7f459e0777a71bcb61ed3aa8257fa386.zip
fsf-binutils-gdb-6e4f085c7f459e0777a71bcb61ed3aa8257fa386.tar.gz
fsf-binutils-gdb-6e4f085c7f459e0777a71bcb61ed3aa8257fa386.tar.bz2
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/msp430')
-rw-r--r--sim/msp430/ChangeLog7
-rw-r--r--sim/msp430/msp430-sim.c4
-rw-r--r--sim/msp430/sim-main.h3
3 files changed, 11 insertions, 3 deletions
diff --git a/sim/msp430/ChangeLog b/sim/msp430/ChangeLog
index 08da33d..de174bf 100644
--- a/sim/msp430/ChangeLog
+++ b/sim/msp430/ChangeLog
@@ -1,3 +1,10 @@
+2015-11-14 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_close): Rename to ...
+ (msp430_sim_close): ... this. Delete call to sim_state_free.
+ * sim-main.h (msp430_sim_close): Declare.
+ (SIM_CLOSE_HOOK): Define.
+
2015-06-24 Mike Frysinger <vapier@gentoo.org>
* msp430-sim.c (trace_reg_put): Change TRACE_VPU to TRACE_REGISTER.
diff --git a/sim/msp430/msp430-sim.c b/sim/msp430/msp430-sim.c
index f32cb69..7f329c4 100644
--- a/sim/msp430/msp430-sim.c
+++ b/sim/msp430/msp430-sim.c
@@ -239,11 +239,9 @@ sim_open (SIM_OPEN_KIND kind,
}
void
-sim_close (SIM_DESC sd,
- int quitting)
+msp430_sim_close (SIM_DESC sd, int quitting)
{
free (STATE_SYMBOL_TABLE (sd));
- sim_state_free (sd);
}
SIM_RC
diff --git a/sim/msp430/sim-main.h b/sim/msp430/sim-main.h
index 19c8cca..aa51c15 100644
--- a/sim/msp430/sim-main.h
+++ b/sim/msp430/sim-main.h
@@ -54,4 +54,7 @@ struct sim_state
#include "sim-engine.h"
#include "sim-options.h"
+extern void msp430_sim_close (SIM_DESC sd, int quitting);
+#define SIM_CLOSE_HOOK(...) msp430_sim_close (__VA_ARGS__)
+
#endif /* _MSP430_MAIN_SIM_H_ */