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).
This commit is contained in:
Andrew Cagney
1997-04-18 12:24:52 +00:00
parent 2d3588808f
commit 8517f62b16
20 changed files with 693 additions and 40 deletions

View File

@@ -53,8 +53,10 @@ typedef enum {
/* The bfd struct, as an opaque type. */
struct _bfd;
/* Main simulator entry points. */
/* Initialize the simulator. This function is called when the simulator
is selected from the gdb command line.
KIND specifies how the simulator will be used. Currently there are only
@@ -67,6 +69,7 @@ struct _bfd;
SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND kind, char **argv));
/* Terminate usage of the simulator. This may involve freeing target memory
and closing any open files and mmap'd areas. You cannot assume sim_kill
has already been called.
@@ -74,62 +77,90 @@ SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND kind, char **argv));
void sim_close PARAMS ((SIM_DESC sd, int quitting));
/* Load program PROG into the simulator.
If ABFD is non-NULL, the bfd for the file has already been opened.
The result is a return code indicating success. */
SIM_RC sim_load PARAMS ((SIM_DESC sd, char *prog, struct _bfd *abfd, int from_tty));
/* Prepare to run the simulated program.
ARGV and ENV are NULL terminated lists of pointers. */
SIM_RC sim_create_inferior PARAMS ((SIM_DESC sd, char **argv, char **env));
/* Kill the running program.
This may involve closing any open files and deleting any mmap'd areas. */
void sim_kill PARAMS ((SIM_DESC sd));
/* Read LENGTH bytes of the simulated program's memory and store in BUF.
Result is number of bytes read, or zero if error. */
int sim_read PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length));
/* Store LENGTH bytes from BUF in the simulated program's memory.
Result is number of bytes write, or zero if error. */
int sim_write PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length));
/* Fetch register REGNO and store the raw value in BUF. */
void sim_fetch_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf));
/* Store register REGNO from BUF (in raw format). */
void sim_store_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf));
/* Print whatever statistics the simulator has collected.
VERBOSE is currently unused and must always be zero. */
void sim_info PARAMS ((SIM_DESC sd, int verbose));
/* Fetch why the program stopped.
SIGRC will contain either the argument to exit() or the signal number. */
enum sim_stop { sim_exited, sim_stopped, sim_signalled };
/* Fetch the reason why the program stopped.
SIM_EXITED: The program has terminated. SIGRC indicates the target
dependant exit status.
SIM_STOPPED: Any of a breakpoint (SIGTRAP), a completed step
(SIGTRAP), a sim_stop request (SIGINT), or an internal error
condition (SIGABRT) was encountered.
SIM_SIGNALLED: The simulator encountered target code that requires
the signal SIGRC to be delivered to the simulated program.
SIM_RUNNING, SIM_POLLING: The return of one of these values
indicates a problem internal to the simulator. */
enum sim_stop { sim_running, sim_polling, sim_exited, sim_stopped, sim_signalled };
void sim_stop_reason PARAMS ((SIM_DESC sd, enum sim_stop *reason, int *sigrc));
/* Run (or resume) the program. */
void sim_resume PARAMS ((SIM_DESC sd, int step, int siggnal));
/* Asynchronous request to stop the simulation.
A nonzero return indicates that the simulator is able to handle
the request */
int sim_stop PARAMS ((SIM_DESC sd));
/* Passthru for other commands that the simulator might support.
If SD is NULL, the command is to be interpreted as refering to
the global state, however the simulator defines that. */
void sim_do_command PARAMS ((SIM_DESC sd, char *cmd));
/* Provide simulator with a standard host_callback_struct.
If SD is NULL, the command is to be interpreted as refering to
the global state, however the simulator defines that. */