]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: delete dead current_state globals
authorMike Frysinger <vapier@gentoo.org>
Sat, 2 Jan 2016 14:23:06 +0000 (09:23 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sat, 2 Jan 2016 15:27:56 +0000 (10:27 -0500)
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.

19 files changed:
sim/common/ChangeLog
sim/common/cgen-defs.h
sim/common/sim-base.h
sim/common/sim-utils.c
sim/cris/ChangeLog
sim/cris/sim-if.c
sim/frv/ChangeLog
sim/frv/reset.c
sim/frv/sim-if.c
sim/iq2000/ChangeLog
sim/iq2000/sim-if.c
sim/lm32/ChangeLog
sim/lm32/sim-if.c
sim/m32r/ChangeLog
sim/m32r/sim-if.c
sim/mips/ChangeLog
sim/mips/dv-tx3904cpu.c
sim/sh64/ChangeLog
sim/sh64/sim-if.c

index 58ffa6c5e5bd2f1b6455b2f36cf183c6a67c571d..65a0abfd1bc7f8ba933438964ef4f032e6b27425 100644 (file)
@@ -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
index be717f85b4f6c1c3d69b118d37b6a2de802f06f6..c42db9b469352fd760fc534b2030b413e2583461 100644 (file)
@@ -140,12 +140,6 @@ typedef enum {
 \f
 /* 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.  */
 
index a0e70908ac0ff4f00551c153fe5d6bcd11c0c070..350b352cc4c65b3f45cb7339f9ff0789f4a07ad1 100644 (file)
@@ -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.  */
index 5439b8bada310261e9f3b3029603042a0138696a..d2b5f7c0d03233c52f1251af0b5e6acc07791012 100644 (file)
@@ -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.  */
 
index 9bf94f9709ff1b4d4bd9958f2cd74b45eb6e1477..df428e7f774fd36a7ad7876f6169381191c81fee 100644 (file)
@@ -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.
index eba9dc90a7860c33eb93d08520e1e932db2e9401..cf680cf513645f0c2fa4cd9d3d96b49e2d3a27ec 100644 (file)
@@ -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;
index c716e6aeae52c5ccc6ba3d9f939216273c4edd68..a566ba05b1bbcb1010aa643960d5152d832306cf 100644 (file)
@@ -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.
index 0bc9dd98063942da654002c72e957011c326e0ef..6f973b5a228a05cf32f94448540bdc1ee44e27c0 100644 (file)
@@ -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.  */
index aab8ff794cfd2bac36a34d4a33c3c96a30d6828f..6bf77fde0aed831249caabaf2961d31e00c44d25 100644 (file)
@@ -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;
 \f
 /* 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;
 }
 
index 8f760bbfabe321a716f9f8fcdd54d251c0627c30..d2584e905da5ff06d17091ef5638c2f2a57fca0b 100644 (file)
@@ -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.
index b5240f089b7fa1856db79df8324d83797cde1706..d21ec1b9abe7a4ce4ff2dc6c45fc8a618f435c5a 100644 (file)
@@ -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;
 \f
 /* 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;
 }
 \f
index a7596a6f1784dcd44ca61a5b62001558ab8b52dc..eda8a23df1f27e681c16d5170fdb2a6bc38db5ec 100644 (file)
@@ -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.
index 364fc7d8982d5de0eb538a67231383270648ff88..3f65c93334f510ddc8eb205f6cca204f413dccb9 100644 (file)
@@ -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;
 \f
 /* 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;
 }
 \f
index 6bedd999bba9992bf8f8e1132f3e0cb06f253393..5b3d70e6fe0893955557fcb141bbd23b28dc5056 100644 (file)
@@ -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.
index f6a44e8f090c15108917e8ade899ae1cbab56465..2ed6934cf5d8c76ee54c6fd7624b8173e5f44b4a 100644 (file)
 
 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;
 \f
 /* 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;
 }
 \f
index 8b2e23f396e724d0eb2f56c016a350ebf9b9eb2b..a77058e0847625646601d151d7e8b5b9f3a616b1 100644 (file)
@@ -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.
index 1c5b70d770fe77b30f26bde4d03efadf1a9fccdb..da28a49a60cabf7b984ab406fdd9ca82b8b94d98 100644 (file)
@@ -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
 }
 
 
index 945ec35c4fba8c02d15ecd346787692ac23b5594..06ce139842fbb29c9485b76fe06ea2bca880c8d6 100644 (file)
@@ -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.
index bbc57cd70e085e20b74b79ba0ca070dcfec821f6..a74f1e58b4e161c1c1d62dfa1b64d87dfcb4d308 100644 (file)
@@ -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;
 \f
 /* 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;
 }
 \f