summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-05-22 04:59:25 +0000
committerAndrew Cagney <cagney@redhat.com>1997-05-22 04:59:25 +0000
commit1fa0cc2dfca2bfa6cc62516dd8c7aeb9c590d86a (patch)
tree8085e3b8b0e6661acecd15ca850b4735d06ff46b /gdb
parent28558bdb36be5186a20e17108bbace6628ee5934 (diff)
downloadbinutils-gdb-1fa0cc2dfca2bfa6cc62516dd8c7aeb9c590d86a.tar.gz
Restrict simulator commands to an enabled simulator.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/remote-sim.c25
2 files changed, 22 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 17ba1e8f649..77a9e89985a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+Thu May 22 11:53:21 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * remote-sim.c (simulator_command): Restrict access to the
+ simulator to periods when the simulator is open.
+
Wed May 21 16:03:25 1997 Michael Snyder <msnyder@cleaver.cygnus.com>
* procfs.c (init_procinfo): new function, abstracts some code
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index df595ef4c0f..7574cbe7668 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -500,6 +500,8 @@ gdbsim_open (args, from_tty)
sprintf (arg_buf, "gdbsim%s%s",
args ? " " : "", args ? args : "");
#ifdef TARGET_BYTE_ORDER_SELECTABLE
+ /* Since GDB always closes the target and updates byte-order when
+ opening a new file, TARGET_BYTE_ORDER is normally correct. */
if (TARGET_BYTE_ORDER == BIG_ENDIAN)
strcat (arg_buf, " -E big");
else
@@ -777,15 +779,22 @@ simulator_command (args, from_tty)
char *args;
int from_tty;
{
- /* The user may give a command before the simulator is opened, so
- ensure that the callbacks have been set up. */
- init_callbacks ();
+ if (gdbsim_desc == NULL)
+ {
+
+ /* PREVIOUSLY: The user may give a command before the simulator
+ is opened. [...] (??? assuming of course one wishes to
+ continue to allow commands to be sent to unopened simulators,
+ which isn't entirely unreasonable). */
+
+ /* The simulator is a builtin abstraction of a remote target.
+ Consistent with that model, access to the simulator, via sim
+ commands, is restricted to the period when the channel to the
+ simulator is open. */
+
+ error ("Not connected to the simulator target");
+ }
- /* Note that if the simulator hasn't been opened, gdbsim_desc == NULL
- which is correct (??? assuming of course one wishes to continue to
- allow commands to be sent to unopened simulators, which isn't entirely
- unreasonable). Simulators should be prepared to deal with any
- combination of NULL or empty args. */
sim_do_command (gdbsim_desc, args);
}