source: trunk/src/binutils/include/gdb/remote-sim.h@ 607

Last change on this file since 607 was 607, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 9.7 KB
Line 
1/* This file defines the interface between the simulator and gdb.
2
3 Copyright 1993, 1994, 1996, 1997, 1998, 2000, 2002 Free Software
4 Foundation, Inc.
5
6This file is part of GDB.
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2 of the License, or
11(at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with this program; if not, write to the Free Software
20Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21
22#if !defined (REMOTE_SIM_H)
23#define REMOTE_SIM_H 1
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/* This file is used when building stand-alone simulators, so isolate this
30 file from gdb. */
31
32/* Pick up CORE_ADDR_TYPE if defined (from gdb), otherwise use same value as
33 gdb does (unsigned int - from defs.h). */
34
35#ifndef CORE_ADDR_TYPE
36typedef unsigned int SIM_ADDR;
37#else
38typedef CORE_ADDR_TYPE SIM_ADDR;
39#endif
40
41
42/* Semi-opaque type used as result of sim_open and passed back to all
43 other routines. "desc" is short for "descriptor".
44 It is up to each simulator to define `sim_state'. */
45
46typedef struct sim_state *SIM_DESC;
47
48
49/* Values for `kind' arg to sim_open. */
50
51typedef enum {
52 SIM_OPEN_STANDALONE, /* simulator used standalone (run.c) */
53 SIM_OPEN_DEBUG /* simulator used by debugger (gdb) */
54} SIM_OPEN_KIND;
55
56
57/* Return codes from various functions. */
58
59typedef enum {
60 SIM_RC_FAIL = 0,
61 SIM_RC_OK = 1
62} SIM_RC;
63
64
65/* The bfd struct, as an opaque type. */
66
67struct bfd;
68
69
70/* Main simulator entry points. */
71
72
73/* Create a fully initialized simulator instance.
74
75 (This function is called when the simulator is selected from the
76 gdb command line.)
77
78 KIND specifies how the simulator shall be used. Currently there
79 are only two kinds: stand-alone and debug.
80
81 CALLBACK specifies a standard host callback (defined in callback.h).
82
83 ABFD, when non NULL, designates a target program. The program is
84 not loaded.
85
86 ARGV is a standard ARGV pointer such as that passed from the
87 command line. The syntax of the argument list is is assumed to be
88 ``SIM-PROG { SIM-OPTION } [ TARGET-PROGRAM { TARGET-OPTION } ]''.
89 The trailing TARGET-PROGRAM and args are only valid for a
90 stand-alone simulator.
91
92 On success, the result is a non NULL descriptor that shall be
93 passed to the other sim_foo functions. While the simulator
94 configuration can be parameterized by (in decreasing precedence)
95 ARGV's SIM-OPTION, ARGV's TARGET-PROGRAM and the ABFD argument, the
96 successful creation of the simulator shall not dependent on the
97 presence of any of these arguments/options.
98
99 Hardware simulator: The created simulator shall be sufficiently
100 initialized to handle, with out restrictions any client requests
101 (including memory reads/writes, register fetch/stores and a
102 resume).
103
104 Process simulator: that process is not created until a call to
105 sim_create_inferior. FIXME: What should the state of the simulator
106 be? */
107
108SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND kind, struct host_callback_struct *callback, struct bfd *abfd, char **argv));
109
110
111/* Destory a simulator instance.
112
113 QUITTING is non-zero if we cannot hang on errors.
114
115 This may involve freeing target memory and closing any open files
116 and mmap'd areas. You cannot assume sim_kill has already been
117 called. */
118
119void sim_close PARAMS ((SIM_DESC sd, int quitting));
120
121
122/* Load program PROG into the simulators memory.
123
124 If ABFD is non-NULL, the bfd for the file has already been opened.