Commit | Line | Data |
---|---|---|
b562a186 | 1 | /* This file defines the interface between the simulator and gdb. |
163a75af | 2 | Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc. |
b562a186 DE |
3 | |
4 | This file is part of GDB. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
6c9638b4 | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
b562a186 DE |
19 | |
20 | #if !defined (REMOTE_SIM_H) | |
21 | #define REMOTE_SIM_H 1 | |
22 | ||
c7efaa16 DE |
23 | /* This file is used when building stand-alone simulators, so isolate this |
24 | file from gdb. */ | |
25 | ||
26 | /* Pick up CORE_ADDR_TYPE if defined (from gdb), otherwise use same value as | |
27 | gdb does (unsigned int - from defs.h). */ | |
28 | ||
29 | #ifndef CORE_ADDR_TYPE | |
30 | typedef unsigned int SIM_ADDR; | |
31 | #else | |
32 | typedef CORE_ADDR_TYPE SIM_ADDR; | |
33 | #endif | |
34 | ||
163a75af | 35 | /* Main simulator entry points. */ |
b562a186 DE |
36 | |
37 | /* Initialize the simulator. This function is called when the simulator | |
163a75af | 38 | is selected from the command line. ARGS is passed from the command line |
b562a186 | 39 | and can be used to select whatever run time options the simulator provides. |
47424e79 | 40 | ARGS is the raw character string and must be parsed by the simulator, |
163a75af DE |
41 | which is trivial to do with the buildargv function in libiberty. */ |
42 | /* FIXME: Eventually create a STATE and return its address and pass it to | |
43 | all other main entry points. */ | |
40b92220 | 44 | |
47424e79 | 45 | void sim_open PARAMS ((char *args)); |
b562a186 | 46 | |
47424e79 DE |
47 | /* Terminate usage of the simulator. This may involve freeing target memory |
48 | and closing any open files and mmap'd areas. You cannot assume sim_kill | |
49 | has already been called. | |
50 | QUITTING is non-zero if we cannot hang on errors. */ | |
b562a186 | 51 | |
47424e79 | 52 | void sim_close PARAMS ((int quitting)); |
b562a186 | 53 | |
47424e79 DE |
54 | /* Load program PROG into the simulator. |
55 | Return non-zero if you wish the caller to handle it | |
56 | (it is done this way because most simulators can use gr_load_image, | |
57 | but defining it as a callback seems awkward). */ | |
b562a186 | 58 | |
47424e79 | 59 | int sim_load PARAMS ((char *prog, int from_tty)); |
b562a186 | 60 | |
47424e79 DE |
61 | /* Prepare to run the simulated program. |
62 | START_ADDRESS is, yes, you guessed it, the start address of the program. | |
63 | ARGV and ENV are NULL terminated lists of pointers. | |
64 | Gdb will set the start address via sim_store_register as well, but | |
65 | standalone versions of existing simulators are not set up to cleanly call | |
66 | sim_store_register, so the START_ADDRESS argument is there as a | |
67 | workaround. */ | |
b562a186 | 68 | |
47424e79 DE |
69 | void sim_create_inferior PARAMS ((SIM_ADDR start_address, |
70 | char **argv, char **env)); | |
b562a186 DE |
71 | |
72 | /* Kill the running program. | |
73 | This may involve closing any open files and deleting any mmap'd areas. */ | |
74 | ||
47424e79 | 75 | void sim_kill PARAMS ((void)); |
b562a186 | 76 | |
592f517a DE |
77 | /* Read LENGTH bytes of the simulated program's memory and store in BUF. |
78 | Result is number of bytes read, or zero if error. */ | |
b562a186 | 79 | |
c7efaa16 | 80 | int sim_read PARAMS ((SIM_ADDR mem, unsigned char *buf, int length)); |
b562a186 | 81 | |
592f517a DE |
82 | /* Store LENGTH bytes from BUF in the simulated program's memory. |
83 | Result is number of bytes write, or zero if error. */ | |
b562a186 | 84 | |
c7efaa16 | 85 | int sim_write PARAMS ((SIM_ADDR mem, unsigned char *buf, int length)); |
b562a186 | 86 | |
47424e79 | 87 | /* Fetch register REGNO and store the raw value in BUF. */ |
b562a186 | 88 | |
47424e79 DE |
89 | void sim_fetch_register PARAMS ((int regno, unsigned char *buf)); |
90 | ||
91 | /* Store register REGNO from BUF (in raw format). */ | |
b562a186 | 92 | |
47424e79 DE |
93 | void sim_store_register PARAMS ((int regno, unsigned char *buf)); |
94 | ||
95 | /* Print some interesting information about the simulator. | |
96 | VERBOSE is non-zero for the wordy version. */ | |
b562a186 | 97 | |
47424e79 | 98 | void sim_info PARAMS ((int verbose)); |
b562a186 | 99 | |
592f517a DE |
100 | /* Fetch why the program stopped. |
101 | SIGRC will contain either the argument to exit() or the signal number. */ | |
b562a186 | 102 | |
592f517a DE |
103 | enum sim_stop { sim_exited, sim_stopped, sim_signalled }; |
104 | ||
47424e79 | 105 | void sim_stop_reason PARAMS ((enum sim_stop *reason, int *sigrc)); |
b562a186 DE |
106 | |
107 | /* Run (or resume) the program. */ | |
108 | ||
47424e79 | 109 | void sim_resume PARAMS ((int step, int siggnal)); |
b562a186 | 110 | |
fb506180 SS |
111 | /* Passthru for other commands that the simulator might support. */ |
112 | ||
113 | void sim_do_command PARAMS ((char *cmd)); | |
114 | ||
4a29aa84 SC |
115 | /* Provide simulator with a standard host_callback_struct. */ |
116 | ||
117 | void sim_set_callbacks PARAMS ((struct host_callback_struct *)); | |
118 | ||
b562a186 | 119 | #endif /* !defined (REMOTE_SIM_H) */ |