aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-04-18 12:24:52 +0000
committerAndrew Cagney <cagney@redhat.com>1997-04-18 12:24:52 +0000
commit8517f62b166073b871c896fdd642798fae4a08bd (patch)
tree805af7156e712458e58d2ebe21fc7b0b73dee681 /include
parent2d3588808f00aaa6784f004aa940b862a11be3a2 (diff)
downloadgdb-8517f62b166073b871c896fdd642798fae4a08bd.zip
gdb-8517f62b166073b871c896fdd642798fae4a08bd.tar.gz
gdb-8517f62b166073b871c896fdd642798fae4a08bd.tar.bz2
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).
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog14
-rw-r--r--include/callback.h11
-rw-r--r--include/remote-sim.h37
3 files changed, 59 insertions, 3 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index 5fbea8e..22f2fe7 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,17 @@
+Fri Apr 18 13:04:49 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * remote-sim.h (sim_stop): New interface - asynchronous
+ notification of a request to stop / suspend the running
+ simulation.
+
+ * remote-sim.h (enum sim_stop): Add sim_running and sim_polling as
+ states for use internal to simulators.
+
+ * callback.h (struct host_callback_strut): Put a magic number at
+ the end of the struct to allow basic checking.
+ (struct host_callback_struct ): Add poll_quit - so
+ that the console etc can be polled at regular intervals.
+
Thu Apr 17 02:17:12 1997 Doug Evans <dje@canuck.cygnus.com>
* remote-sim.h (struct _bfd): Declare.
diff --git a/include/callback.h b/include/callback.h
index 0d689cb..1070706 100644
--- a/include/callback.h
+++ b/include/callback.h
@@ -52,6 +52,11 @@ struct host_callback_struct
int (*write_stderr) PARAMS ((host_callback *, const char *, int));
void (*flush_stderr) PARAMS ((host_callback *));
+ /* When present, call to the client to give it the oportunity to
+ poll any io devices for a request to quit (indicated by a nonzero
+ return value). */
+ int (*poll_quit) PARAMS ((host_callback *));
+
/* Used when the target has gone away, so we can close open
handles and free memory etc etc. */
int (*shutdown) PARAMS ((host_callback *));
@@ -76,6 +81,12 @@ struct host_callback_struct
int fdmap[MAX_CALLBACK_FDS];
char fdopen[MAX_CALLBACK_FDS];
char alwaysopen[MAX_CALLBACK_FDS];
+
+ /* Marker for thse wanting to do sanity checks.
+ This should remain the last memeber of this struct to help catch
+ miscompilation errors. */
+#define HOST_CALLBACK_MAGIC 4705 /* teds constant */
+ int magic;
};
extern host_callback default_callback;
diff --git a/include/remote-sim.h b/include/remote-sim.h
index 4bc4335..7e89d4c 100644
--- a/include/remote-sim.h
+++ b/include/remote-sim.h
@@ -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. */