* remote-sim.h: Delete - moved to ../include/remote-sim.h.
* Makefile.in (remote_utils_h): Update path to remote-sim.h. * remote-sim.c (flush_stdout, write_stderr, flush_stderr, vprintf_filtered, evprintf_filtered): Callbacks that accept varargs.
This commit is contained in:
parent
05e4e44f95
commit
48ae80573e
3 changed files with 99 additions and 129 deletions
|
@ -1,3 +1,15 @@
|
|||
Mon Mar 17 15:00:16 1997 Andrew Cagney <cagney@kremvax.cygnus.com>
|
||||
|
||||
* remote-sim.h: Delete - moved to ../include/remote-sim.h.
|
||||
|
||||
* Makefile.in (remote_utils_h): Update path to remote-sim.h.
|
||||
|
||||
Fri Mar 7 20:55:28 1997 Andrew Cagney <cagney@kremvax.cygnus.com>
|
||||
|
||||
* remote-sim.c (flush_stdout, write_stderr, flush_stderr,
|
||||
vprintf_filtered, evprintf_filtered): Callbacks that accept
|
||||
varargs.
|
||||
|
||||
Sat Mar 15 00:50:46 1997 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
|
||||
|
||||
* breakpoint.c (insert_breakpoints, watchpoint_check,
|
||||
|
|
|
@ -46,8 +46,19 @@ static void end_callbacks PARAMS ((void));
|
|||
|
||||
static int gdb_os_write_stdout PARAMS ((host_callback *, const char *, int));
|
||||
|
||||
static void gdb_os_flush_stdout PARAMS ((host_callback *));
|
||||
|
||||
static int gdb_os_write_stderr PARAMS ((host_callback *, const char *, int));
|
||||
|
||||
static void gdb_os_flush_stderr PARAMS ((host_callback *));
|
||||
|
||||
/* printf_filtered is depreciated */
|
||||
static void gdb_os_printf_filtered PARAMS ((host_callback *, const char *, ...));
|
||||
|
||||
static void gdb_os_vprintf_filtered PARAMS ((host_callback *, const char *, void *));
|
||||
|
||||
static void gdb_os_evprintf_filtered PARAMS ((host_callback *, const char *, void *));
|
||||
|
||||
static void gdb_os_error PARAMS ((host_callback *, const char *, ...));
|
||||
|
||||
static void gdbsim_fetch_register PARAMS ((int regno));
|
||||
|
@ -137,7 +148,12 @@ init_callbacks ()
|
|||
gdb_callback = default_callback;
|
||||
gdb_callback.init (&gdb_callback);
|
||||
gdb_callback.write_stdout = gdb_os_write_stdout;
|
||||
gdb_callback.flush_stdout = gdb_os_flush_stdout;
|
||||
gdb_callback.write_stderr = gdb_os_write_stderr;
|
||||
gdb_callback.flush_stderr = gdb_os_flush_stderr;
|
||||
gdb_callback.printf_filtered = gdb_os_printf_filtered;
|
||||
gdb_callback.vprintf_filtered = gdb_os_vprintf_filtered;
|
||||
gdb_callback.evprintf_filtered = gdb_os_evprintf_filtered;
|
||||
gdb_callback.error = gdb_os_error;
|
||||
sim_set_callbacks (gdbsim_desc, &gdb_callback);
|
||||
callbacks_initialized = 1;
|
||||
|
@ -179,6 +195,47 @@ gdb_os_write_stdout (p, buf, len)
|
|||
return len;
|
||||
}
|
||||
|
||||
/* GDB version of os_flush_stdout callback. */
|
||||
|
||||
static void
|
||||
gdb_os_flush_stdout (p)
|
||||
host_callback *p;
|
||||
{
|
||||
gdb_flush (gdb_stdout);
|
||||
}
|
||||
|
||||
/* GDB version of os_write_stderr callback. */
|
||||
|
||||
static int
|
||||
gdb_os_write_stderr (p, buf, len)
|
||||
host_callback *p;
|
||||
const char *buf;
|
||||
int len;
|
||||
{
|
||||
int i;
|
||||
char b[2];
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
b[0] = buf[i];
|
||||
b[1] = 0;
|
||||
if (target_output_hook)
|
||||
target_output_hook (b);
|
||||
else
|
||||
fputs_filtered (b, gdb_stderr);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
/* GDB version of os_flush_stderr callback. */
|
||||
|
||||
static void
|
||||
gdb_os_flush_stderr (p)
|
||||
host_callback *p;
|
||||
{
|
||||
gdb_flush (gdb_stderr);
|
||||
}
|
||||
|
||||
/* GDB version of printf_filtered callback. */
|
||||
|
||||
/* VARARGS */
|
||||
|
@ -206,6 +263,36 @@ gdb_os_printf_filtered (p, va_alist)
|
|||
va_end (args);
|
||||
}
|
||||
|
||||
/* GDB version of error vprintf_filtered. */
|
||||
|
||||
/* VARARGS */
|
||||
static void
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
gdb_os_vprintf_filtered (host_callback *p, const char *format, void *ap)
|
||||
#else
|
||||
gdb_os_vprintf_filtered (p, ap)
|
||||
host_callback *p;
|
||||
void *ap;
|
||||
#endif
|
||||
{
|
||||
vfprintf_filtered (gdb_stdout, format, (va_list)ap);
|
||||
}
|
||||
|
||||
/* GDB version of error evprintf_filtered. */
|
||||
|
||||
/* VARARGS */
|
||||
static void
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
gdb_os_evprintf_filtered (host_callback *p, const char *format, void *ap)
|
||||
#else
|
||||
gdb_os_vprintf_filtered (p, ap)
|
||||
host_callback *p;
|
||||
void *ap;
|
||||
#endif
|
||||
{
|
||||
vfprintf_filtered (gdb_stderr, format, (va_list)ap);
|
||||
}
|
||||
|
||||
/* GDB version of error callback. */
|
||||
|
||||
/* VARARGS */
|
||||
|
|
129
gdb/remote-sim.h
129
gdb/remote-sim.h
|
@ -1,129 +0,0 @@
|
|||
/* This file defines the interface between the simulator and gdb.
|
||||
Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if !defined (REMOTE_SIM_H)
|
||||
#define REMOTE_SIM_H 1
|
||||
|
||||
/* This file is used when building stand-alone simulators, so isolate this
|
||||
file from gdb. */
|
||||
|
||||
/* Pick up CORE_ADDR_TYPE if defined (from gdb), otherwise use same value as
|
||||
gdb does (unsigned int - from defs.h). */
|
||||
|
||||
#ifndef CORE_ADDR_TYPE
|
||||
typedef unsigned int SIM_ADDR;
|
||||
#else
|
||||
typedef CORE_ADDR_TYPE SIM_ADDR;
|
||||
#endif
|
||||
|
||||
/* Semi-opaque type used as result of sim_open and passed back to all
|
||||
other routines. "desc" is short for "descriptor".
|
||||
It is up to each simulator to define `sim_state'. */
|
||||
|
||||
typedef struct sim_state *SIM_DESC;
|
||||
|
||||
/* Main simulator entry points. */
|
||||
|
||||
/* Initialize the simulator. This function is called when the simulator
|
||||
is selected from the command line. ARGV is passed from the command line
|
||||
and can be used to select whatever run time options the simulator provides.
|
||||
ARGV is the standard NULL terminated array of pointers, with argv[0]
|
||||
being the program name.
|
||||
The result is a descriptor that must be passed back to the other sim_foo
|
||||
functions. */
|
||||
|
||||
SIM_DESC sim_open PARAMS ((char **argv));
|
||||
|
||||
/* Terminate usage of the simulator. This may involve freeing target memory
|
||||
and closing any open files and mmap'd areas. You cannot assume sim_kill
|
||||
has already been called.
|
||||
QUITTING is non-zero if we cannot hang on errors. */
|
||||
|
||||
void sim_close PARAMS ((SIM_DESC sd, int quitting));
|
||||
|
||||
/* Load program PROG into the simulator.
|
||||
Return non-zero if you wish the caller to handle it
|
||||
(it is done this way because most simulators can use gr_load_image,
|
||||
but defining it as a callback seems awkward). */
|
||||
|
||||
int sim_load PARAMS ((SIM_DESC sd, char *prog, int from_tty));
|
||||
|
||||
/* Prepare to run the simulated program.
|
||||
START_ADDRESS is, yes, you guessed it, the start address of the program.
|
||||
ARGV and ENV are NULL terminated lists of pointers.
|
||||
Gdb will set the start address via sim_store_register as well, but
|
||||
standalone versions of existing simulators are not set up to cleanly call
|
||||
sim_store_register, so the START_ADDRESS argument is there as a
|
||||
workaround. */
|
||||
|
||||
void sim_create_inferior PARAMS ((SIM_DESC sd, SIM_ADDR start_address,
|
||||
char **argv, char **env));
|
||||
|
||||
/* Kill the running program.
|
||||
This may involve closing any open files and deleting any mmap'd areas. */
|
||||
|
||||
void sim_kill PARAMS ((SIM_DESC sd));
|
||||
|
||||
/* Read LENGTH bytes of the simulated program's memory and store in BUF.
|
||||
Result is number of bytes read, or zero if error. */
|
||||
|
||||
int sim_read PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length));
|
||||
|
||||
/* Store LENGTH bytes from BUF in the simulated program's memory.
|
||||
Result is number of bytes write, or zero if error. */
|
||||
|
||||
int sim_write PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length));
|
||||
|
||||
/* Fetch register REGNO and store the raw value in BUF. */
|
||||
|
||||
void sim_fetch_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf));
|
||||
|
||||
/* Store register REGNO from BUF (in raw format). */
|
||||
|
||||
void sim_store_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf));
|
||||
|
||||
/* Print some interesting information about the simulator.
|
||||
VERBOSE is non-zero for the wordy version. */
|
||||
|
||||
void sim_info PARAMS ((SIM_DESC sd, int verbose));
|
||||
|
||||
/* Fetch why the program stopped.
|
||||
SIGRC will contain either the argument to exit() or the signal number. */
|
||||
|
||||
enum sim_stop { sim_exited, sim_stopped, sim_signalled };
|
||||
|
||||
void sim_stop_reason PARAMS ((SIM_DESC sd, enum sim_stop *reason, int *sigrc));
|
||||
|
||||
/* Run (or resume) the program. */
|
||||
|
||||
void sim_resume PARAMS ((SIM_DESC sd, int step, int siggnal));
|
||||
|
||||
/* Passthru for other commands that the simulator might support.
|
||||
If SD is NULL, the command is to be interpreted as refering to
|
||||
the global state, however the simulator defines that. */
|
||||
|
||||
void sim_do_command PARAMS ((SIM_DESC sd, char *cmd));
|
||||
|
||||
/* Provide simulator with a standard host_callback_struct.
|
||||
If SD is NULL, the command is to be interpreted as refering to
|
||||
the global state, however the simulator defines that. */
|
||||
|
||||
void sim_set_callbacks PARAMS ((SIM_DESC sd, struct host_callback_struct *));
|
||||
|
||||
#endif /* !defined (REMOTE_SIM_H) */
|
Loading…
Reference in a new issue