aboutsummaryrefslogtreecommitdiff
path: root/sim/cris
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-12-26 07:05:41 -0500
committerMike Frysinger <vapier@gentoo.org>2015-12-26 07:19:07 -0500
commit0e9672991e9346d5c2cb9cd33e30fb3e573f88b8 (patch)
treeb9a00b51355ac7ebed43ebf97f78b7a373b42936 /sim/cris
parentf66affe97c40465e70249970b3339cc2f0a40e69 (diff)
downloadgdb-0e9672991e9346d5c2cb9cd33e30fb3e573f88b8.zip
gdb-0e9672991e9346d5c2cb9cd33e30fb3e573f88b8.tar.gz
gdb-0e9672991e9346d5c2cb9cd33e30fb3e573f88b8.tar.bz2
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.
Diffstat (limited to 'sim/cris')
-rw-r--r--sim/cris/ChangeLog5
-rw-r--r--sim/cris/sim-if.c14
2 files changed, 14 insertions, 5 deletions
diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog
index 3768768..e7f4cc6 100644
--- a/sim/cris/ChangeLog
+++ b/sim/cris/ChangeLog
@@ -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
diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c
index 3e04655..97307f8 100644
--- a/sim/cris/sim-if.c
+++ b/sim/cris/sim-if.c
@@ -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;
}