From c7efaa16dc66169aea23dd5a52d38d815f072b2a Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Tue, 26 Oct 1993 16:34:01 +0000 Subject: [PATCH] * remote-sim.h (SIM_ADDR): New type (same as CORE_ADDR). (sim_set_pc): Update prototype. (sim_read, sim_write): Ditto, and use unsigned char *buf. (sim_fetch_register, sim_store_register): Use unsigned char *buf. (sim_info): Pass printf function as argument, add verbose argument. (sim_stop_reason): Renamed from sim_stop_signal, fix prototype. * remote-sim.c (gdbsim_wait): Update call to sim_stop_reason. (gdbsim_files_info): Update call to sim_info. --- gdb/ChangeLog | 11 +++++++++++ gdb/remote-sim.c | 6 ++++-- gdb/remote-sim.h | 33 ++++++++++++++++++++++++--------- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a2a4b368e6d..57fe7cc1776 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +Tue Oct 26 08:36:07 1993 Doug Evans (dje@canuck.cygnus.com) + + * remote-sim.h (SIM_ADDR): New type (same as CORE_ADDR). + (sim_set_pc): Update prototype. + (sim_read, sim_write): Ditto, and use unsigned char *buf. + (sim_fetch_register, sim_store_register): Use unsigned char *buf. + (sim_info): Pass printf function as argument, add verbose argument. + (sim_stop_reason): Renamed from sim_stop_signal, fix prototype. + * remote-sim.c (gdbsim_wait): Update call to sim_stop_reason. + (gdbsim_files_info): Update call to sim_info. + Tue Oct 26 10:41:29 1993 Jim Kingdon (kingdon@lioth.cygnus.com) * valops.c (value_assign): Call reinit_frame_cache when assigning diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 0c9308203d8..926d139d619 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -350,10 +350,12 @@ gdbsim_wait (pid, status) WAITTYPE *status; { int sigrc; + enum sim_stop reason; if (sr_get_debug ()) printf_filtered ("gdbsim_wait: "); - if (sim_stop_signal (&sigrc) == sim_exited) + sim_stop_reason (&reason, &sigrc); + if (reason == sim_exited) WSETEXIT (*status, sigrc); else WSETSTOP (*status, sigrc); @@ -422,7 +424,7 @@ gdbsim_files_info (target) { printf_filtered ("\tAttached to %s running program %s\n", target_shortname, file); - sim_info (); + sim_info (printf_filtered, 0); } } diff --git a/gdb/remote-sim.h b/gdb/remote-sim.h index 293be34905f..fb48c257b6c 100644 --- a/gdb/remote-sim.h +++ b/gdb/remote-sim.h @@ -20,13 +20,27 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, 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 + /* Main simulator globals ... */ extern int sim_verbose; /* Main simulator entry points ... - All functions return 0 for success and non-zero for failure. */ + Except where noted, all functions return 0 for success and non-zero for + failure. Sometimes there won't be much possibility of error, but maybe + in the future. */ /* Initialize the simulator. This function is called when the simulator is selected from the command line. ARGS is passed from the command line @@ -52,11 +66,11 @@ int sim_set_args PARAMS ((char **argv, char **env)); /* Fetch register REGNO and store the raw value in BUF. */ -int sim_fetch_register PARAMS ((int regno, char *buf)); +int sim_fetch_register PARAMS ((int regno, unsigned char *buf)); /* Store register REGNO from BUF (in raw format). */ -int sim_store_register PARAMS ((int regno, char *buf)); +int sim_store_register PARAMS ((int regno, unsigned char *buf)); /* Kill the running program. This may involve closing any open files and deleting any mmap'd areas. */ @@ -66,27 +80,28 @@ int sim_kill PARAMS ((void)); /* 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 ((CORE_ADDR mem, char *buf, int length)); +int sim_read PARAMS ((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 ((CORE_ADDR mem, char *buf, int length)); +int sim_write PARAMS ((SIM_ADDR mem, unsigned char *buf, int length)); -/* Print some interesting information about the simulator. */ +/* Print some interesting information about the simulator. + VERBOSE is non-zero for the wordy version. */ -int sim_info PARAMS ((void)); +int sim_info PARAMS ((void (*printf_fn)(), int verbose)); /* Set the simulated cpu's program counter to PC. */ -int sim_set_pc PARAMS ((CORE_ADDR pc)); +int sim_set_pc PARAMS ((SIM_ADDR pc)); /* 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 }; -enum sim_stop sim_stop_signal PARAMS ((int *sigrc)); +int sim_stop_reason PARAMS ((enum sim_stop *reason, int *sigrc)); /* Run (or resume) the program. */ -- 2.30.2