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/common | |
parent | 38f9e52086c8d513bc7ef713043c03752924df89 (diff) | |
download | gdb-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/common')
-rw-r--r-- | sim/common/sim-base.h | 4 | ||||
-rw-r--r-- | sim/common/sim-utils.c | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h index c34f6f6..50def1e 100644 --- a/sim/common/sim-base.h +++ b/sim/common/sim-base.h @@ -165,6 +165,10 @@ struct sim_state { char *prog_argv0; #define STATE_PROG_ARGV0(sd) ((sd)->prog_argv0) + /* The program's environment. */ + char **prog_envp; +#define STATE_PROG_ENVP(sd) ((sd)->prog_envp) + /* The program's bfd. */ struct bfd *prog_bfd; #define STATE_PROG_BFD(sd) ((sd)->prog_bfd) diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c index 6f147b2..ff6234b 100644 --- a/sim/common/sim-utils.c +++ b/sim/common/sim-utils.c @@ -99,6 +99,7 @@ sim_state_free (SIM_DESC sd) free (STATE_PROG_FILE (sd)); free (STATE_PROG_ARGV0 (sd)); + freeargv (STATE_PROG_ENVP (sd)); free (sd); } |