aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>1997-10-22 01:38:49 +0000
committerDoug Evans <dje@google.com>1997-10-22 01:38:49 +0000
commit897a1d78634e6dbebb2c6924be609c4258b585f9 (patch)
tree3236311b892c3f545e542e9ed563382d4fa84eca
parentfbb09651da44847f1275b74ac85920b40f6cbfc6 (diff)
downloadgdb-897a1d78634e6dbebb2c6924be609c4258b585f9.zip
gdb-897a1d78634e6dbebb2c6924be609c4258b585f9.tar.gz
gdb-897a1d78634e6dbebb2c6924be609c4258b585f9.tar.bz2
* nrun.c (main): Remove useless test of name != NULL.
-rw-r--r--sim/common/ChangeLog4
-rw-r--r--sim/common/nrun.c19
2 files changed, 20 insertions, 3 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index b8fc3c8..aeb7597 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,7 @@
+Tue Oct 21 18:37:57 1997 Doug Evans <devans@canuck.cygnus.com>
+
+ * nrun.c (main): Remove useless test of name != NULL.
+
Tue Oct 21 10:42:38 1997 Andrew Cagney <cagney@b1.cygnus.com>
* sim-fpu.c (EXPMAX): Type is unsigned.
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index 16525c9..f78ed8d 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -18,6 +18,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <signal.h>
#include "sim-main.h"
+#include "bfd.h"
+
#ifdef HAVE_ENVIRON
extern char **environ;
#endif
@@ -45,6 +47,7 @@ main (int argc, char **argv)
{
char *name;
char **prog_argv = NULL;
+ struct _bfd *prog_bfd;
enum sim_stop reason;
int sigrc;
RETSIGTYPE (*prev_sigint) ();
@@ -66,23 +69,33 @@ main (int argc, char **argv)
/* Was there a program to run? */
prog_argv = STATE_PROG_ARGV (sd);
+ prog_bfd = STATE_PROG_BFD (sd);
if (prog_argv == NULL || *prog_argv == NULL)
usage ();
name = *prog_argv;
+ /* For simulators that don't open prog during sim_open() */
+ if (prog_bfd == NULL)
+ {
+ prog_bfd = bfd_openr (name, 0);
+ if (prog_bfd == NULL)
+ fprintf (stderr, "%s: can't open \"%s\": %s\n",
+ myname, name, bfd_errmsg (bfd_get_error ()));
+ }
+
if (STATE_VERBOSE_P (sd))
printf ("%s %s\n", myname, name);
/* Load the program into the simulator. */
- if (sim_load (sd, name, NULL, 0) == SIM_RC_FAIL)
+ if (sim_load (sd, name, prog_bfd, 0) == SIM_RC_FAIL)
exit (1);
/* Prepare the program for execution. */
#ifdef HAVE_ENVIRON
- sim_create_inferior (sd, prog_argv, environ);
+ sim_create_inferior (sd, prog_bfd, prog_argv, environ);
#else
- sim_create_inferior (sd, prog_argv, NULL);
+ sim_create_inferior (sd, prog_bfd, prog_argv, NULL);
#endif
/* Run the program. */