diff options
author | Mike Frysinger <vapier@gentoo.org> | 2016-01-02 09:23:06 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2016-01-02 10:27:56 -0500 |
commit | d47f5b30d8481272e9480118bdcb283690070349 (patch) | |
tree | 589f77d62110d7456496fde754036fa24c89369d /sim | |
parent | 32273fe68f3d1288b2eef6b96beda3732d0ac25e (diff) | |
download | gdb-d47f5b30d8481272e9480118bdcb283690070349.zip gdb-d47f5b30d8481272e9480118bdcb283690070349.tar.gz gdb-d47f5b30d8481272e9480118bdcb283690070349.tar.bz2 |
sim: delete dead current_state globals
The global current_state handle to the current simulator state is a
design idea that was half implemented, but never really cleaned up.
The point was to have a global variable pointing to the state so that
funcs could more quickly & easily access the state anywhere. We've
instead moved in the direction of passing state around everywhere and
don't have any intention of moving back.
I also can't find any references to gdb using this variable, or to
cgen related "dump_regs" functions, both of which were used in the
comments related to this code.
Diffstat (limited to 'sim')
-rw-r--r-- | sim/common/ChangeLog | 6 | ||||
-rw-r--r-- | sim/common/cgen-defs.h | 6 | ||||
-rw-r--r-- | sim/common/sim-base.h | 22 | ||||
-rw-r--r-- | sim/common/sim-utils.c | 4 | ||||
-rw-r--r-- | sim/cris/ChangeLog | 5 | ||||
-rw-r--r-- | sim/cris/sim-if.c | 8 | ||||
-rw-r--r-- | sim/frv/ChangeLog | 6 | ||||
-rw-r--r-- | sim/frv/reset.c | 2 | ||||
-rw-r--r-- | sim/frv/sim-if.c | 8 | ||||
-rw-r--r-- | sim/iq2000/ChangeLog | 5 | ||||
-rw-r--r-- | sim/iq2000/sim-if.c | 8 | ||||
-rw-r--r-- | sim/lm32/ChangeLog | 5 | ||||
-rw-r--r-- | sim/lm32/sim-if.c | 8 | ||||
-rw-r--r-- | sim/m32r/ChangeLog | 5 | ||||
-rw-r--r-- | sim/m32r/sim-if.c | 8 | ||||
-rw-r--r-- | sim/mips/ChangeLog | 4 | ||||
-rw-r--r-- | sim/mips/dv-tx3904cpu.c | 5 | ||||
-rw-r--r-- | sim/sh64/ChangeLog | 5 | ||||
-rw-r--r-- | sim/sh64/sim-if.c | 8 |
19 files changed, 42 insertions, 86 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 58ffa6c..65a0abf 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,9 @@ +2016-01-02 Mike Frysinger <vapier@gentoo.org> + + * cgen-defs.h (current_state): Delete. + * sim-base.h (CURRENT_STATE_REG, CURRENT_STATE): Delete. + * sim-utils.c (current_state): Delete. + 2015-12-30 Mike Frysinger <vapier@gentoo.org> * sim-module.c (sim_pre_argv_init): Change STATE_MY_NAME assignment diff --git a/sim/common/cgen-defs.h b/sim/common/cgen-defs.h index be717f8..c42db9b 100644 --- a/sim/common/cgen-defs.h +++ b/sim/common/cgen-defs.h @@ -140,12 +140,6 @@ typedef enum { /* Simulator state. */ -/* Records simulator descriptor so utilities like @cpu@_dump_regs can be - called from gdb. */ -extern SIM_DESC current_state; - -/* Simulator state. */ - /* CGEN_STATE contains additional state information not present in sim_state_base. */ diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h index a0e7090..350b352 100644 --- a/sim/common/sim-base.h +++ b/sim/common/sim-base.h @@ -89,28 +89,6 @@ typedef struct _sim_cpu sim_cpu; #include "sim-memopt.h" #include "sim-cpu.h" -/* Global pointer to current state while sim_resume is running. - On a machine with lots of registers, it might be possible to reserve - one of them for current_state. However on a machine with few registers - current_state can't permanently live in one and indirecting through it - will be slower [in which case one can have sim_resume set globals from - current_state for faster access]. - If CURRENT_STATE_REG is defined, it means current_state is living in - a global register. */ - - -#ifdef CURRENT_STATE_REG -/* FIXME: wip */ -#else -extern struct sim_state *current_state; -#endif - - -/* The simulator may provide different (and faster) definition. */ -#ifndef CURRENT_STATE -#define CURRENT_STATE current_state -#endif - /* We require all sims to dynamically allocate cpus. See comment up top about struct sim_state. */ diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c index 5439b8b..d2b5f7c 100644 --- a/sim/common/sim-utils.c +++ b/sim/common/sim-utils.c @@ -48,10 +48,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "bfd.h" #include "sim-utils.h" -/* Global pointer to all state data. - Set by sim_resume. */ -struct sim_state *current_state; - /* Allocate zero filled memory with xcalloc - xcalloc aborts if the allocation fails. */ diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog index 9bf94f9..df428e7 100644 --- a/sim/cris/ChangeLog +++ b/sim/cris/ChangeLog @@ -1,3 +1,8 @@ +2016-01-02 Mike Frysinger <vapier@gentoo.org> + + * sim-if.c (current_state): Delete. + (sim_open): Delete current_state assignment. + 2015-12-30 Mike Frysinger <vapier@gentoo.org> * sim-if.c (sim_open): Delete current_target_byte_order assignment. diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c index eba9dc9..cf680cf 100644 --- a/sim/cris/sim-if.c +++ b/sim/cris/sim-if.c @@ -81,10 +81,6 @@ static int cris_program_offset = 0; enum cris_unknown_syscall_action_type cris_unknown_syscall_action = CRIS_USYSC_MSG_STOP; -/* Records simulator descriptor so utilities like cris_dump_regs can be - called from gdb. */ -SIM_DESC current_state; - /* CRIS-specific options. */ typedef enum { OPTION_CRIS_STATS = OPTION_START, @@ -985,10 +981,6 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd, Must be done after cris_cgen_cpu_open. */ cgen_init (sd); - /* Store in a global so things like cris_dump_regs can be invoked - from the gdb command line. */ - current_state = sd; - cris_set_callbacks (callback); return sd; diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog index c716e6a..a566ba0 100644 --- a/sim/frv/ChangeLog +++ b/sim/frv/ChangeLog @@ -1,3 +1,9 @@ +2016-01-02 Mike Frysinger <vapier@gentoo.org> + + * reset.c (frv_term): Change current_state to sd. + * sim-if.c (current_state): Delete. + (sim_open): Delete current_state assignment. + 2015-12-27 Mike Frysinger <vapier@gentoo.org> * Makefile.in (SIM_OBJS): Delete sim-hload.o. diff --git a/sim/frv/reset.c b/sim/frv/reset.c index 0bc9dd9..6f973b5 100644 --- a/sim/frv/reset.c +++ b/sim/frv/reset.c @@ -105,7 +105,7 @@ frv_term (SIM_DESC sd) then turn it off again. This is the only place we can currently gain control to do this. */ if (frv_interrupt_state.timer.enabled && ! frv_save_profile_model_p) - sim_profile_set_option (current_state, "-model", PROFILE_MODEL_IDX, "0"); + sim_profile_set_option (sd, "-model", PROFILE_MODEL_IDX, "0"); } /* Perform a power on reset. */ diff --git a/sim/frv/sim-if.c b/sim/frv/sim-if.c index aab8ff7..6bf77fd 100644 --- a/sim/frv/sim-if.c +++ b/sim/frv/sim-if.c @@ -30,10 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ static void free_state (SIM_DESC); static void print_frv_misc_cpu (SIM_CPU *cpu, int verbose); - -/* Records simulator descriptor so utilities like frv_dump_regs can be - called from gdb. */ -SIM_DESC current_state; /* Cover function of sim_state_free to free the cpu buffers as well. */ @@ -175,10 +171,6 @@ sim_open (kind, callback, abfd, argv) frv_initialize (cpu, sd); } - /* Store in a global so things like sparc32_dump_regs can be invoked - from the gdb command line. */ - current_state = sd; - return sd; } diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog index 8f760bb..d2584e9 100644 --- a/sim/iq2000/ChangeLog +++ b/sim/iq2000/ChangeLog @@ -1,3 +1,8 @@ +2016-01-02 Mike Frysinger <vapier@gentoo.org> + + * sim-if.c (current_state): Delete. + (sim_open): Delete current_state assignment. + 2015-12-27 Mike Frysinger <vapier@gentoo.org> * Makefile.in (SIM_OBJS): Delete sim-hload.o. diff --git a/sim/iq2000/sim-if.c b/sim/iq2000/sim-if.c index b5240f0..d21ec1b 100644 --- a/sim/iq2000/sim-if.c +++ b/sim/iq2000/sim-if.c @@ -26,10 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "bfd.h" static void free_state (SIM_DESC); - -/* Records simulator descriptor so utilities like iq2000_dump_regs can be - called from gdb. */ -SIM_DESC current_state; /* Cover function for sim_cgen_disassemble_insn. */ @@ -149,10 +145,6 @@ sim_open (kind, callback, abfd, argv) Must be done after iq2000_cgen_cpu_open. */ cgen_init (sd); - /* Store in a global so things like sparc32_dump_regs can be invoked - from the gdb command line. */ - current_state = sd; - return sd; } diff --git a/sim/lm32/ChangeLog b/sim/lm32/ChangeLog index a7596a6..eda8a23 100644 --- a/sim/lm32/ChangeLog +++ b/sim/lm32/ChangeLog @@ -1,3 +1,8 @@ +2016-01-02 Mike Frysinger <vapier@gentoo.org> + + * sim-if.c (current_state): Delete. + (sim_open): Delete current_state assignment. + 2015-12-27 Mike Frysinger <vapier@gentoo.org> * Makefile.in (SIM_OBJS): Delete sim-hload.o. diff --git a/sim/lm32/sim-if.c b/sim/lm32/sim-if.c index 364fc7d..3f65c93 100644 --- a/sim/lm32/sim-if.c +++ b/sim/lm32/sim-if.c @@ -43,10 +43,6 @@ static const OPTION lm32_options[] = { lm32_option_handler}, {{NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL} }; - -/* Records simulator descriptor so utilities like lm32_dump_regs can be - called from gdb. */ -SIM_DESC current_state; /* Cover function of sim_state_free to free the cpu buffers as well. */ @@ -240,10 +236,6 @@ sim_open (kind, callback, abfd, argv) Must be done after lm32_cgen_cpu_open. */ cgen_init (sd); - /* Store in a global so things like lm32_dump_regs can be invoked - from the gdb command line. */ - current_state = sd; - return sd; } diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog index 6bedd99..5b3d70e 100644 --- a/sim/m32r/ChangeLog +++ b/sim/m32r/ChangeLog @@ -1,3 +1,8 @@ +2016-01-02 Mike Frysinger <vapier@gentoo.org> + + * sim-if.c (current_state): Delete. + (sim_open): Delete current_state assignment. + 2015-12-27 Mike Frysinger <vapier@gentoo.org> * Makefile.in (SIM_OBJS): Delete sim-hload.o. diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c index f6a44e8..2ed6934 100644 --- a/sim/m32r/sim-if.c +++ b/sim/m32r/sim-if.c @@ -37,10 +37,6 @@ static void free_state (SIM_DESC); static void print_m32r_misc_cpu (SIM_CPU *cpu, int verbose); - -/* Records simulator descriptor so utilities like m32r_dump_regs can be - called from gdb. */ -SIM_DESC current_state; /* Cover function of sim_state_free to free the cpu buffers as well. */ @@ -169,10 +165,6 @@ sim_open (kind, callback, abfd, argv) = print_m32r_misc_cpu; } - /* Store in a global so things like sparc32_dump_regs can be invoked - from the gdb command line. */ - current_state = sd; - return sd; } diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog index 8b2e23f..a77058e 100644 --- a/sim/mips/ChangeLog +++ b/sim/mips/ChangeLog @@ -1,3 +1,7 @@ +2016-01-02 Mike Frysinger <vapier@gentoo.org> + + * dv-tx3904cpu.c (CPU, SD): Delete. + 2015-12-30 Mike Frysinger <vapier@gentoo.org> * wrapper.c (mips_reg_store, mips_reg_fetch): Define. diff --git a/sim/mips/dv-tx3904cpu.c b/sim/mips/dv-tx3904cpu.c index 1c5b70d..da28a49 100644 --- a/sim/mips/dv-tx3904cpu.c +++ b/sim/mips/dv-tx3904cpu.c @@ -143,9 +143,6 @@ deliver_tx3904cpu_interrupt (struct hw *me, sim_cpu *cpu = STATE_CPU (sd, 0); /* NB: fix CPU 0. */ address_word cia = CPU_PC_GET (cpu); -#define CPU cpu -#define SD current_state - if (controller->pending_reset) { controller->pending_reset = 0; @@ -190,8 +187,6 @@ deliver_tx3904cpu_interrupt (struct hw *me, } } /* interrupt set */ } -#undef CPU cpu -#undef SD current_state } diff --git a/sim/sh64/ChangeLog b/sim/sh64/ChangeLog index 945ec35..06ce139 100644 --- a/sim/sh64/ChangeLog +++ b/sim/sh64/ChangeLog @@ -1,3 +1,8 @@ +2016-01-02 Mike Frysinger <vapier@gentoo.org> + + * sim-if.c (current_state): Delete. + (sim_open): Delete current_state assignment. + 2015-12-27 Mike Frysinger <vapier@gentoo.org> * Makefile.in (SIM_OBJS): Delete sim-hload.o. diff --git a/sim/sh64/sim-if.c b/sim/sh64/sim-if.c index bbc57cd..a74f1e5 100644 --- a/sim/sh64/sim-if.c +++ b/sim/sh64/sim-if.c @@ -32,10 +32,6 @@ static void free_state (SIM_DESC); /* Since we don't build the cgen-opcode table, we use a wrapper around the existing disassembler from libopcodes. */ static CGEN_DISASSEMBLER sh64_disassemble_insn; - -/* Records simulator descriptor so utilities like sh5_dump_regs can be - called from gdb. */ -SIM_DESC current_state; /* Cover function of sim_state_free to free the cpu buffers as well. */ @@ -155,10 +151,6 @@ sim_open (kind, callback, abfd, argv) Must be done after sh_cgen_cpu_open. */ cgen_init (sd); - /* Store in a global so things like sparc32_dump_regs can be invoked - from the gdb command line. */ - current_state = sd; - return sd; } |