aboutsummaryrefslogtreecommitdiff
path: root/sim/riscv
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-11-15 23:00:04 -0500
committerMike Frysinger <vapier@gentoo.org>2021-11-16 00:58:41 -0500
commit54f7a83a62c27d6da9ee66da1022572d6ea45d84 (patch)
treeeb0670d282c37c15e28f3f4b3344285d7581399d /sim/riscv
parent38f9e52086c8d513bc7ef713043c03752924df89 (diff)
downloadgdb-54f7a83a62c27d6da9ee66da1022572d6ea45d84.zip
gdb-54f7a83a62c27d6da9ee66da1022572d6ea45d84.tar.gz
gdb-54f7a83a62c27d6da9ee66da1022572d6ea45d84.tar.bz2
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/riscv')
-rw-r--r--sim/riscv/interp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sim/riscv/interp.c b/sim/riscv/interp.c
index f94a842..7ecdd55 100644
--- a/sim/riscv/interp.c
+++ b/sim/riscv/interp.c
@@ -153,6 +153,12 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
STATE_PROG_ARGV (sd) = dupargv (argv);
}
+ if (STATE_PROG_ENVP (sd) != env)
+ {
+ freeargv (STATE_PROG_ENVP (sd));
+ STATE_PROG_ENVP (sd) = dupargv (env);
+ }
+
initialize_env (sd, (void *)argv, (void *)env);
return SIM_RC_OK;