From 8517f62b166073b871c896fdd642798fae4a08bd Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Fri, 18 Apr 1997 12:24:52 +0000 Subject: Ref gdb/11763 - can't stop a running simulator: o Provide poll_quit callback to simulators so that they can poll for SIGINT on clueless OS's. o Add sim_stop to simulators so that clients can request a halt (eg gdbtk's STOP button) Works for PPC! o Re-arange remote-sim.c so that the hard work is moved from gdbsim_resume() to gdbsim_wait() (where it should be). --- sim/sh/ChangeLog | 5 +++++ sim/sh/interp.c | 34 ++++++++++++---------------------- 2 files changed, 17 insertions(+), 22 deletions(-) (limited to 'sim/sh') diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog index 91bcaefef3..91dfd345d1 100644 --- a/sim/sh/ChangeLog +++ b/sim/sh/ChangeLog @@ -1,3 +1,8 @@ +Fri Apr 18 14:14:49 1997 Andrew Cagney + + * interp.c (sim_stop): New function. + (sim_resume): Use poll_quit for polling. + Thu Apr 17 03:32:04 1997 Doug Evans * Makefile.in (SIM_OBJS): Add sim-load.o. diff --git a/sim/sh/interp.c b/sim/sh/interp.c index f50c76b9ca..98f10e80a5 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -883,6 +883,14 @@ gotcall (from, to) #define MMASKB ((saved_state.asregs.msize -1) & ~0) +int +sim_stop (sd) + SIM_DESC sd; +{ + saved_state.asregs.exception = SIGINT; + return 1; +} + void sim_resume (sd, step, siggnal) SIM_DESC sd; @@ -896,9 +904,7 @@ sim_resume (sd, step, siggnal) register int prevlock; register int thislock; register unsigned int doprofile; -#if defined(__GO32__) || defined(WIN32) register int pollcount = 0; -#endif register int little_endian = little_endian_p; int tick_start = get_now (); @@ -959,32 +965,16 @@ sim_resume (sd, step, siggnal) pc += 2; -#ifdef __GO32__ pollcount++; if (pollcount > 1000) { pollcount = 0; - if (kbhit()) { - int k = getkey(); - if (k == 1) - saved_state.asregs.exception = SIGINT; - - } - } -#endif - /* FIXME: Testing for INSIDE_SIMULATOR is wrong. - Only one copy of interp.o is built. */ -#if defined (WIN32) && !defined(INSIDE_SIMULATOR) - pollcount++; - if (pollcount > 1000) - { - pollcount = 0; - if (win32pollquit()) + if ((*callback->poll_quit) != NULL + && (*callback->poll_quit) (sd)) { - control_c(); - } + sim_stop (sd); + } } -#endif #ifndef ACE_FAST prevlock = thislock; -- cgit v1.2.1