aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote-sim.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2006-10-17 21:55:24 +0000
committerDaniel Jacobowitz <drow@false.org>2006-10-17 21:55:24 +0000
commit52bb452f802c0e3642b86e7ffccde8a1333bd280 (patch)
tree9fb4c926a2d9f650c88ffc78d498bf8a74ce7a6c /gdb/remote-sim.c
parentb40ce68a7796afe94e81363e28347fa1ef4475ce (diff)
downloadgdb-52bb452f802c0e3642b86e7ffccde8a1333bd280.zip
gdb-52bb452f802c0e3642b86e7ffccde8a1333bd280.tar.gz
gdb-52bb452f802c0e3642b86e7ffccde8a1333bd280.tar.bz2
gdb/
* gdbint.texinfo (Target Vector Definition): Move most content into Existing Targets. Add a menu. (Existing Targets): New section, moved from Target Vector Definition. Use @subsection. (Managing Execution State): New section. gdb/doc/ * remote-sim.c (gdbsim_kill): Call target_mourn_inferior. (gdbsim_load): Don't bother to adjust inferior_ptid here. (gdbsim_create_inferior): Mark the simulator as running. (gdbsim_open): Don't bother fetching registers. Mark the target as not running. (gdbsim_xfer): When the program is not running, pass memory requests down. (gdbsim_mourn_inferior): Mark the target as not running. * target.c (target_mark_running, target_mark_exited): New. * target.h (target_has_execution): Update the comment. (target_mark_running, target_mark_exited): New prototypes.
Diffstat (limited to 'gdb/remote-sim.c')
-rw-r--r--gdb/remote-sim.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 4e36f54..9b432b0 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -383,8 +383,8 @@ gdbsim_kill (void)
printf_filtered ("gdbsim_kill\n");
/* There is no need to `kill' running simulator - the simulator is
- not running */
- inferior_ptid = null_ptid;
+ not running. Mourning it is enough. */
+ target_mourn_inferior ();
}
/* Load an executable file into the target process. This is expected to
@@ -410,8 +410,6 @@ gdbsim_load (char *args, int fromtty)
if (sr_get_debug ())
printf_filtered ("gdbsim_load: prog \"%s\"\n", prog);
- inferior_ptid = null_ptid;
-
/* FIXME: We will print two messages on error.
Need error to either not print anything if passed NULL or need
another routine that doesn't take any arguments. */
@@ -469,6 +467,7 @@ gdbsim_create_inferior (char *exec_file, char *args, char **env, int from_tty)
sim_create_inferior (gdbsim_desc, exec_bfd, argv, env);
inferior_ptid = pid_to_ptid (42);
+ target_mark_running (&gdbsim_ops);
insert_breakpoints (); /* Needed to get correct instruction in cache */
clear_proceed_status ();
@@ -543,8 +542,12 @@ gdbsim_open (char *args, int from_tty)
error (_("unable to create simulator instance"));
push_target (&gdbsim_ops);
- target_fetch_registers (-1);
printf_filtered ("Connected to the simulator.\n");
+
+ /* There's nothing running after "target sim" or "load"; not until
+ "run". */
+ inferior_ptid = null_ptid;
+ target_mark_exited (&gdbsim_ops);
}
/* Does whatever cleanup is required for a target that we are no longer
@@ -747,6 +750,12 @@ gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
int write, struct mem_attrib *attrib,
struct target_ops *target)
{
+ /* If no program is running yet, then ignore the simulator for
+ memory. Pass the request down to the next target, hopefully
+ an exec file. */
+ if (!target_has_execution)
+ return 0;
+
if (!program_loaded)
error (_("No program loaded."));
@@ -802,6 +811,7 @@ gdbsim_mourn_inferior (void)
printf_filtered ("gdbsim_mourn_inferior:\n");
remove_breakpoints ();
+ target_mark_exited (&gdbsim_ops);
generic_mourn_inferior ();
}