aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-11-15 02:32:06 -0500
committerMike Frysinger <vapier@gentoo.org>2021-11-15 02:53:29 -0500
commite8f20a28b1192d746475f045d77ac84411f164df (patch)
tree3ff31f3c32862561e65c1d23650b13eb0c28702a
parent7b2ec4e46fb726a7616a07e67c4270f48c8c546e (diff)
downloadfsf-binutils-gdb-e8f20a28b1192d746475f045d77ac84411f164df.zip
fsf-binutils-gdb-e8f20a28b1192d746475f045d77ac84411f164df.tar.gz
fsf-binutils-gdb-e8f20a28b1192d746475f045d77ac84411f164df.tar.bz2
sim: split program path out of argv vector
We use the program argv to both find the program to run (argv[0]) and to hold the arguments to the program. Most of the time this is fine, but if we want to let programs specify argv[0] independently (which is possible in standard *NIX programs), this double duty doesn't work. So let's split the path to the program to run out into a separate field by itself. This simplifies the various sim_open funcs too. By itself, this code is more of a logical cleanup than something that is super useful. But it will open up customization of argv[0] in a follow up commit. Split the changes to make it easier to review.
-rw-r--r--sim/aarch64/interp.c5
-rw-r--r--sim/arm/wrapper.c5
-rw-r--r--sim/avr/interp.c5
-rw-r--r--sim/bfin/interp.c5
-rw-r--r--sim/bpf/sim-if.c5
-rw-r--r--sim/common/nrun.c2
-rw-r--r--sim/common/sim-base.h5
-rw-r--r--sim/common/sim-options.c5
-rw-r--r--sim/common/sim-utils.c1
-rw-r--r--sim/cr16/interp.c5
-rw-r--r--sim/cris/sim-if.c10
-rw-r--r--sim/d10v/interp.c5
-rw-r--r--sim/example-synacor/interp.c5
-rw-r--r--sim/frv/sim-if.c6
-rw-r--r--sim/ft32/interp.c5
-rw-r--r--sim/h8300/compile.c5
-rw-r--r--sim/iq2000/sim-if.c6
-rw-r--r--sim/lm32/sim-if.c5
-rw-r--r--sim/m32r/sim-if.c6
-rw-r--r--sim/m68hc11/interp.c5
-rw-r--r--sim/mcore/interp.c5
-rw-r--r--sim/microblaze/interp.c5
-rw-r--r--sim/mips/interp.c6
-rw-r--r--sim/mn10300/interp.c6
-rw-r--r--sim/moxie/interp.c5
-rw-r--r--sim/msp430/msp430-sim.c5
-rw-r--r--sim/or1k/sim-if.c5
-rw-r--r--sim/pru/interp.c5
-rw-r--r--sim/riscv/interp.c5
-rw-r--r--sim/sh/interp.c5
-rw-r--r--sim/v850/interp.c6
31 files changed, 40 insertions, 119 deletions
diff --git a/sim/aarch64/interp.c b/sim/aarch64/interp.c
index 18c2fc0..999b949 100644
--- a/sim/aarch64/interp.c
+++ b/sim/aarch64/interp.c
@@ -339,10 +339,7 @@ sim_open (SIM_OPEN_KIND kind,
if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK
|| sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK
|| sim_parse_args (sd, argv) != SIM_RC_OK
- || sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK
+ || sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK
|| sim_config (sd) != SIM_RC_OK
|| sim_post_argv_init (sd) != SIM_RC_OK)
{
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index e697d55..12b974a 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -825,10 +825,7 @@ sim_open (SIM_OPEN_KIND kind,
}
/* Check for/establish the a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/avr/interp.c b/sim/avr/interp.c
index df7177e..8ec07c9 100644
--- a/sim/avr/interp.c
+++ b/sim/avr/interp.c
@@ -1710,10 +1710,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
}
/* Check for/establish the a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c
index fab4df7..088b559 100644
--- a/sim/bfin/interp.c
+++ b/sim/bfin/interp.c
@@ -740,10 +740,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
}
/* Check for/establish the a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/bpf/sim-if.c b/sim/bpf/sim-if.c
index aba191d..a8d9441 100644
--- a/sim/bpf/sim-if.c
+++ b/sim/bpf/sim-if.c
@@ -147,10 +147,7 @@ sim_open (SIM_OPEN_KIND kind,
if (sim_parse_args (sd, argv) != SIM_RC_OK)
goto error;
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
goto error;
if (sim_config (sd) != SIM_RC_OK)
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index 3fd7834..f1fb7d1 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -103,7 +103,7 @@ main (int argc, char **argv)
if (prog_argv == NULL || *prog_argv == NULL)
usage ();
- name = *prog_argv;
+ name = STATE_PROG_FILE (sd);
/* For simulators that don't open prog during sim_open() */
if (prog_bfd == NULL)
diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h
index 674b2d4..ff54f1d 100644
--- a/sim/common/sim-base.h
+++ b/sim/common/sim-base.h
@@ -151,6 +151,11 @@ struct sim_state {
const char *model_name;
#define STATE_MODEL_NAME(sd) ((sd)->model_name)
+ /* In standalone simulator, this is the program to run. Not to be confused
+ with argv which are the strings passed to the program itself. */
+ char *prog_file;
+#define STATE_PROG_FILE(sd) ((sd)->prog_file)
+
/* In standalone simulator, this is the program's arguments passed
on the command line. */
char **prog_argv;
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index e82ac33..7e5695d 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -604,7 +604,10 @@ sim_parse_args (SIM_DESC sd, char * const *argv)
if (optc == -1)
{
if (STATE_OPEN_KIND (sd) == SIM_OPEN_STANDALONE)
- STATE_PROG_ARGV (sd) = dupargv (argv + optind);
+ {
+ STATE_PROG_FILE (sd) = xstrdup (argv[optind]);
+ STATE_PROG_ARGV (sd) = dupargv (argv + optind);
+ }
break;
}
if (optc == '?')
diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c
index 88fd20e..0e8cd5a 100644
--- a/sim/common/sim-utils.c
+++ b/sim/common/sim-utils.c
@@ -97,6 +97,7 @@ sim_state_free (SIM_DESC sd)
SIM_STATE_FREE (sd);
#endif
+ free (STATE_PROG_FILE (sd));
free (sd);
}
diff --git a/sim/cr16/interp.c b/sim/cr16/interp.c
index e2aef01..7bbcf3c 100644
--- a/sim/cr16/interp.c
+++ b/sim/cr16/interp.c
@@ -423,10 +423,7 @@ sim_open (SIM_OPEN_KIND kind, struct host_callback_struct *cb,
}
/* Check for/establish the a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c
index 2d7e922..500941a 100644
--- a/sim/cris/sim-if.c
+++ b/sim/cris/sim-if.c
@@ -690,11 +690,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
}
/* check for/establish the reference program image */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL),
- abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
/* When there's an error, sim_analyze_program has already output
a message. Let's just clarify it, as "not an object file"
@@ -717,9 +713,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
if (abfd != NULL && bfd_get_arch (abfd) == bfd_arch_unknown)
{
- if (STATE_PROG_ARGV (sd) != NULL)
+ if (STATE_PROG_FILE (sd) != NULL)
sim_io_eprintf (sd, "%s: `%s' is not a CRIS program\n",
- STATE_MY_NAME (sd), *STATE_PROG_ARGV (sd));
+ STATE_MY_NAME (sd), STATE_PROG_FILE (sd));
else
sim_io_eprintf (sd, "%s: program to be run is not a CRIS program\n",
STATE_MY_NAME (sd));
diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c
index 228ca3e..33baea7 100644
--- a/sim/d10v/interp.c
+++ b/sim/d10v/interp.c
@@ -780,10 +780,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
}
/* Check for/establish the a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/example-synacor/interp.c b/sim/example-synacor/interp.c
index 57b1bee..d1a82e5 100644
--- a/sim/example-synacor/interp.c
+++ b/sim/example-synacor/interp.c
@@ -111,10 +111,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
}
/* Check for/establish the a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/frv/sim-if.c b/sim/frv/sim-if.c
index 6d22aad..d036153 100644
--- a/sim/frv/sim-if.c
+++ b/sim/frv/sim-if.c
@@ -92,11 +92,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, bfd *abfd,
sim_do_commandf (sd, "memory region 0,0x%x", FRV_DEFAULT_MEM_SIZE);
/* check for/establish the reference program image */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL),
- abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/ft32/interp.c b/sim/ft32/interp.c
index 7da6ecd..a1cc9ab 100644
--- a/sim/ft32/interp.c
+++ b/sim/ft32/interp.c
@@ -842,10 +842,7 @@ sim_open (SIM_OPEN_KIND kind,
}
/* Check for/establish the reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 1f3316e..e729c52 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -4755,10 +4755,7 @@ sim_open (SIM_OPEN_KIND kind,
}
/* Check for/establish the a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/iq2000/sim-if.c b/sim/iq2000/sim-if.c
index 8cfc1e0..21ed821 100644
--- a/sim/iq2000/sim-if.c
+++ b/sim/iq2000/sim-if.c
@@ -93,11 +93,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
sim_do_commandf (sd, "memory region 0x%x,0x%x", IQ2000_DATA_VALUE, IQ2000_DATA_MEM_SIZE);
/* check for/establish the reference program image */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL),
- abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/lm32/sim-if.c b/sim/lm32/sim-if.c
index 2f8b344..ce9ab5a 100644
--- a/sim/lm32/sim-if.c
+++ b/sim/lm32/sim-if.c
@@ -133,10 +133,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
#endif
/* check for/establish the reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c
index e05b163..b2f7b46 100644
--- a/sim/m32r/sim-if.c
+++ b/sim/m32r/sim-if.c
@@ -98,11 +98,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
sim_do_commandf (sd, "memory region 0,0x%x", M32R_DEFAULT_MEM_SIZE);
/* check for/establish the reference program image */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL),
- abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/m68hc11/interp.c b/sim/m68hc11/interp.c
index 7d28f40..977c207 100644
--- a/sim/m68hc11/interp.c
+++ b/sim/m68hc11/interp.c
@@ -436,10 +436,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
}
/* Check for/establish the a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c
index 138dccc..e8a4520 100644
--- a/sim/mcore/interp.c
+++ b/sim/mcore/interp.c
@@ -1371,10 +1371,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
}
/* Check for/establish the a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c
index d2bd9e9..d809596 100644
--- a/sim/microblaze/interp.c
+++ b/sim/microblaze/interp.c
@@ -429,10 +429,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
}
/* Check for/establish the a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/mips/interp.c b/sim/mips/interp.c
index 4ab908d..30d417b 100644
--- a/sim/mips/interp.c
+++ b/sim/mips/interp.c
@@ -633,11 +633,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
}
/* check for/establish the a reference program image */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL),
- abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
sim_module_uninstall (sd);
return 0;
diff --git a/sim/mn10300/interp.c b/sim/mn10300/interp.c
index f16a756..551d176 100644
--- a/sim/mn10300/interp.c
+++ b/sim/mn10300/interp.c
@@ -268,11 +268,7 @@ sim_open (SIM_OPEN_KIND kind,
/* check for/establish the a reference program image */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL),
- abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
sim_module_uninstall (sd);
return 0;
diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c
index 447f52e..3aa6a3b 100644
--- a/sim/moxie/interp.c
+++ b/sim/moxie/interp.c
@@ -1226,10 +1226,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
sim_do_command(sd," memory region 0xE0000000,0x10000") ;
/* Check for/establish the a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/msp430/msp430-sim.c b/sim/msp430/msp430-sim.c
index 6f1c14f..119d2b9 100644
--- a/sim/msp430/msp430-sim.c
+++ b/sim/msp430/msp430-sim.c
@@ -152,10 +152,7 @@ sim_open (SIM_OPEN_KIND kind,
sim_do_commandf (sd, "memory-region 0x90000,0x70000"); /* HIGH ROM. */
/* Check for/establish the a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
sim_state_free (sd);
return 0;
diff --git a/sim/or1k/sim-if.c b/sim/or1k/sim-if.c
index 3f47ce5..2957587 100644
--- a/sim/or1k/sim-if.c
+++ b/sim/or1k/sim-if.c
@@ -201,10 +201,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
}
/* Check for/establish the reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/pru/interp.c b/sim/pru/interp.c
index fc8bbe5..ca640f4 100644
--- a/sim/pru/interp.c
+++ b/sim/pru/interp.c
@@ -772,10 +772,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
}
/* Check for/establish a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/riscv/interp.c b/sim/riscv/interp.c
index 202412a..f94a842 100644
--- a/sim/riscv/interp.c
+++ b/sim/riscv/interp.c
@@ -94,10 +94,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
}
/* Check for/establish the a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/sh/interp.c b/sim/sh/interp.c
index 559b39a..1b2b09f 100644
--- a/sim/sh/interp.c
+++ b/sim/sh/interp.c
@@ -2367,10 +2367,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
}
/* Check for/establish the a reference program image. */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL), abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
free_state (sd);
return 0;
diff --git a/sim/v850/interp.c b/sim/v850/interp.c
index 92c80a8..0d31365 100644
--- a/sim/v850/interp.c
+++ b/sim/v850/interp.c
@@ -239,11 +239,7 @@ sim_open (SIM_OPEN_KIND kind,
}
/* check for/establish the a reference program image */
- if (sim_analyze_program (sd,
- (STATE_PROG_ARGV (sd) != NULL
- ? *STATE_PROG_ARGV (sd)
- : NULL),
- abfd) != SIM_RC_OK)
+ if (sim_analyze_program (sd, STATE_PROG_FILE (sd), abfd) != SIM_RC_OK)
{
sim_module_uninstall (sd);
return 0;