diff options
author | David Edelsohn <dje.gcc@gmail.com> | 1996-12-09 02:06:42 +0000 |
---|---|---|
committer | David Edelsohn <dje.gcc@gmail.com> | 1996-12-09 02:06:42 +0000 |
commit | 163a75afdb6b998ab0aeb4eca6017ad4a8e5f0c9 (patch) | |
tree | 06b385c3eb062bb8eee0cc0cff6c13e92bd79cbe | |
parent | e1144153325b53ae84cb9e1b5ac21e1a632d9fc3 (diff) | |
download | gdb-163a75afdb6b998ab0aeb4eca6017ad4a8e5f0c9.zip gdb-163a75afdb6b998ab0aeb4eca6017ad4a8e5f0c9.tar.gz gdb-163a75afdb6b998ab0aeb4eca6017ad4a8e5f0c9.tar.bz2 |
* remote-sim.h: Update some comments.
* remote-sim.c (gdb_os_error): New function.
(init_callbacks): Fix initializing of gdb_callback. Add gdb_os_error.
(gdb_os_printf_filtered): Use gdb_stdout, not stdout.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/remote-sim.c | 49 | ||||
-rw-r--r-- | gdb/remote-sim.h | 25 |
3 files changed, 56 insertions, 25 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7db31d2..3cddbd2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +Sun Dec 8 18:02:57 1996 Doug Evans <dje@canuck.cygnus.com> + + * remote-sim.h: Update some comments. + * remote-sim.c (gdb_os_error): New function. + (init_callbacks): Fix initializing of gdb_callback. Add gdb_os_error. + (gdb_os_printf_filtered): Use gdb_stdout, not stdout. + Sun Dec 8 00:36:31 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * irix5-nat.c (supply_gregset, fill_gregset): Handle gregsets diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 5b5c107..e9c32db 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -48,6 +48,8 @@ static int gdb_os_write_stdout PARAMS ((host_callback *, const char *, int)); static void gdb_os_printf_filtered PARAMS ((host_callback *, const char *, ...)); +static void gdb_os_error PARAMS ((host_callback *, const char *, ...)); + static void gdbsim_fetch_register PARAMS ((int regno)); static void gdbsim_store_register PARAMS ((int regno)); @@ -127,9 +129,10 @@ init_callbacks () if (! callbacks_initialized) { gdb_callback = default_callback; - default_callback.init (&gdb_callback); - default_callback.write_stdout = gdb_os_write_stdout; - default_callback.printf_filtered = gdb_os_printf_filtered; + gdb_callback.init (&gdb_callback); + gdb_callback.write_stdout = gdb_os_write_stdout; + gdb_callback.printf_filtered = gdb_os_printf_filtered; + gdb_callback.error = gdb_os_error; sim_set_callbacks (&gdb_callback); callbacks_initialized = 1; } @@ -192,11 +195,45 @@ gdb_os_printf_filtered (p, va_alist) format = va_arg (args, char *); #endif - vfprintf_filtered (stdout, format, args); + vfprintf_filtered (gdb_stdout, format, args); va_end (args); } +/* GDB version of error callback. */ + +/* VARARGS */ +static void +#ifdef ANSI_PROTOTYPES +gdb_os_error (host_callback *p, const char *format, ...) +#else +gdb_os_error (p, va_alist) + host_callback *p; + va_dcl +#endif +{ + if (error_hook) + (*error_hook) (); + else + { + va_list args; +#ifdef ANSI_PROTOTYPES + va_start (args, format); +#else + char *format; + + va_start (args); + format = va_arg (args, char *); +#endif + + error_begin (); + vfprintf_filtered (gdb_stderr, format, args); + fprintf_filtered (gdb_stderr, "\n"); + va_end (args); + return_to_top_level (RETURN_ERROR); + } +} + static void gdbsim_fetch_register (regno) int regno; @@ -283,7 +320,7 @@ gdbsim_load (prog, fromtty) /* Start an inferior process and set inferior_pid to its pid. EXEC_FILE is the file to run. - ALLARGS is a string containing the arguments to the program. + ARGS is a string containing the arguments to the program. ENV is the environment vector to pass. Errors reported with error(). On VxWorks and various standalone systems, we ignore exec_file. */ /* This is called not only when we first attach, but also when the @@ -315,7 +352,7 @@ gdbsim_create_inferior (exec_file, args, env) remove_breakpoints (); init_wait_for_inferior (); - len = 5 + strlen (exec_file) + 1 + strlen (args) + 1 + /*slop*/ 10; + len = strlen (exec_file) + 1 + strlen (args) + 1 + /*slop*/ 10; arg_buf = (char *) alloca (len); arg_buf[0] = '\0'; strcat (arg_buf, exec_file); diff --git a/gdb/remote-sim.h b/gdb/remote-sim.h index 1281e70..77d5432 100644 --- a/gdb/remote-sim.h +++ b/gdb/remote-sim.h @@ -1,5 +1,5 @@ /* This file defines the interface between the simulator and gdb. - Copyright (C) 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc. This file is part of GDB. @@ -32,28 +32,15 @@ typedef unsigned int SIM_ADDR; typedef CORE_ADDR_TYPE SIM_ADDR; #endif -/* Callbacks. - The simulator may use the following callbacks (gdb routines) which the - standalone program must provide. - - void error /-* noreturn *-/ (char *msg, ...); - void *xmalloc (long size); - - I/O is done by using a pointer provided by GDB via the sim_set_callbacks - call, look in callbacks.c to see what can be done. -*/ - -/* Main simulator entry points ... - - All functions that can get an error must call the gdb routine `error', - they can only return upon success. */ +/* Main simulator entry points. */ /* Initialize the simulator. This function is called when the simulator - is selected from the command line. ARGS is passed from the command line + is selected from the command line. ARGS is passed from the command line and can be used to select whatever run time options the simulator provides. ARGS is the raw character string and must be parsed by the simulator, - which is trivial to do with the buildargv function in libiberty. - It is ok to do nothing. */ + which is trivial to do with the buildargv function in libiberty. */ +/* FIXME: Eventually create a STATE and return its address and pass it to + all other main entry points. */ void sim_open PARAMS ((char *args)); |