]>
Commit | Line | Data |
---|---|---|
b562a186 DE |
1 | /* This file defines the interface between the simulator and gdb. |
2 | Copyright (C) 1993 Free Software Foundation, Inc. | |
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 | |
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
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 | ||
b562a186 DE |
35 | /* Main simulator globals ... */ |
36 | ||
37 | extern int sim_verbose; | |
38 | ||
39 | /* Main simulator entry points ... | |
40 | ||
c7efaa16 DE |
41 | Except where noted, all functions return 0 for success and non-zero for |
42 | failure. Sometimes there won't be much possibility of error, but maybe | |
43 | in the future. */ | |
b562a186 DE |
44 | |
45 | /* Initialize the simulator. This function is called when the simulator | |
46 | is selected from the command line. ARGS is passed from the command line | |
47 | and can be used to select whatever run time options the simulator provides. | |
40b92220 JK |
48 | ARGS is the raw character string and must be parsed by the simulator. |
49 | ||
50 | Returns 0 for success, non-zero for failure (FIXME: how do we say what | |
51 | kind of failure it was?). */ | |
b562a186 DE |
52 | |
53 | int sim_open PARAMS ((char *name)); | |
54 | ||
55 | /* Load program PROG into the simulator. | |
56 | We use "void *" instead of "bfd *" to isolate this file from BFD. */ | |
57 | ||
58 | int sim_load PARAMS ((void *bfd_handle, char *args)); | |
59 | ||
60 | /* Set the arguments and environment for the program loaded into the | |
61 | simulator. ARGV and ENV are NULL terminated lists of pointers. | |
62 | If the simulator doesn't support setting arguments, print an error message | |
63 | and return non-zero. */ | |
64 | ||
65 | int sim_set_args PARAMS ((char **argv, char **env)); | |
66 | ||
67 | /* Fetch register REGNO and store the raw value in BUF. */ | |
68 | ||
c7efaa16 | 69 | int sim_fetch_register PARAMS ((int regno, unsigned char *buf)); |
b562a186 DE |
70 | |
71 | /* Store register REGNO from BUF (in raw format). */ | |
72 | ||
c7efaa16 | 73 | int sim_store_register PARAMS ((int regno, unsigned char *buf)); |
b562a186 DE |
74 | |
75 | /* Kill the running program. | |
76 | This may involve closing any open files and deleting any mmap'd areas. */ | |
77 | ||
78 | int sim_kill PARAMS ((void)); | |
79 | ||
592f517a DE |
80 | /* Read LENGTH bytes of the simulated program's memory and store in BUF. |
81 | Result is number of bytes read, or zero if error. */ | |
b562a186 | 82 | |
c7efaa16 | 83 | int sim_read PARAMS ((SIM_ADDR mem, unsigned char *buf, int length)); |
b562a186 | 84 | |
592f517a DE |
85 | /* Store LENGTH bytes from BUF in the simulated program's memory. |
86 | Result is number of bytes write, or zero if error. */ | |
b562a186 | 87 | |
c7efaa16 | 88 | int sim_write PARAMS ((SIM_ADDR mem, unsigned char *buf, int length)); |
b562a186 | 89 | |
c7efaa16 DE |
90 | /* Print some interesting information about the simulator. |
91 | VERBOSE is non-zero for the wordy version. */ | |
b562a186 | 92 | |
c7efaa16 | 93 | int sim_info PARAMS ((void (*printf_fn)(), int verbose)); |
b562a186 DE |
94 | |
95 | /* Set the simulated cpu's program counter to PC. */ | |
96 | ||
c7efaa16 | 97 | int sim_set_pc PARAMS ((SIM_ADDR pc)); |
b562a186 | 98 | |
592f517a DE |
99 | /* Fetch why the program stopped. |
100 | SIGRC will contain either the argument to exit() or the signal number. */ | |
b562a186 | 101 | |
592f517a DE |
102 | enum sim_stop { sim_exited, sim_stopped, sim_signalled }; |
103 | ||
c7efaa16 | 104 | int sim_stop_reason PARAMS ((enum sim_stop *reason, int *sigrc)); |
b562a186 DE |
105 | |
106 | /* Run (or resume) the program. */ | |
107 | ||
108 | int sim_resume PARAMS ((int step, int siggnal)); | |
109 | ||
110 | #endif /* !defined (REMOTE_SIM_H) */ |