]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: delete duplicate SIGINT handling
authorMike Frysinger <vapier@gentoo.org>
Mon, 17 Feb 2014 23:24:10 +0000 (18:24 -0500)
committerMike Frysinger <vapier@gentoo.org>
Mon, 17 Feb 2014 23:32:45 +0000 (18:32 -0500)
Many of the simulators change the SIGINT handler.
E.g., moxie/interp.c:

  sigsave = signal (SIGINT, interrupt);

However, this is unnecessary.
remote-sim.h already provides an API for asynchronously stopping
a sim; and both gdb and the drivers (run.c and nrun.c at least,
I didn't check the others) install a SIGINT handler which
calls this method.

URL: https://sourceware.org/bugzilla/show_bug.cgi?id=16450
Reported-by: Tom Tromey <tromey@redhat.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
sim/h8300/ChangeLog
sim/h8300/compile.c
sim/mcore/ChangeLog
sim/mcore/interp.c
sim/microblaze/ChangeLog
sim/microblaze/interp.c
sim/moxie/ChangeLog
sim/moxie/interp.c
sim/sh/ChangeLog
sim/sh/interp.c

index 4760745fdfbbc582d3c231d38853de93fcdfacac..38280e824d963020aa58cd9b11e1bed6be09ae1c 100644 (file)
@@ -1,3 +1,10 @@
+2014-02-17  Mike Frysinger  <vapier@gentoo.org>
+
+       PR gdb/16450
+       * compile.c (control_c_sim_desc): Delete.
+       (control_c): Likewise.
+       (sim_resume): Delete signal(SIGINT) handling.
+
 2013-09-23  Alan Modra  <amodra@gmail.com>
 
        * configure: Regenerate.
index 13d5caefc288591c45602614e73de075fe02c15d..2c7316ce6c94068a17d02ed0a2fe47acc60eb562 100644 (file)
@@ -1859,15 +1859,6 @@ init_pointers (SIM_DESC sd)
     }
 }
 
-/* Grotty global variable for use by control_c signal handler.  */
-static SIM_DESC control_c_sim_desc;
-
-static void
-control_c (int sig)
-{
-  sim_engine_set_run_state (control_c_sim_desc, sim_stopped, SIGINT);
-}
-
 int
 sim_stop (SIM_DESC sd)
 {
@@ -1901,7 +1892,6 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
   int cycles = 0;
   int insts = 0;
   int tick_start = get_now ();
-  void (*prev) ();
   int poll_count = 0;
   int res;
   int tmp;
@@ -1917,9 +1907,6 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
 
   init_pointers (sd);
 
-  control_c_sim_desc = sd;
-  prev = signal (SIGINT, control_c);
-
   if (step)
     {
       sim_engine_set_run_state (sd, sim_stopped, SIGTRAP);
@@ -4604,7 +4591,6 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
     h8_set_exr (sd, (trace<<7) | intMask);
 
   h8_set_mask (sd, oldmask);
-  signal (SIGINT, prev);
 }
 
 int
index 0208dc36aa79fed0f37c5308d809a237cbc2be6f..a034cdebd06310f0ad82499c130bfd9e850bfff0 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-17  Mike Frysinger  <vapier@gentoo.org>
+
+       PR gdb/16450
+       * interp.c (interrupt): Delete.
+       (sim_resume): Delete signal(SIGINT) handling.
+
 2013-09-23  Alan Modra  <amodra@gmail.com>
 
        * configure: Regenerate.
index 310f3611a6e29662e07234f4694b62addfef34a0..72c59f7ecb97bd31f793d8b7bd1e824b6a915d80 100644 (file)
@@ -472,12 +472,6 @@ set_initial_gprs ()
   cpu.gr[PARM4] = cpu.gr[0];
 }
 
-static void
-interrupt ()
-{
-  cpu.asregs.exception = SIGINT;
-}
-
 /* Functions so that trapped open/close don't interfere with the
    parent's functions.  We say that we can't close the descriptors
    that we didn't open.  exit() and cleanup() get in trouble here,
@@ -762,7 +756,6 @@ sim_resume (sd, step, siggnal)
   word ibuf;
   word pc;
   unsigned short inst;
-  void (* sigsave)();
   int memops;
   int bonus_cycles;
   int insts;
@@ -770,7 +763,6 @@ sim_resume (sd, step, siggnal)
   int cycs;
   word WLhash;
 
-  sigsave = signal (SIGINT, interrupt);
   cpu.asregs.exception = step ? SIGTRAP: 0;
   pc = cpu.asregs.pc;
 
@@ -1709,8 +1701,6 @@ sim_resume (sd, step, siggnal)
   cpu.asregs.cycles += insts;          /* and each takes a cycle */
   cpu.asregs.cycles += bonus_cycles;   /* and extra cycles for branches */
   cpu.asregs.cycles += memops * memcycles;     /* and memop cycle delays */
-  
-  signal (SIGINT, sigsave);
 }
 
 
index 7a3c7743d33e2db6a1195f87c2469c37c81c0773..fe6add2c77df77f4bfc31c028c2e0a16fe3c3273 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-17  Mike Frysinger  <vapier@gentoo.org>
+
+       PR gdb/16450
+       * interp.c (interrupt): Delete.
+       (sim_resume): Delete signal(SIGINT) handling.
+
 2013-09-23  Alan Modra  <amodra@gmail.com>
 
        * configure: Regenerate.
index 9e9ed1f72b2ec04ee88eb266d05e5ed300f024b3..4907b7383d5a6bbd254a39310dcd91e2408d11be 100644 (file)
@@ -368,12 +368,6 @@ set_initial_gprs ()
 
 }
 
-static void
-interrupt ()
-{
-  CPU.exception = SIGINT;
-}
-
 /* Functions so that trapped open/close don't interfere with the
    parent's functions.  We say that we can't close the descriptors
    that we didn't open.  exit() and cleanup() get in trouble here,
@@ -515,7 +509,6 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
   int needfetch;
   word inst;
   enum microblaze_instr op;
-  void (*sigsave)();
   int memops;
   int bonus_cycles;
   int insts;
@@ -532,7 +525,6 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
   short num_delay_slot; /* UNUSED except as reqd parameter */
   enum microblaze_instr_type insn_type;
 
-  sigsave = signal (SIGINT, interrupt);
   CPU.exception = step ? SIGTRAP : 0;
 
   memops = 0;
@@ -697,8 +689,6 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
   CPU.cycles += insts;         /* and each takes a cycle */
   CPU.cycles += bonus_cycles;  /* and extra cycles for branches */
   CPU.cycles += memops;        /* and memop cycle delays */
-
-  signal (SIGINT, sigsave);
 }
 
 
index 8ddd1632d7932e944ac3338e1d363c4dc7ff5bd8..95daaef06b7588ccf13daa9eb50691222ac94ef0 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-17  Mike Frysinger  <vapier@gentoo.org>
+
+       PR gdb/16450
+       * interp.c (interrupt): Delete.
+       (sim_resume): Delete signal(SIGINT) handling.
+
 2013-09-23  Alan Modra  <amodra@gmail.com>
 
        * configure: Regenerate.
index 314da4af11c8f00029087e2f640aed825b73f360..63dc8fc8fd9204ce64e88bff60cfa089f09b2234 100644 (file)
@@ -157,12 +157,6 @@ set_initial_gprs ()
     cpu.asregs.sregs[i] = 0;
 }
 
-static void
-interrupt ()
-{
-  cpu.asregs.exception = SIGINT;
-}
-
 /* Write a 1 byte value to memory.  */
 
 static void INLINE 
@@ -258,11 +252,9 @@ sim_resume (sd, step, siggnal)
   word pc, opc;
   unsigned long long insts;
   unsigned short inst;
-  void (* sigsave)();
   sim_cpu *scpu = STATE_CPU (sd, 0); /* FIXME */
   address_word cia = CIA_GET (scpu);
 
-  sigsave = signal (SIGINT, interrupt);
   cpu.asregs.exception = step ? SIGTRAP: 0;
   pc = cpu.asregs.regs[PC_REGNO];
   insts = cpu.asregs.insts;
@@ -1022,8 +1014,6 @@ sim_resume (sd, step, siggnal)
   /* Hide away the things we've cached while executing.  */
   cpu.asregs.regs[PC_REGNO] = pc;
   cpu.asregs.insts += insts;           /* instructions done ... */
-
-  signal (SIGINT, sigsave);
 }
 
 int
index bb57ca1e312af5f2eff5600d02d88ca6f8de779c..8c1b09b4ad31ec9e1c2a3c7ebded88ac2fd36070 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-17  Mike Frysinger  <vapier@gentoo.org>
+
+       PR gdb/16450
+       * interp.c (control_c): Delete.
+       (sim_resume): Delete signal(SIGINT) handling.
+
 2013-09-23  Alan Modra  <amodra@gmail.com>
 
        * configure: Regenerate.
index fa77e5f68ed8e5ae04ae23303030546bac76a4e1..5689511fa8b2a19f60a8d4d6a28cc25ec3a4d3af 100644 (file)
@@ -1261,16 +1261,6 @@ trap (i, regs, insn_ptr, memory, maskl, maskw, endianw)
   return 0;
 }
 
-void
-control_c (sig, code, scp, addr)
-     int sig;
-     int code;
-     char *scp;
-     char *addr;
-{
-  raise_exception (SIGINT);
-}
-
 static int
 div1 (R, iRn2, iRn1/*, T*/)
      int *R;
@@ -1979,7 +1969,6 @@ sim_resume (sd, step, siggnal)
   register int endianw = global_endianw;
 
   int tick_start = get_now ();
-  void (*prev) ();
   void (*prev_fpe) ();
 
   register unsigned short *jump_table = sh_jump_table;
@@ -1996,7 +1985,6 @@ sim_resume (sd, step, siggnal)
   register unsigned char *memory;
   register unsigned int sbit = ((unsigned int) 1 << 31);
 
-  prev = signal (SIGINT, control_c);
   prev_fpe = signal (SIGFPE, SIG_IGN);
 
   init_pointers ();
@@ -2134,7 +2122,6 @@ sim_resume (sd, step, siggnal)
     }
 
   signal (SIGFPE, prev_fpe);
-  signal (SIGINT, prev);
 }
 
 int