sim: delete duplicate SIGINT handling

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>
This commit is contained in:
Mike Frysinger 2014-02-17 18:24:10 -05:00
parent c395f86f51
commit ef3e8cf7d1
10 changed files with 31 additions and 57 deletions

View 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.

View 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

View 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.

View 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);
}

View 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.

View 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);
}

View 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.

View 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

View 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.

View 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