Sanitize for v850.
[deliverable/binutils-gdb.git] / gdb / remote-sim.h
CommitLineData
b562a186 1/* This file defines the interface between the simulator and gdb.
47424e79 2 Copyright (C) 1993, 1994 Free Software Foundation, Inc.
b562a186
DE
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
6c9638b4 18Foundation, 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
4a29aa84 23#include "callback.h"
c7efaa16
DE
24/* This file is used when building stand-alone simulators, so isolate this
25 file from gdb. */
26
27/* Pick up CORE_ADDR_TYPE if defined (from gdb), otherwise use same value as
28 gdb does (unsigned int - from defs.h). */
29
30#ifndef CORE_ADDR_TYPE
31typedef unsigned int SIM_ADDR;
32#else
33typedef CORE_ADDR_TYPE SIM_ADDR;
34#endif
35
47424e79
DE
36/* Callbacks.
37 The simulator may use the following callbacks (gdb routines) which the
38 standalone program must provide.
b562a186 39
47424e79
DE
40 void printf_filtered (char *msg, ...);
41 void error /-* noreturn *-/ (char *msg, ...);
42 void *xmalloc (long size);
cc274a2e 43 int sim_callback_write_stdout (char *, int len);
4a29aa84
SC
44
45 The new way of doing I/O is to use the pointer provided by GDB
46 via the sim_set_callbacks call, look in callbacks.c to see what
47 can be done.
47424e79 48*/
b562a186
DE
49
50/* Main simulator entry points ...
51
47424e79
DE
52 All functions that can get an error must call the gdb routine `error',
53 they can only return upon success. */
b562a186
DE
54
55/* Initialize the simulator. This function is called when the simulator
56 is selected from the command line. ARGS is passed from the command line
57 and can be used to select whatever run time options the simulator provides.
47424e79
DE
58 ARGS is the raw character string and must be parsed by the simulator,
59 which is trivial to do with the buildargv function in libiberty.
60 It is ok to do nothing. */
40b92220 61
47424e79 62void sim_open PARAMS ((char *args));
b562a186 63
47424e79
DE
64/* Terminate usage of the simulator. This may involve freeing target memory
65 and closing any open files and mmap'd areas. You cannot assume sim_kill
66 has already been called.
67 QUITTING is non-zero if we cannot hang on errors. */
b562a186 68
47424e79 69void sim_close PARAMS ((int quitting));
b562a186 70
47424e79
DE
71/* Load program PROG into the simulator.
72 Return non-zero if you wish the caller to handle it
73 (it is done this way because most simulators can use gr_load_image,
74 but defining it as a callback seems awkward). */
b562a186 75
47424e79 76int sim_load PARAMS ((char *prog, int from_tty));
b562a186 77
47424e79
DE
78/* Prepare to run the simulated program.
79 START_ADDRESS is, yes, you guessed it, the start address of the program.
80 ARGV and ENV are NULL terminated lists of pointers.
81 Gdb will set the start address via sim_store_register as well, but
82 standalone versions of existing simulators are not set up to cleanly call
83 sim_store_register, so the START_ADDRESS argument is there as a
84 workaround. */
b562a186 85
47424e79
DE
86void sim_create_inferior PARAMS ((SIM_ADDR start_address,
87 char **argv, char **env));
b562a186
DE
88
89/* Kill the running program.
90 This may involve closing any open files and deleting any mmap'd areas. */
91
47424e79 92void sim_kill PARAMS ((void));
b562a186 93
592f517a
DE
94/* Read LENGTH bytes of the simulated program's memory and store in BUF.
95 Result is number of bytes read, or zero if error. */
b562a186 96
c7efaa16 97int sim_read PARAMS ((SIM_ADDR mem, unsigned char *buf, int length));
b562a186 98
592f517a
DE
99/* Store LENGTH bytes from BUF in the simulated program's memory.
100 Result is number of bytes write, or zero if error. */
b562a186 101
c7efaa16 102int sim_write PARAMS ((SIM_ADDR mem, unsigned char *buf, int length));
b562a186 103
47424e79 104/* Fetch register REGNO and store the raw value in BUF. */
b562a186 105
47424e79
DE
106void sim_fetch_register PARAMS ((int regno, unsigned char *buf));
107
108/* Store register REGNO from BUF (in raw format). */
b562a186 109
47424e79
DE
110void sim_store_register PARAMS ((int regno, unsigned char *buf));
111
112/* Print some interesting information about the simulator.
113 VERBOSE is non-zero for the wordy version. */
b562a186 114
47424e79 115void sim_info PARAMS ((int verbose));
b562a186 116
592f517a
DE
117/* Fetch why the program stopped.
118 SIGRC will contain either the argument to exit() or the signal number. */
b562a186 119
592f517a
DE
120enum sim_stop { sim_exited, sim_stopped, sim_signalled };
121
47424e79 122void sim_stop_reason PARAMS ((enum sim_stop *reason, int *sigrc));
b562a186
DE
123
124/* Run (or resume) the program. */
125
47424e79 126void sim_resume PARAMS ((int step, int siggnal));
b562a186 127
fb506180
SS
128/* Passthru for other commands that the simulator might support. */
129
130void sim_do_command PARAMS ((char *cmd));
131
6b009ef6
SC
132
133/* Callbacks for the simulator to use. */
134
cc274a2e 135int sim_callback_write_stdout PARAMS ((char *, int));
6b009ef6 136
4a29aa84
SC
137/* Provide simulator with a standard host_callback_struct. */
138
139void sim_set_callbacks PARAMS ((struct host_callback_struct *));
140
141
b562a186 142#endif /* !defined (REMOTE_SIM_H) */
This page took 0.24222 seconds and 4 git commands to generate.