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:
parent
f66affe97c
commit
0e9672991e
18 changed files with 106 additions and 34 deletions
|
@ -1,3 +1,7 @@
|
|||
2015-12-26 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_create_inferior): Update comment and argv check.
|
||||
|
||||
2015-12-14 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* simulator.c (system_get): New function. Provides read
|
||||
|
|
|
@ -192,10 +192,11 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env)
|
|||
aarch64_set_next_PC (cpu, addr);
|
||||
aarch64_update_PC (cpu);
|
||||
|
||||
/* Standalone mode (ie aarch64-elf-run) will take care of the argv
|
||||
for us in sim_open() -> sim_parse_args(). But in debug mode (i.e.
|
||||
'target sim' with `aarch64-...-gdb`), we need to handle it. */
|
||||
if (STATE_OPEN_KIND (sd) == SIM_OPEN_DEBUG)
|
||||
/* 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);
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2015-12-26 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_create_inferior): Update comment and argv check.
|
||||
|
||||
2015-12-25 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* Makefile.in (SIM_OBJS): Delete sim-model.o.
|
||||
|
|
|
@ -1210,10 +1210,11 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
|
|||
addr = 0;
|
||||
sim_pc_set (cpu, addr);
|
||||
|
||||
/* Standalone mode (i.e. `bfin-...-run`) will take care of the argv
|
||||
for us in sim_open() -> sim_parse_args(). But in debug mode (i.e.
|
||||
'target sim' with `bfin-...-gdb`), we need to handle it. */
|
||||
if (STATE_OPEN_KIND (sd) == SIM_OPEN_DEBUG)
|
||||
/* 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);
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2015-12-26 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* sim-if.c (sim_create_inferior): Delete old comment and set up
|
||||
STATE_PROG_ARGV.
|
||||
|
||||
2015-12-25 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* configure.ac (SIM_AC_OPTION_HARDWARE): Change default to yes and
|
||||
|
|
|
@ -1064,11 +1064,15 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
|
|||
addr = 0;
|
||||
sim_pc_set (current_cpu, addr);
|
||||
|
||||
/* Other simulators have #if 0:d code that says
|
||||
STATE_ARGV (sd) = sim_copy_argv (argv);
|
||||
STATE_ENVP (sd) = sim_copy_argv (envp);
|
||||
Enabling that gives you not-found link-errors for sim_copy_argv.
|
||||
FIXME: Do archaeology to find out more. */
|
||||
/* 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;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
||||
* devices.c: Delete file.
|
||||
|
|
|
@ -213,10 +213,15 @@ sim_create_inferior (sd, abfd, argv, envp)
|
|||
addr = 0;
|
||||
sim_pc_set (current_cpu, addr);
|
||||
|
||||
#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;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2015-12-26 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c (sim_create_inferior): Update comment and argv check.
|
||||
|
||||
2015-11-15 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* Makefile.in (SIM_OBJS): Delete sim-reason.o, sim-reg.o, and
|
||||
|
|
|
@ -877,7 +877,11 @@ sim_create_inferior (SIM_DESC sd,
|
|||
else
|
||||
addr = 0;
|
||||
|
||||
if (STATE_OPEN_KIND (sd) == SIM_OPEN_DEBUG)
|
||||
/* 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);
|
||||
|
|
|
@ -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>
|
||||
|
||||
* Makefile.in (SIM_OBJS): Delete sim-model.o.
|
||||
|
|
|
@ -172,10 +172,15 @@ sim_create_inferior (sd, abfd, argv, envp)
|
|||
addr = CPU2INSN(0);
|
||||
sim_pc_set (current_cpu, addr);
|
||||
|
||||
#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;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
||||
* Makefile.in (SIM_OBJS): Delete sim-model.o.
|
||||
|
|
|
@ -263,10 +263,15 @@ sim_create_inferior (sd, abfd, argv, envp)
|
|||
addr = 0;
|
||||
sim_pc_set (current_cpu, addr);
|
||||
|
||||
#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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
||||
* Makefile.in (SIM_OBJS): Delete sim-model.o.
|
||||
|
|
|
@ -178,10 +178,15 @@ sim_create_inferior (sd, abfd, argv, envp)
|
|||
addr = 0;
|
||||
sim_pc_set (current_cpu, addr);
|
||||
|
||||
#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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue