forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -174,5 +174,11 @@ 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);
|
||||
}
|
||||
|
||||
return SIM_RC_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user