mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-15 05:01:13 +08:00
* remote-sim.h (sim_verbose): Delete.
Document callbacks needed. (sim_*): Change result to void where there isn't one. (sim_open): Clarify argument and error response. (sim_close): Declare. (sim_load): Change bfd_handle argument to file name. Clarify result. (sim_create_inferior): Renamed from sim_set_args. (sim_set_pc): Delete. (sim_info): Delete printf_fn argument. * remote-sim.c (gdbsim_kill): Add comment describing purpose. (gdbsim_load): Try sim_load first. (gdbsim_create_inferior): Call sim_create_inferior. (gdbsim_open): Handle args == NULL. Update call to sim_open. (gdbsim_close): Call sim_close. (gdbsim_files_info): Update call to sim_info. (gdbsim_ops): Realign comments.
This commit is contained in:
@ -1,5 +1,22 @@
|
||||
Wed May 18 13:01:55 1994 Doug Evans (dje@canuck.cygnus.com)
|
||||
|
||||
* remote-sim.h (sim_verbose): Delete.
|
||||
Document callbacks needed.
|
||||
(sim_*): Change result to void where there isn't one.
|
||||
(sim_open): Clarify argument and error response.
|
||||
(sim_close): Declare.
|
||||
(sim_load): Change bfd_handle argument to file name. Clarify result.
|
||||
(sim_create_inferior): Renamed from sim_set_args.
|
||||
(sim_set_pc): Delete.
|
||||
(sim_info): Delete printf_fn argument.
|
||||
* remote-sim.c (gdbsim_kill): Add comment describing purpose.
|
||||
(gdbsim_load): Try sim_load first.
|
||||
(gdbsim_create_inferior): Call sim_create_inferior.
|
||||
(gdbsim_open): Handle args == NULL. Update call to sim_open.
|
||||
(gdbsim_close): Call sim_close.
|
||||
(gdbsim_files_info): Update call to sim_info.
|
||||
(gdbsim_ops): Realign comments.
|
||||
|
||||
* printcmd.c (decode_format): Allow TARGET_PTR_BIT to be non-constant.
|
||||
|
||||
Tue May 17 16:45:20 1994 Stan Shebs (shebs@andros.cygnus.com)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Generic remote debugging interface for simulators.
|
||||
Copyright 1993 Free Software Foundation, Inc.
|
||||
Copyright 1993, 1994 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support.
|
||||
Steve Chamberlain (sac@cygnus.com) and Doug Evans (dje@cygnus.com).
|
||||
Steve Chamberlain (sac@cygnus.com).
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
@ -119,6 +119,9 @@ int regno;
|
||||
}
|
||||
}
|
||||
|
||||
/* Kill the running program. This may involve closing any open files
|
||||
and releasing other resources acquired by the simulated program. */
|
||||
|
||||
static void
|
||||
gdbsim_kill ()
|
||||
{
|
||||
@ -141,9 +144,13 @@ gdbsim_load (prog, fromtty)
|
||||
if (sr_get_debug ())
|
||||
printf_filtered ("gdbsim_load: prog \"%s\"\n", prog);
|
||||
|
||||
inferior_pid = 0;
|
||||
inferior_pid = 0;
|
||||
|
||||
/* This must be done before calling gr_load_image. */
|
||||
program_loaded = 1;
|
||||
gr_load_image (prog, fromtty);
|
||||
|
||||
if (sim_load (prog, fromtty) != 0)
|
||||
gr_load_image (prog, fromtty);
|
||||
}
|
||||
|
||||
|
||||
@ -161,8 +168,9 @@ gdbsim_create_inferior (exec_file, args, env)
|
||||
char *args;
|
||||
char **env;
|
||||
{
|
||||
int len,entry_pt;
|
||||
int len;
|
||||
char *arg_buf,**argv;
|
||||
CORE_ADDR entry_pt;
|
||||
|
||||
if (! program_loaded)
|
||||
error ("No program loaded.");
|
||||
@ -174,7 +182,7 @@ gdbsim_create_inferior (exec_file, args, env)
|
||||
if (exec_file == 0 || exec_bfd == 0)
|
||||
error ("No exec file specified.");
|
||||
|
||||
entry_pt = (int) bfd_get_start_address (exec_bfd);
|
||||
entry_pt = (CORE_ADDR) bfd_get_start_address (exec_bfd);
|
||||
|
||||
gdbsim_kill (NULL, NULL);
|
||||
remove_breakpoints ();
|
||||
@ -188,11 +196,7 @@ gdbsim_create_inferior (exec_file, args, env)
|
||||
strcat (arg_buf, args);
|
||||
argv = buildargv (arg_buf);
|
||||
make_cleanup (freeargv, (char *) argv);
|
||||
/* FIXME: remote-sim.h says targets that don't support this return
|
||||
non-zero. Perhaps distinguish between "not supported" and other errors?
|
||||
Or maybe that can be the only error. */
|
||||
if (sim_set_args (argv, env) != 0)
|
||||
return;
|
||||
sim_create_inferior (entry_pt, argv, env);
|
||||
|
||||
inferior_pid = 42;
|
||||
insert_breakpoints (); /* Needed to get correct instruction in cache */
|
||||
@ -210,15 +214,9 @@ gdbsim_open (args, from_tty)
|
||||
int from_tty;
|
||||
{
|
||||
if (sr_get_debug ())
|
||||
printf_filtered ("gdbsim_open: args \"%s\"\n", args);
|
||||
printf_filtered ("gdbsim_open: args \"%s\"\n", args ? args : "(null)");
|
||||
|
||||
if (sim_open (args) != 0)
|
||||
{
|
||||
/* FIXME: This is totally bogus. sim_open should have a way to
|
||||
tell us what the error was, so we can tell the user. */
|
||||
error ("Unable to initialize simulator (insufficient memory?).");
|
||||
return;
|
||||
}
|
||||
sim_open (args);
|
||||
|
||||
push_target (&gdbsim_ops);
|
||||
target_fetch_registers (-1);
|
||||
@ -244,8 +242,7 @@ gdbsim_close (quitting)
|
||||
|
||||
program_loaded = 0;
|
||||
|
||||
/* FIXME: Need to call sim_close() to close all files and
|
||||
delete all mappings. */
|
||||
sim_close (quitting);
|
||||
}
|
||||
|
||||
/* Takes a program previously attached to and detaches it.
|
||||
@ -384,7 +381,7 @@ gdbsim_files_info (target)
|
||||
{
|
||||
printf_filtered ("\tAttached to %s running program %s\n",
|
||||
target_shortname, file);
|
||||
sim_info (printf_filtered, 0);
|
||||
sim_info (0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -415,10 +412,10 @@ struct target_ops gdbsim_ops =
|
||||
0, 0, /* Breakpoints */
|
||||
0, 0, 0, 0, 0, /* Terminal handling */
|
||||
gdbsim_kill, /* kill */
|
||||
gdbsim_load,
|
||||
gdbsim_load, /* load */
|
||||
0, /* lookup_symbol */
|
||||
gdbsim_create_inferior, /* create_inferior */
|
||||
gdbsim_mourn_inferior, /* mourn_inferior */
|
||||
gdbsim_create_inferior, /* create_inferior */
|
||||
gdbsim_mourn_inferior, /* mourn_inferior */
|
||||
0, /* can_run */
|
||||
0, /* notice_signals */
|
||||
process_stratum, 0, /* next */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* This file defines the interface between the simulator and gdb.
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
@ -32,50 +32,58 @@ typedef unsigned int SIM_ADDR;
|
||||
typedef CORE_ADDR_TYPE SIM_ADDR;
|
||||
#endif
|
||||
|
||||
/* Main simulator globals ... */
|
||||
/* Callbacks.
|
||||
The simulator may use the following callbacks (gdb routines) which the
|
||||
standalone program must provide.
|
||||
|
||||
extern int sim_verbose;
|
||||
void printf_filtered (char *msg, ...);
|
||||
void error /-* noreturn *-/ (char *msg, ...);
|
||||
void *xmalloc (long size);
|
||||
*/
|
||||
|
||||
/* Main simulator entry points ...
|
||||
|
||||
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. */
|
||||
All functions that can get an error must call the gdb routine `error',
|
||||
they can only return upon success. */
|
||||
|
||||
/* Initialize the simulator. This function is called when the simulator
|
||||
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.
|
||||
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. */
|
||||
|
||||
Returns 0 for success, non-zero for failure (FIXME: how do we say what
|
||||
kind of failure it was?). */
|
||||
void sim_open PARAMS ((char *args));
|
||||
|
||||
int sim_open PARAMS ((char *name));
|
||||
/* 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 ((int quitting));
|
||||
|
||||
/* Load program PROG into the simulator.
|
||||
We use "void *" instead of "bfd *" to isolate this file from BFD. */
|
||||
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 ((void *bfd_handle, char *args));
|
||||
int sim_load PARAMS ((char *prog, int from_tty));
|
||||
|
||||
/* Set the arguments and environment for the program loaded into the
|
||||
simulator. ARGV and ENV are NULL terminated lists of pointers.
|
||||
If the simulator doesn't support setting arguments, print an error message
|
||||
and return non-zero. */
|
||||
/* 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. */
|
||||
|
||||
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, unsigned char *buf));
|
||||
|
||||
/* Store register REGNO from BUF (in raw format). */
|
||||
|
||||
int sim_store_register PARAMS ((int regno, unsigned char *buf));
|
||||
void sim_create_inferior PARAMS ((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. */
|
||||
|
||||
int sim_kill PARAMS ((void));
|
||||
void 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. */
|
||||
@ -87,24 +95,28 @@ int sim_read PARAMS ((SIM_ADDR mem, unsigned char *buf, int length));
|
||||
|
||||
int sim_write PARAMS ((SIM_ADDR mem, unsigned char *buf, int length));
|
||||
|
||||
/* Fetch register REGNO and store the raw value in BUF. */
|
||||
|
||||
void sim_fetch_register PARAMS ((int regno, unsigned char *buf));
|
||||
|
||||
/* Store register REGNO from BUF (in raw format). */
|
||||
|
||||
void sim_store_register PARAMS ((int regno, unsigned char *buf));
|
||||
|
||||
/* Print some interesting information about the simulator.
|
||||
VERBOSE is non-zero for the wordy version. */
|
||||
|
||||
int sim_info PARAMS ((void (*printf_fn)(), int verbose));
|
||||
|
||||
/* Set the simulated cpu's program counter to PC. */
|
||||
|
||||
int sim_set_pc PARAMS ((SIM_ADDR pc));
|
||||
void sim_info PARAMS ((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 };
|
||||
|
||||
int sim_stop_reason PARAMS ((enum sim_stop *reason, int *sigrc));
|
||||
void sim_stop_reason PARAMS ((enum sim_stop *reason, int *sigrc));
|
||||
|
||||
/* Run (or resume) the program. */
|
||||
|
||||
int sim_resume PARAMS ((int step, int siggnal));
|
||||
void sim_resume PARAMS ((int step, int siggnal));
|
||||
|
||||
#endif /* !defined (REMOTE_SIM_H) */
|
||||
|
Reference in New Issue
Block a user