* scripttempl/mipsbsd.sc: Let sections align to their natural
[deliverable/binutils-gdb.git] / gdb / remote-sim.h
1 /* This file defines the interface between the simulator and gdb.
2 Copyright (C) 1993, 1994 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
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
35 /* Callbacks.
36 The simulator may use the following callbacks (gdb routines) which the
37 standalone program must provide.
38
39 void printf_filtered (char *msg, ...);
40 void error /-* noreturn *-/ (char *msg, ...);
41 void *xmalloc (long size);
42 */
43
44 /* Main simulator entry points ...
45
46 All functions that can get an error must call the gdb routine `error',
47 they can only return upon success. */
48
49 /* Initialize the simulator. This function is called when the simulator
50 is selected from the command line. ARGS is passed from the command line
51 and can be used to select whatever run time options the simulator provides.
52 ARGS is the raw character string and must be parsed by the simulator,
53 which is trivial to do with the buildargv function in libiberty.
54 It is ok to do nothing. */
55
56 void sim_open PARAMS ((char *args));
57
58 /* Terminate usage of the simulator. This may involve freeing target memory
59 and closing any open files and mmap'd areas. You cannot assume sim_kill
60 has already been called.
61 QUITTING is non-zero if we cannot hang on errors. */
62
63 void sim_close PARAMS ((int quitting));
64
65 /* Load program PROG into the simulator.
66 Return non-zero if you wish the caller to handle it
67 (it is done this way because most simulators can use gr_load_image,
68 but defining it as a callback seems awkward). */
69
70 int sim_load PARAMS ((char *prog, int from_tty));
71
72 /* Prepare to run the simulated program.
73 START_ADDRESS is, yes, you guessed it, the start address of the program.
74 ARGV and ENV are NULL terminated lists of pointers.
75 Gdb will set the start address via sim_store_register as well, but
76 standalone versions of existing simulators are not set up to cleanly call
77 sim_store_register, so the START_ADDRESS argument is there as a
78 workaround. */
79
80 void sim_create_inferior PARAMS ((SIM_ADDR start_address,
81 char **argv, char **env));
82
83 /* Kill the running program.
84 This may involve closing any open files and deleting any mmap'd areas. */
85
86 void sim_kill PARAMS ((void));
87
88 /* Read LENGTH bytes of the simulated program's memory and store in BUF.
89 Result is number of bytes read, or zero if error. */
90
91 int sim_read PARAMS ((SIM_ADDR mem, unsigned char *buf, int length));
92
93 /* Store LENGTH bytes from BUF in the simulated program's memory.
94 Result is number of bytes write, or zero if error. */
95
96 int sim_write PARAMS ((SIM_ADDR mem, unsigned char *buf, int length));
97
98 /* Fetch register REGNO and store the raw value in BUF. */
99
100 void sim_fetch_register PARAMS ((int regno, unsigned char *buf));
101
102 /* Store register REGNO from BUF (in raw format). */
103
104 void sim_store_register PARAMS ((int regno, unsigned char *buf));
105
106 /* Print some interesting information about the simulator.
107 VERBOSE is non-zero for the wordy version. */
108
109 void sim_info PARAMS ((int verbose));
110
111 /* Fetch why the program stopped.
112 SIGRC will contain either the argument to exit() or the signal number. */
113
114 enum sim_stop { sim_exited, sim_stopped, sim_signalled };
115
116 void sim_stop_reason PARAMS ((enum sim_stop *reason, int *sigrc));
117
118 /* Run (or resume) the program. */
119
120 void sim_resume PARAMS ((int step, int siggnal));
121
122 #endif /* !defined (REMOTE_SIM_H) */
This page took 0.033852 seconds and 4 git commands to generate.