sim: standardize sim_create_inferior handling of argv a bit more

For targets that process argv in sim_create_inferior, improve the code:
- provide more details in the comment
- make the check for when to re-init more robust
- clean out legacy sim_copy_argv code

This will be cleaned up more in the future when we have a common inferior
creation function, but at least help new ports get it right until then.
This commit is contained in:
Mike Frysinger
2015-12-26 07:05:41 -05:00
parent f66affe97c
commit 0e9672991e
18 changed files with 106 additions and 34 deletions

View File

@@ -1,3 +1,7 @@
2015-12-26 Mike Frysinger <vapier@gentoo.org>
* sim-if.c (sim_create_inferior): Replace old #if 0 code with dupargv.
2015-12-25 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HARDWARE): Add m32r_cache & m32r_uart.

View File

@@ -199,10 +199,15 @@ sim_create_inferior (sd, abfd, argv, envp)
m32r_decode_gdb_ctrl_regnum(SPU_REGNUM), 0x1f00000);
#endif
#if 0
STATE_ARGV (sd) = sim_copy_argv (argv);
STATE_ENVP (sd) = sim_copy_argv (envp);
#endif
/* Standalone mode (i.e. `run`) will take care of the argv for us in
sim_open() -> sim_parse_args(). But in debug mode (i.e. 'target sim'
with `gdb`), we need to handle it because the user can change the
argv on the fly via gdb's 'run'. */
if (STATE_PROG_ARGV (sd) != argv)
{
freeargv (STATE_PROG_ARGV (sd));
STATE_PROG_ARGV (sd) = dupargv (argv);
}
return SIM_RC_OK;
}