aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meissner <gnu@the-meissners.org>1996-09-12 15:28:40 +0000
committerMichael Meissner <gnu@the-meissners.org>1996-09-12 15:28:40 +0000
commit9b280a864b4861885f1b239188b8680d26c83f17 (patch)
tree449bdc7d871929e4f9c5e38f038800bc66c080fa
parentcacfb845c8ebb1c33c86346d32b67d9391a4f977 (diff)
downloadgdb-9b280a864b4861885f1b239188b8680d26c83f17.zip
gdb-9b280a864b4861885f1b239188b8680d26c83f17.tar.gz
gdb-9b280a864b4861885f1b239188b8680d26c83f17.tar.bz2
Store bfd pointer in a global variable
-rw-r--r--sim/common/ChangeLog18
-rw-r--r--sim/common/run.c17
2 files changed, 29 insertions, 6 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 7d92a22..8d825a7 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,21 @@
+Thu Sep 12 11:27:21 1996 Michael Meissner <meissner@tiktok.cygnus.com>
+
+ * run.c (sim_bfd): New global to hold the bfd pointer for the
+ executable.
+ (main): Initialize sim_bfd.
+
+Fri Dec 15 16:27:49 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * run.c (main): Use new bfd_big_endian macro.
+
+Wed Nov 8 15:49:49 1995 James G. Smith <jsmith@pasanda.cygnus.co.uk>
+
+ * run.c (main): Removed SH specific comments, so source is
+ generic. Also updated to only load relevant sections. Moved
+ sim_open() to after callback attach (to match GDB).
+
+ * run.1: Removed SH specific comments.
+
Sat Oct 21 12:31:01 1995 Jim Wilson <wilson@chestnut.cygnus.com>
* run.c (main): Always return sigrc at end.
diff --git a/sim/common/run.c b/sim/common/run.c
index 15bd029..982d99c 100644
--- a/sim/common/run.c
+++ b/sim/common/run.c
@@ -1,8 +1,6 @@
/* run front end support for all the simulators.
Copyright (C) 1992, 1993 1994, 1995 Free Software Foundation, Inc.
-This file is part of SH SIM
-
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
@@ -35,6 +33,8 @@ void usage();
extern int optind;
extern char *optarg;
+bfd *sim_bfd;
+
int target_byte_order;
extern host_callback default_callback;
@@ -87,7 +87,7 @@ main (ac, av)
printf ("run %s\n", name);
}
- abfd = bfd_openr (name, 0);
+ sim_bfd = abfd = bfd_openr (name, 0);
if (!abfd)
{
fprintf (stderr, "run: can't open %s: %s\n",
@@ -102,12 +102,15 @@ main (ac, av)
exit (1);
}
-
sim_set_callbacks (&default_callback);
default_callback.init (&default_callback);
+ /* Ensure that any run-time initialisation that needs to be
+ performed by the simulator can occur. */
+ sim_open(NULL);
+
for (s = abfd->sections; s; s = s->next)
- if (abfd)
+ if (abfd && (s->flags & SEC_LOAD))
{
unsigned char *buffer = (unsigned char *)malloc (bfd_section_size (abfd, s));
bfd_get_section_contents (abfd,
@@ -121,7 +124,7 @@ main (ac, av)
start_address = bfd_get_start_address (abfd);
sim_create_inferior (start_address, NULL, NULL);
- target_byte_order = abfd->xvec->byteorder_big_p ? 4321 : 1234;
+ target_byte_order = bfd_big_endian (abfd) ? 4321 : 1234;
if (trace)
{
@@ -140,6 +143,8 @@ main (ac, av)
sim_stop_reason (&reason, &sigrc);
+ sim_close(0);
+
/* If reason is sim_exited, then sigrc holds the exit code which we want
to return. If reason is sim_stopped or sim_signalled, then sigrc holds
the signal that the simulator received; we want to return that to