From 6e4f085c7f459e0777a71bcb61ed3aa8257fa386 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 22 Mar 2015 23:10:09 -0400 Subject: 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. --- sim/msp430/ChangeLog | 7 +++++++ sim/msp430/msp430-sim.c | 4 +--- sim/msp430/sim-main.h | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'sim/msp430') 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 + + * 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 * 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_ */ -- cgit v1.1