diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-11-15 23:00:04 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-11-16 00:58:41 -0500 |
commit | 54f7a83a62c27d6da9ee66da1022572d6ea45d84 (patch) | |
tree | eb0670d282c37c15e28f3f4b3344285d7581399d /sim/lm32 | |
parent | sim: iq2000: fix some missing prototypes warnings (diff) | |
download | binutils-gdb-54f7a83a62c27d6da9ee66da1022572d6ea45d84.tar.gz binutils-gdb-54f7a83a62c27d6da9ee66da1022572d6ea45d84.tar.bz2 binutils-gdb-54f7a83a62c27d6da9ee66da1022572d6ea45d84.zip |
sim: keep track of program environment strings
We've been passing the environment strings to sim_create_inferior,
but most ports don't do anything with them. A few will use ad-hoc
logic to stuff the stack for user-mode programs, but that's it.
Let's formalize this across the board by storing the strings in the
normal sim state. This will allow (in future commits) supporting
more functionality in the run interface, and to unify some of the
libgloss syscalls.
Diffstat (limited to 'sim/lm32')
-rw-r--r-- | sim/lm32/sim-if.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sim/lm32/sim-if.c b/sim/lm32/sim-if.c index ce9ab5ac967..e7bffbdf3f6 100644 --- a/sim/lm32/sim-if.c +++ b/sim/lm32/sim-if.c @@ -192,7 +192,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd, SIM_RC sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char * const *argv, - char * const *envp) + char * const *env) { SIM_CPU *current_cpu = STATE_CPU (sd, 0); SIM_ADDR addr; @@ -213,5 +213,11 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char * const *argv, STATE_PROG_ARGV (sd) = dupargv (argv); } + if (STATE_PROG_ENVP (sd) != env) + { + freeargv (STATE_PROG_ENVP (sd)); + STATE_PROG_ENVP (sd) = dupargv (env); + } + return SIM_RC_OK; } |