From 6e4f085c7f459e0777a71bcb61ed3aa8257fa386 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 22 Mar 2015 23:10:09 -0400 Subject: [PATCH] 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/arm/ChangeLog | 4 +++ sim/arm/wrapper.c | 7 ----- sim/avr/ChangeLog | 4 +++ sim/avr/interp.c | 6 ----- sim/bfin/ChangeLog | 4 +++ sim/bfin/interp.c | 6 ----- sim/common/ChangeLog | 5 ++++ sim/common/Make-common.in | 1 + sim/common/sim-close.c | 57 +++++++++++++++++++++++++++++++++++++++ sim/cr16/ChangeLog | 4 +++ sim/cr16/interp.c | 7 ----- sim/cris/ChangeLog | 4 +++ sim/cris/sim-if.c | 7 ----- sim/d10v/ChangeLog | 4 +++ sim/d10v/interp.c | 7 ----- sim/frv/ChangeLog | 8 ++++++ sim/frv/sim-if.c | 5 +--- sim/frv/sim-main.h | 3 +++ sim/ft32/ChangeLog | 4 +++ sim/ft32/interp.c | 6 ----- sim/h8300/ChangeLog | 4 +++ sim/h8300/compile.c | 6 ----- sim/iq2000/ChangeLog | 4 +++ sim/iq2000/sim-if.c | 9 ------- sim/lm32/ChangeLog | 4 +++ sim/lm32/sim-if.c | 9 ------- sim/m32r/ChangeLog | 4 +++ sim/m32r/sim-if.c | 9 ------- sim/m68hc11/ChangeLog | 4 +++ sim/m68hc11/interp.c | 16 ----------- sim/mcore/ChangeLog | 4 +++ sim/mcore/interp.c | 6 ----- sim/microblaze/ChangeLog | 4 +++ sim/microblaze/interp.c | 6 ----- sim/mips/ChangeLog | 8 ++++++ sim/mips/interp.c | 21 +-------------- sim/mips/sim-main.h | 2 ++ sim/mn10300/ChangeLog | 4 +++ sim/mn10300/interp.c | 8 ------ sim/moxie/ChangeLog | 4 +++ sim/moxie/interp.c | 7 ----- sim/msp430/ChangeLog | 7 +++++ sim/msp430/msp430-sim.c | 4 +-- sim/msp430/sim-main.h | 3 +++ sim/sh/ChangeLog | 4 +++ sim/sh/interp.c | 6 ----- sim/sh64/ChangeLog | 4 +++ sim/sh64/sim-if.c | 9 ------- sim/v850/ChangeLog | 4 +++ sim/v850/interp.c | 7 ----- 50 files changed, 173 insertions(+), 171 deletions(-) create mode 100644 sim/common/sim-close.c diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog index 577579c291d..f87e18b5384 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * wrapper.c (sim_close): Delete. + 2015-07-14 Nick Clifton * armcopro.c: Remove extraneous whitespace. diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index b9b4a0be88f..79f0b1d3699 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -913,13 +913,6 @@ sim_open (SIM_OPEN_KIND kind, return sd; } -void -sim_close (SIM_DESC sd ATTRIBUTE_UNUSED, - int quitting ATTRIBUTE_UNUSED) -{ - /* Nothing to do. */ -} - void sim_stop_reason (SIM_DESC sd ATTRIBUTE_UNUSED, enum sim_stop *reason, diff --git a/sim/avr/ChangeLog b/sim/avr/ChangeLog index 0c2963c0c77..fa21734e083 100644 --- a/sim/avr/ChangeLog +++ b/sim/avr/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * interp.c (sim_close): Delete. + 2015-06-23 Mike Frysinger * configure: Regenerate. diff --git a/sim/avr/interp.c b/sim/avr/interp.c index a6588d3de4f..0b84c3b4572 100644 --- a/sim/avr/interp.c +++ b/sim/avr/interp.c @@ -1758,12 +1758,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv) return sd; } -void -sim_close (SIM_DESC sd, int quitting) -{ - sim_module_uninstall (sd); -} - SIM_RC sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env) { diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog index 2e62a74de34..b0205e3a949 100644 --- a/sim/bfin/ChangeLog +++ b/sim/bfin/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * interp.c (sim_close): Delete. + 2015-10-11 Mike Frysinger PR sim/18407 diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c index 3013ca05928..5ba204b0e06 100644 --- a/sim/bfin/interp.c +++ b/sim/bfin/interp.c @@ -820,12 +820,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, return sd; } -void -sim_close (SIM_DESC sd, int quitting) -{ - sim_module_uninstall (sd); -} - /* Some utils don't like having a NULL environ. */ static const char * const simple_env[] = { "HOME=/", "PATH=/bin", NULL }; diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 2aa178c8d83..151fc1bde77 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,8 @@ +2015-11-14 Mike Frysinger + + * Make-common.in (SIM_NEW_COMMON_OBJS): Add sim-close.o + * sim-close.c: New file. + 2015-09-25 Andrew Bennett Ali Lown diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index 2f5ad89e164..aba97f7da1e 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -173,6 +173,7 @@ SIM_COMMON_HW_OBJS = \ SIM_NEW_COMMON_OBJS = \ sim-arange.o \ sim-bits.o \ + sim-close.o \ sim-command.o \ sim-config.o \ sim-core.o \ diff --git a/sim/common/sim-close.c b/sim/common/sim-close.c new file mode 100644 index 00000000000..a1458d443e0 --- /dev/null +++ b/sim/common/sim-close.c @@ -0,0 +1,57 @@ +/* Miscellaneous simulator utilities. + + Copyright (C) 2005-2015 Free Software Foundation, Inc. + Contributed by Analog Devices, Inc. and Stephane Carrez. + + 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 . */ + +#include "sim-main.h" +#include "sim-module.h" +#include "gdb/remote-sim.h" + +/* Generic implementation of sim_close that works with simulators that use + sim-module for all custom runtime options. */ + +#ifndef SIM_CLOSE_HOOK +# define SIM_CLOSE_HOOK(sd, quitting) +#endif + +void +sim_close (SIM_DESC sd, int quitting) +{ + SIM_CLOSE_HOOK (sd, quitting); + + /* If cgen is active, close it down. */ +#ifdef CGEN_ARCH +# define __cgen_cpu_close(arch) arch##_cgen_cpu_close +# define _cgen_cpu_close(arch) __cgen_cpu_close (arch) +# define cgen_cpu_close _cgen_cpu_close (CGEN_ARCH) + cgen_cpu_close (CPU_CPU_DESC (STATE_CPU (sd, 0))); +#endif + + /* Shut down all registered/active modules. */ + sim_module_uninstall (sd); + + /* Ensure that any resources allocated through the callback + mechanism are released. */ + sim_io_shutdown (sd); + + /* Break down all of the cpus. */ + sim_cpu_free_all (sd); + + /* Finally break down the sim state itself. */ + sim_state_free (sd); +} diff --git a/sim/cr16/ChangeLog b/sim/cr16/ChangeLog index ccc4abb326a..5cbb4131940 100644 --- a/sim/cr16/ChangeLog +++ b/sim/cr16/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * interp.c (sim_close): Delete. + 2015-11-10 Mike Frysinger * interp.c (sim_cr16_translate_dmap_addr): Mark static. diff --git a/sim/cr16/interp.c b/sim/cr16/interp.c index 5b3f5bb81bf..8af7aefecda 100644 --- a/sim/cr16/interp.c +++ b/sim/cr16/interp.c @@ -945,13 +945,6 @@ sim_open (SIM_OPEN_KIND kind, struct host_callback_struct *cb, struct bfd *abfd, return sd; } - -void -sim_close (SIM_DESC sd, int quitting) -{ - /* Nothing to do. */ -} - uint8 * dmem_addr (uint32 offset) { diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog index ad3f1864590..42ff2854e79 100644 --- a/sim/cris/ChangeLog +++ b/sim/cris/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * sim-if.c (sim_close): Delete. + 2015-06-23 Mike Frysinger * configure: Regenerate. diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c index 36db51764cc..9fb1e13972d 100644 --- a/sim/cris/sim-if.c +++ b/sim/cris/sim-if.c @@ -1060,13 +1060,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd, return sd; } - -void -sim_close (SIM_DESC sd, int quitting ATTRIBUTE_UNUSED) -{ - cris_cgen_cpu_close (CPU_CPU_DESC (STATE_CPU (sd, 0))); - sim_module_uninstall (sd); -} SIM_RC sim_create_inferior (SIM_DESC sd, struct bfd *abfd, diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog index 765d7a536ce..4f22db7936b 100644 --- a/sim/d10v/ChangeLog +++ b/sim/d10v/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * interp.c (sim_close): Delete. + 2015-11-10 Mike Frysinger * interp.c (sim_d10v_translate_dmap_addr): Mark static. diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c index 9c059f72be7..1cb1d7c4616 100644 --- a/sim/d10v/interp.c +++ b/sim/d10v/interp.c @@ -866,13 +866,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv) return sd; } - -void -sim_close (SIM_DESC sd, int quitting) -{ - /* Nothing to do. */ -} - uint8 * dmem_addr (uint16 offset) { diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog index 44c920c6e7a..9ebf4985149 100644 --- a/sim/frv/ChangeLog +++ b/sim/frv/ChangeLog @@ -1,3 +1,11 @@ +2015-11-14 Mike Frysinger + + * interp.c (sim_close): Rename to ... + (frv_sim_close): ... this. Delete calls to frv_cgen_cpu_close and + sim_module_uninstall. + * sim-main.h (frv_sim_close): Declare. + (SIM_CLOSE_HOOK): Define. + 2015-06-23 Mike Frysinger * configure.ac (AC_ARG_ENABLE(sim-trapdump)): Call AS_HELP_STRING. diff --git a/sim/frv/sim-if.c b/sim/frv/sim-if.c index 266876539e8..8c6ed6ffc03 100644 --- a/sim/frv/sim-if.c +++ b/sim/frv/sim-if.c @@ -199,7 +199,7 @@ sim_open (kind, callback, abfd, argv) } void -sim_close (sd, quitting) +frv_sim_close (sd, quitting) SIM_DESC sd; int quitting; { @@ -211,9 +211,6 @@ sim_close (sd, quitting) frv_cache_term (CPU_INSN_CACHE (cpu)); frv_cache_term (CPU_DATA_CACHE (cpu)); } - - frv_cgen_cpu_close (CPU_CPU_DESC (STATE_CPU (sd, 0))); - sim_module_uninstall (sd); } SIM_RC diff --git a/sim/frv/sim-main.h b/sim/frv/sim-main.h index d5a67cb8167..ef14d64c5ec 100644 --- a/sim/frv/sim-main.h +++ b/sim/frv/sim-main.h @@ -43,6 +43,9 @@ along with this program. If not, see . */ #include "profile.h" void frv_sim_engine_halt_hook (SIM_DESC, SIM_CPU *, sim_cia); + +extern void frv_sim_close (SIM_DESC sd, int quitting); +#define SIM_CLOSE_HOOK(...) frv_sim_close (__VA_ARGS__) /* The _sim_cpu struct. */ diff --git a/sim/ft32/ChangeLog b/sim/ft32/ChangeLog index f5b14ec15ad..bb41fb80030 100644 --- a/sim/ft32/ChangeLog +++ b/sim/ft32/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * interp.c (sim_close): Delete. + 2015-09-29 James Bowman * interp.c (step_once): Correct length for MEMSET and MEMCPY diff --git a/sim/ft32/interp.c b/sim/ft32/interp.c index f7daf1c1679..e2762b8e156 100644 --- a/sim/ft32/interp.c +++ b/sim/ft32/interp.c @@ -862,12 +862,6 @@ sim_open (SIM_OPEN_KIND kind, return sd; } -void -sim_close (SIM_DESC sd, int quitting) -{ - sim_module_uninstall (sd); -} - SIM_RC sim_create_inferior (SIM_DESC sd, struct bfd *abfd, diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog index ce77765a171..b50c1a1e893 100644 --- a/sim/h8300/ChangeLog +++ b/sim/h8300/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * compile.c (sim_close): Delete. + 2015-11-09 Mike Frysinger * compile.c (littleendian): Delete. diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index f3f794d8ebd..e5460fa660a 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -4966,12 +4966,6 @@ sim_open (SIM_OPEN_KIND kind, return sd; } -void -sim_close (SIM_DESC sd, int quitting) -{ - /* Nothing to do. */ -} - /* Called by gdb to load a program into memory. */ SIM_RC diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog index 3eb722bfaa6..dcb6cc55c3f 100644 --- a/sim/iq2000/ChangeLog +++ b/sim/iq2000/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * sim-if.c (sim_close): Delete. + 2015-06-23 Mike Frysinger * configure: Regenerate. diff --git a/sim/iq2000/sim-if.c b/sim/iq2000/sim-if.c index 8e79f4aefd4..a72f5c0cb71 100644 --- a/sim/iq2000/sim-if.c +++ b/sim/iq2000/sim-if.c @@ -155,15 +155,6 @@ sim_open (kind, callback, abfd, argv) return sd; } - -void -sim_close (sd, quitting) - SIM_DESC sd; - int quitting; -{ - iq2000_cgen_cpu_close (CPU_CPU_DESC (STATE_CPU (sd, 0))); - sim_module_uninstall (sd); -} SIM_RC sim_create_inferior (sd, abfd, argv, envp) diff --git a/sim/lm32/ChangeLog b/sim/lm32/ChangeLog index 4b852db98fc..59d3aa12509 100644 --- a/sim/lm32/ChangeLog +++ b/sim/lm32/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * sim-if.c (sim_close): Delete. + 2015-06-23 Mike Frysinger * configure: Regenerate. diff --git a/sim/lm32/sim-if.c b/sim/lm32/sim-if.c index a82b42810f5..3b0575a7a62 100644 --- a/sim/lm32/sim-if.c +++ b/sim/lm32/sim-if.c @@ -246,15 +246,6 @@ sim_open (kind, callback, abfd, argv) return sd; } - -void -sim_close (sd, quitting) - SIM_DESC sd; - int quitting; -{ - lm32_cgen_cpu_close (CPU_CPU_DESC (STATE_CPU (sd, 0))); - sim_module_uninstall (sd); -} SIM_RC sim_create_inferior (sd, abfd, argv, envp) diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog index b38c0a55fa9..8919efc0ebc 100644 --- a/sim/m32r/ChangeLog +++ b/sim/m32r/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * sim-if.c (sim_close): Delete. + 2015-06-23 Mike Frysinger * configure: Regenerate. diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c index d01bc0a5573..5fd8de0b5db 100644 --- a/sim/m32r/sim-if.c +++ b/sim/m32r/sim-if.c @@ -179,15 +179,6 @@ sim_open (kind, callback, abfd, argv) return sd; } - -void -sim_close (sd, quitting) - SIM_DESC sd; - int quitting; -{ - m32r_cgen_cpu_close (CPU_CPU_DESC (STATE_CPU (sd, 0))); - sim_module_uninstall (sd); -} SIM_RC sim_create_inferior (sd, abfd, argv, envp) diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog index 407e391953f..ba2db62b6e2 100644 --- a/sim/m68hc11/ChangeLog +++ b/sim/m68hc11/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * interp.c (sim_close): Delete. + 2015-06-23 Mike Frysinger * configure: Regenerate. diff --git a/sim/m68hc11/interp.c b/sim/m68hc11/interp.c index a1d98a732bc..bb93e6ca981 100644 --- a/sim/m68hc11/interp.c +++ b/sim/m68hc11/interp.c @@ -499,22 +499,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, return sd; } - -void -sim_close (SIM_DESC sd, int quitting) -{ - /* shut down modules */ - sim_module_uninstall (sd); - - /* Ensure that any resources allocated through the callback - mechanism are released: */ - sim_io_shutdown (sd); - - /* FIXME - free SD */ - sim_state_free (sd); - return; -} - /* Generic implementation of sim_engine_run that works within the sim_engine setjmp/longjmp framework. */ diff --git a/sim/mcore/ChangeLog b/sim/mcore/ChangeLog index 99e72ded516..70d7ae92fcc 100644 --- a/sim/mcore/ChangeLog +++ b/sim/mcore/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * interp.c (sim_close): Delete. + 2015-06-23 Mike Frysinger * configure: Regenerate. diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c index 64d148a10b0..2a9f1937874 100644 --- a/sim/mcore/interp.c +++ b/sim/mcore/interp.c @@ -1452,12 +1452,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv) return sd; } -void -sim_close (SIM_DESC sd, int quitting) -{ - /* nothing to do */ -} - SIM_RC sim_create_inferior (SIM_DESC sd, struct bfd *prog_bfd, char **argv, char **env) { diff --git a/sim/microblaze/ChangeLog b/sim/microblaze/ChangeLog index 765480c14fb..cb6f742eeb9 100644 --- a/sim/microblaze/ChangeLog +++ b/sim/microblaze/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * interp.c (sim_close): Delete. + 2015-06-23 Mike Frysinger * configure: Regenerate. diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c index 93e622dc5f8..3ca5e1f6791 100644 --- a/sim/microblaze/interp.c +++ b/sim/microblaze/interp.c @@ -459,12 +459,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv) return sd; } -void -sim_close (SIM_DESC sd, int quitting) -{ - /* Do nothing. */ -} - SIM_RC sim_create_inferior (SIM_DESC sd, struct bfd *prog_bfd, char **argv, char **env) { 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 + + * 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 Ali Lown 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 */ diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog index e1bd8f104b7..e00b48fd31a 100644 --- a/sim/mn10300/ChangeLog +++ b/sim/mn10300/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * interp.c (sim_close): Delete. + 2015-06-23 Mike Frysinger * configure: Regenerate. diff --git a/sim/mn10300/interp.c b/sim/mn10300/interp.c index 14344fc2ecb..f3941ae0d2d 100644 --- a/sim/mn10300/interp.c +++ b/sim/mn10300/interp.c @@ -317,14 +317,6 @@ sim_open (SIM_OPEN_KIND kind, return sd; } - -void -sim_close (SIM_DESC sd, int quitting) -{ - sim_module_uninstall (sd); -} - - SIM_RC sim_create_inferior (SIM_DESC sd, struct bfd *prog_bfd, diff --git a/sim/moxie/ChangeLog b/sim/moxie/ChangeLog index 04b74ce277a..9f6cfde92ec 100644 --- a/sim/moxie/ChangeLog +++ b/sim/moxie/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * interp.c (sim_close): Delete. + 2015-10-11 Mike Frysinger PR sim/18273 diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c index df92cee39d9..b2e6352357b 100644 --- a/sim/moxie/interp.c +++ b/sim/moxie/interp.c @@ -1246,13 +1246,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv) return sd; } -void -sim_close (SIM_DESC sd, int quitting) -{ - /* nothing to do */ -} - - /* Load the device tree blob. */ static void diff --git a/sim/msp430/ChangeLog b/sim/msp430/ChangeLog index 08da33dc2da..de174bf64ae 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 f32cb69030c..7f329c42ea9 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 19c8ccaf868..aa51c15888e 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_ */ diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog index 458d0c3cb71..d19a8815031 100644 --- a/sim/sh/ChangeLog +++ b/sim/sh/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * interp.c (sim_close): Delete. + 2015-06-23 Mike Frysinger * configure: Regenerate. diff --git a/sim/sh/interp.c b/sim/sh/interp.c index 2f02e69382c..55a2d649668 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -2501,12 +2501,6 @@ parse_and_set_memory_size (const char *str) callback->printf_filtered (callback, "Bad memory size %d; must be 1 to 24, inclusive\n", n); } -void -sim_close (SIM_DESC sd, int quitting) -{ - /* nothing to do */ -} - SIM_RC sim_create_inferior (SIM_DESC sd, struct bfd *prog_bfd, char **argv, char **env) { diff --git a/sim/sh64/ChangeLog b/sim/sh64/ChangeLog index cff434d0b34..26439132a86 100644 --- a/sim/sh64/ChangeLog +++ b/sim/sh64/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * sim-if.c (sim_close): Delete. + 2015-06-23 Mike Frysinger * configure: Regenerate. diff --git a/sim/sh64/sim-if.c b/sim/sh64/sim-if.c index 200552d35de..29e0936ed20 100644 --- a/sim/sh64/sim-if.c +++ b/sim/sh64/sim-if.c @@ -161,15 +161,6 @@ sim_open (kind, callback, abfd, argv) return sd; } - -void -sim_close (sd, quitting) - SIM_DESC sd; - int quitting; -{ - sh_cgen_cpu_close (CPU_CPU_DESC (STATE_CPU (sd, 0))); - sim_module_uninstall (sd); -} SIM_RC sim_create_inferior (sd, abfd, argv, envp) diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog index e0b0f184df5..e0b92d94252 100644 --- a/sim/v850/ChangeLog +++ b/sim/v850/ChangeLog @@ -1,3 +1,7 @@ +2015-11-14 Mike Frysinger + + * interp.c (sim_close): Delete. + 2015-06-23 Mike Frysinger * configure: Regenerate. diff --git a/sim/v850/interp.c b/sim/v850/interp.c index 5b46feb503e..f055149cce6 100644 --- a/sim/v850/interp.c +++ b/sim/v850/interp.c @@ -303,13 +303,6 @@ sim_open (SIM_OPEN_KIND kind, return sd; } - -void -sim_close (SIM_DESC sd, int quitting) -{ - sim_module_uninstall (sd); -} - SIM_RC sim_create_inferior (SIM_DESC sd, struct bfd * prog_bfd, -- 2.30.2