* gdb.base/setshow.exp: Don't run the set prompt tests if
[deliverable/binutils-gdb.git] / include / remote-sim.h
CommitLineData
05e4e44f
AC
1/* This file defines the interface between the simulator and gdb.
2 Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
3
4This file is part of GDB.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20#if !defined (REMOTE_SIM_H)
21#define REMOTE_SIM_H 1
22
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
30typedef unsigned int SIM_ADDR;
31#else
32typedef CORE_ADDR_TYPE SIM_ADDR;
33#endif
34
35/* Semi-opaque type used as result of sim_open and passed back to all
36 other routines. "desc" is short for "descriptor".
37 It is up to each simulator to define `sim_state'. */
38
39typedef struct sim_state *SIM_DESC;
40
b0d8c28f
DE
41/* Values for `kind' arg to sim_open. */
42typedef enum {
43 SIM_OPEN_STANDALONE, /* simulator used standalone (run.c) */
44 SIM_OPEN_DEBUG /* simulator used by debugger (gdb) */
45} SIM_OPEN_KIND;
46
47/* Return codes from various functions. */
48typedef enum {
49 SIM_RC_FAIL = 0,
50 SIM_RC_OK = 1
51} SIM_RC;
52
a1cb1f4b
DE
53/* The bfd struct, as an opaque type. */
54struct _bfd;
55
8517f62b 56
05e4e44f
AC
57/* Main simulator entry points. */
58
8517f62b 59
05e4e44f 60/* Initialize the simulator. This function is called when the simulator
38498962
DE
61 is selected from the gdb command line.
62 KIND specifies how the simulator will be used. Currently there are only
63 two kinds: standalone and debug.
24aa2b57 64 CALLBACK provides a standard host callback.
38498962 65 ARGV is passed from the command line and can be used to select whatever
a1cb1f4b
DE
66 run time options the simulator provides. It is the standard NULL
67 terminated array of pointers, with argv[0] being the program name.
05e4e44f
AC
68 The result is a descriptor that must be passed back to the other sim_foo
69 functions. */
70
24aa2b57 71SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND kind, struct host_callback_struct *callback, char **argv));
05e4e44f 72
8517f62b 73
05e4e44f
AC
74/* Terminate usage of the simulator. This may involve freeing target memory
75 and closing any open files and mmap'd areas. You cannot assume sim_kill
76 has already been called.
77 QUITTING is non-zero if we cannot hang on errors. */
78
79void sim_close PARAMS ((SIM_DESC sd, int quitting));
80
8517f62b 81
05e4e44f 82/* Load program PROG into the simulator.
a1cb1f4b
DE
83 If ABFD is non-NULL, the bfd for the file has already been opened.
84 The result is a return code indicating success. */
05e4e44f 85
a1cb1f4b 86SIM_RC sim_load PARAMS ((SIM_DESC sd, char *prog, struct _bfd *abfd, int from_tty));
05e4e44f 87
8517f62b 88
05e4e44f 89/* Prepare to run the simulated program.
a1cb1f4b 90 ARGV and ENV are NULL terminated lists of pointers. */
05e4e44f 91
a1cb1f4b 92SIM_RC sim_create_inferior PARAMS ((SIM_DESC sd, char **argv, char **env));
05e4e44f 93
8517f62b 94
05e4e44f
AC
95/* Kill the running program.
96 This may involve closing any open files and deleting any mmap'd areas. */
97
98void sim_kill PARAMS ((SIM_DESC sd));
99
8517f62b 100
05e4e44f
AC
101/* Read LENGTH bytes of the simulated program's memory and store in BUF.
102 Result is number of bytes read, or zero if error. */
103
104int sim_read PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length));
105
8517f62b 106
05e4e44f
AC
107/* Store LENGTH bytes from BUF in the simulated program's memory.
108 Result is number of bytes write, or zero if error. */
109
110int sim_write PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length));
111
8517f62b 112
05e4e44f
AC
113/* Fetch register REGNO and store the raw value in BUF. */
114
115void sim_fetch_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf));
116
8517f62b 117
05e4e44f
AC
118/* Store register REGNO from BUF (in raw format). */
119
120void sim_store_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf));
121
8517f62b 122
a1cb1f4b
DE
123/* Print whatever statistics the simulator has collected.
124 VERBOSE is currently unused and must always be zero. */
05e4e44f
AC
125
126void sim_info PARAMS ((SIM_DESC sd, int verbose));
127
05e4e44f 128
8517f62b
AC
129/* Fetch the reason why the program stopped.
130 SIM_EXITED: The program has terminated. SIGRC indicates the target
131 dependant exit status.
132 SIM_STOPPED: Any of a breakpoint (SIGTRAP), a completed step
133 (SIGTRAP), a sim_stop request (SIGINT), or an internal error
134 condition (SIGABRT) was encountered.
135 SIM_SIGNALLED: The simulator encountered target code that requires
136 the signal SIGRC to be delivered to the simulated program.
137 SIM_RUNNING, SIM_POLLING: The return of one of these values
138 indicates a problem internal to the simulator. */
139
140enum sim_stop { sim_running, sim_polling, sim_exited, sim_stopped, sim_signalled };
05e4e44f
AC
141
142void sim_stop_reason PARAMS ((SIM_DESC sd, enum sim_stop *reason, int *sigrc));
143
8517f62b 144
05e4e44f
AC
145/* Run (or resume) the program. */
146
147void sim_resume PARAMS ((SIM_DESC sd, int step, int siggnal));
148
8517f62b
AC
149
150/* Asynchronous request to stop the simulation.
151 A nonzero return indicates that the simulator is able to handle
152 the request */
153
154int sim_stop PARAMS ((SIM_DESC sd));
155
156
05e4e44f
AC
157/* Passthru for other commands that the simulator might support.
158 If SD is NULL, the command is to be interpreted as refering to
159 the global state, however the simulator defines that. */
160
8517f62b 161
05e4e44f
AC
162void sim_do_command PARAMS ((SIM_DESC sd, char *cmd));
163
8517f62b 164
ff82f214 165/* NOTE: sim_set_callbacks () is depreciated.
ff82f214 166 Provide simulator with a default (global) host_callback_struct. */
ff82f214
AC
167void sim_set_callbacks PARAMS ((struct host_callback_struct *));
168
24aa2b57 169
ff82f214 170/* NOTE: sim_size() is depreciated.
ff82f214
AC
171 sim_size() does not take a SIM_DESC argument as this function is
172 used before sim_open() has been called. */
ff82f214 173void sim_size PARAMS ((int i));
87e43259 174
87e43259 175
ff82f214 176/* NOTE: sim_trace() is depreciated. */
87e43259
AC
177int sim_trace PARAMS ((SIM_DESC sd));
178
179
50a2a691
AC
180/* NOTE: sim_set_profile_size is depreciated */
181void sim_set_profile_size PARAMS ((int n));
182
183
05e4e44f 184#endif /* !defined (REMOTE_SIM_H) */
This page took 0.036995 seconds and 4 git commands to generate.