From b2b255bdf3d29d97c10668b4bb5fceeb886a15f1 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 20 Feb 2014 00:13:48 -0500 Subject: [PATCH] sim: constify prog_name There's no need for the prog_name handed down to the core to be mutable, so add const markings to it and all the related funcs. --- gdb/ChangeLog | 4 ++++ gdb/remote-sim.c | 2 +- include/gdb/ChangeLog | 4 ++++ include/gdb/remote-sim.h | 2 +- sim/arm/ChangeLog | 4 ++++ sim/arm/wrapper.c | 2 +- sim/avr/ChangeLog | 7 +++++-- sim/avr/interp.c | 2 +- sim/common/ChangeLog | 8 ++++++++ sim/common/sim-hload.c | 2 +- sim/common/sim-load.c | 2 +- sim/common/sim-utils.c | 2 +- sim/common/sim-utils.h | 4 ++-- sim/cr16/ChangeLog | 4 ++++ sim/cr16/interp.c | 2 +- sim/cris/ChangeLog | 4 ++++ sim/cris/sim-if.c | 2 +- sim/d10v/ChangeLog | 4 ++++ sim/d10v/interp.c | 2 +- sim/erc32/ChangeLog | 4 ++++ sim/erc32/interf.c | 2 +- sim/h8300/ChangeLog | 4 ++++ sim/h8300/compile.c | 2 +- sim/m32c/ChangeLog | 4 ++++ sim/m32c/gdb-if.c | 2 +- sim/mcore/ChangeLog | 4 ++++ sim/mcore/interp.c | 2 +- sim/microblaze/ChangeLog | 4 ++++ sim/microblaze/interp.c | 2 +- sim/moxie/ChangeLog | 4 ++++ sim/moxie/interp.c | 2 +- sim/ppc/ChangeLog | 4 ++++ sim/ppc/sim_calls.c | 2 +- sim/rl78/ChangeLog | 4 ++++ sim/rl78/gdb-if.c | 2 +- sim/rx/ChangeLog | 4 ++++ sim/rx/gdb-if.c | 2 +- sim/sh/ChangeLog | 4 ++++ sim/sh/interp.c | 2 +- 39 files changed, 99 insertions(+), 24 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2129d6ffcdf..8108e50d64a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * remote-sim.c (gdbsim_load): Add const to prog. + 2014-03-03 Tom Tromey * elfread.c (probe_key): Change to bfd_data. diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 06146903020..3bda0437567 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -564,7 +564,7 @@ static void gdbsim_load (struct target_ops *self, char *args, int fromtty) { char **argv; - char *prog; + const char *prog; struct sim_inferior_data *sim_data = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NEEDED); diff --git a/include/gdb/ChangeLog b/include/gdb/ChangeLog index d5afee2b505..5ffeef39fba 100644 --- a/include/gdb/ChangeLog +++ b/include/gdb/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * remote-sim.h (sim_load): Add const to prog. + 2014-02-09 Doug Evans * section-scripts.h: New file. diff --git a/include/gdb/remote-sim.h b/include/gdb/remote-sim.h index 985b2cd6a9b..b8b2406bcad 100644 --- a/include/gdb/remote-sim.h +++ b/include/gdb/remote-sim.h @@ -140,7 +140,7 @@ void sim_close (SIM_DESC sd, int quitting); Such manipulation should probably (?) occure in sim_create_inferior. */ -SIM_RC sim_load (SIM_DESC sd, char *prog, struct bfd *abfd, int from_tty); +SIM_RC sim_load (SIM_DESC sd, const char *prog, struct bfd *abfd, int from_tty); /* Prepare to run the simulated program. diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog index 7ad1e3d0baf..69e3447ae0c 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * wrapper.c (sim_load): Add const to prog. + 2013-09-23 Alan Modra * configure: Regenerate. diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index 0ea9ee1e314..c475962bc42 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -888,7 +888,7 @@ sim_close (sd, quitting) SIM_RC sim_load (sd, prog, abfd, from_tty) SIM_DESC sd; - char *prog; + const char *prog; bfd *abfd; int from_tty ATTRIBUTE_UNUSED; { diff --git a/sim/avr/ChangeLog b/sim/avr/ChangeLog index 8dd3ec59dd2..56f79be8c3b 100644 --- a/sim/avr/ChangeLog +++ b/sim/avr/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * interp.c (sim_load): Add const to prog. + 2013-09-23 Alan Modra * configure: Regenerate. @@ -13,8 +17,7 @@ 2012-05-24 Pedro Alves PR gdb/7205 - - Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. + * Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. 2012-03-24 Mike Frysinger diff --git a/sim/avr/interp.c b/sim/avr/interp.c index f14514b33b3..1ee6507eec8 100644 --- a/sim/avr/interp.c +++ b/sim/avr/interp.c @@ -1793,7 +1793,7 @@ sim_close (SIM_DESC sd, int quitting) } SIM_RC -sim_load (SIM_DESC sd, char *prog, bfd *abfd, int from_tty) +sim_load (SIM_DESC sd, const char *prog, bfd *abfd, int from_tty) { bfd *prog_bfd; diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 89e37ca99fb..9bf58e27af3 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,11 @@ +2014-03-05 Mike Frysinger + + * sim-hload.c (sim_load): Add const to prog. + * sim-load.c (sim_load_file): Likewise. + * sim-utils.c (sim_analyze_program): Likewise. + * sim-utils.h (sim_analyze_program): Likewise. + (sim_load_file): Likewise. + 2014-03-04 Mike Frysinger * acinclude.m4 (build_warnings): Copy from gdb/configure.ac. diff --git a/sim/common/sim-hload.c b/sim/common/sim-hload.c index 66a981bc5c9..b380ee01880 100644 --- a/sim/common/sim-hload.c +++ b/sim/common/sim-hload.c @@ -27,7 +27,7 @@ along with this program. If not, see . */ modeling a hardware platform. */ SIM_RC -sim_load (SIM_DESC sd, char *prog_name, struct bfd *prog_bfd, int from_tty) +sim_load (SIM_DESC sd, const char *prog_name, struct bfd *prog_bfd, int from_tty) { bfd *result_bfd; diff --git a/sim/common/sim-load.c b/sim/common/sim-load.c index f077065bcf5..7e29f6c306e 100644 --- a/sim/common/sim-load.c +++ b/sim/common/sim-load.c @@ -57,7 +57,7 @@ static void xprintf_bfd_vma (host_callback *, bfd_vma); bfd * sim_load_file (SIM_DESC sd, const char *myname, host_callback *callback, - char *prog, bfd *prog_bfd, int verbose_p, int lma_p, + const char *prog, bfd *prog_bfd, int verbose_p, int lma_p, sim_write_fn do_write) { asection *s; diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c index 2ec7c7c2169..64291f0c5b7 100644 --- a/sim/common/sim-utils.c +++ b/sim/common/sim-utils.c @@ -211,7 +211,7 @@ sim_add_commas (char *buf, int sizeof_buf, unsigned long value) bfd open. */ SIM_RC -sim_analyze_program (SIM_DESC sd, char *prog_name, bfd *prog_bfd) +sim_analyze_program (SIM_DESC sd, const char *prog_name, bfd *prog_bfd) { asection *s; SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); diff --git a/sim/common/sim-utils.h b/sim/common/sim-utils.h index ddb19abe252..30fac1a5f7f 100644 --- a/sim/common/sim-utils.h +++ b/sim/common/sim-utils.h @@ -45,7 +45,7 @@ unsigned long sim_elapsed_time_since (SIM_ELAPSED_TIME start); /* Utilities for manipulating the load image. */ -SIM_RC sim_analyze_program (SIM_DESC sd, char *prog_name, +SIM_RC sim_analyze_program (SIM_DESC sd, const char *prog_name, struct bfd *prog_bfd); /* Load program PROG into the simulator using the function DO_LOAD. @@ -63,7 +63,7 @@ SIM_RC sim_analyze_program (SIM_DESC sd, char *prog_name, typedef int sim_write_fn (SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length); struct bfd *sim_load_file (SIM_DESC sd, const char *myname, - host_callback *callback, char *prog, + host_callback *callback, const char *prog, struct bfd *prog_bfd, int verbose_p, int lma_p, sim_write_fn do_load); diff --git a/sim/cr16/ChangeLog b/sim/cr16/ChangeLog index 8e32571b7c6..9903ad4fa6f 100644 --- a/sim/cr16/ChangeLog +++ b/sim/cr16/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * interp.c (sim_load): Add const to prog. + 2014-03-04 Mike Frysinger * configure: Regenerate. diff --git a/sim/cr16/interp.c b/sim/cr16/interp.c index 2ef14cb4496..48da9167d93 100644 --- a/sim/cr16/interp.c +++ b/sim/cr16/interp.c @@ -1567,7 +1567,7 @@ sim_do_command (sd, cmd) } SIM_RC -sim_load (SIM_DESC sd, char *prog, struct bfd *abfd, int from_tty) +sim_load (SIM_DESC sd, const char *prog, struct bfd *abfd, int from_tty) { extern bfd *sim_load_file (); /* ??? Don't know where this should live. */ diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog index 07d04b07040..5b302295aab 100644 --- a/sim/cris/ChangeLog +++ b/sim/cris/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * sim-if.c (sim_load): Add const to prog. + 2014-03-04 Mike Frysinger * configure: Regenerate. diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c index 4ecba06f9e1..325321ff9fd 100644 --- a/sim/cris/sim-if.c +++ b/sim/cris/sim-if.c @@ -343,7 +343,7 @@ cris_program_offset_write (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, files differently. */ SIM_RC -sim_load (SIM_DESC sd, char *prog_name, struct bfd *prog_bfd, +sim_load (SIM_DESC sd, const char *prog_name, struct bfd *prog_bfd, int from_tty ATTRIBUTE_UNUSED) { bfd *result_bfd; diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog index 1231a5f1598..4a878b03306 100644 --- a/sim/d10v/ChangeLog +++ b/sim/d10v/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * interp.c (sim_load): Add const to prog. + 2014-03-04 Mike Frysinger * configure: Regenerate. diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c index a0b334ddb51..f07520ed1a1 100644 --- a/sim/d10v/interp.c +++ b/sim/d10v/interp.c @@ -1490,7 +1490,7 @@ sim_do_command (sd, cmd) SIM_RC sim_load (sd, prog, abfd, from_tty) SIM_DESC sd; - char *prog; + const char *prog; bfd *abfd; int from_tty; { diff --git a/sim/erc32/ChangeLog b/sim/erc32/ChangeLog index d7266fd7c06..15926937385 100644 --- a/sim/erc32/ChangeLog +++ b/sim/erc32/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * interf.c (sim_load): Add const to prog. + 2013-10-09 Sergio Durigan Junior PR sim/16018: diff --git a/sim/erc32/interf.c b/sim/erc32/interf.c index e2db44ea7fb..84229cd54d7 100644 --- a/sim/erc32/interf.c +++ b/sim/erc32/interf.c @@ -290,7 +290,7 @@ sim_close(sd, quitting) SIM_RC sim_load(sd, prog, abfd, from_tty) SIM_DESC sd; - char *prog; + const char *prog; bfd *abfd; int from_tty; { diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog index 38280e824d9..13bff7a706a 100644 --- a/sim/h8300/ChangeLog +++ b/sim/h8300/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * compile.c (sim_load): Add const to prog. + 2014-02-17 Mike Frysinger PR gdb/16450 diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index 2c7316ce6c9..348cdbbd42a 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -4974,7 +4974,7 @@ sim_close (SIM_DESC sd, int quitting) /* Called by gdb to load a program into memory. */ SIM_RC -sim_load (SIM_DESC sd, char *prog, bfd *abfd, int from_tty) +sim_load (SIM_DESC sd, const char *prog, bfd *abfd, int from_tty) { bfd *prog_bfd; diff --git a/sim/m32c/ChangeLog b/sim/m32c/ChangeLog index 9cd5fb6fd86..e202191e452 100644 --- a/sim/m32c/ChangeLog +++ b/sim/m32c/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * gdb-if.c (sim_load): Add const to prog. + 2013-09-23 Alan Modra * configure: Regenerate. diff --git a/sim/m32c/gdb-if.c b/sim/m32c/gdb-if.c index 56e08624cd1..bec9d48838a 100644 --- a/sim/m32c/gdb-if.c +++ b/sim/m32c/gdb-if.c @@ -128,7 +128,7 @@ open_objfile (const char *filename) SIM_RC -sim_load (SIM_DESC sd, char *prog, struct bfd * abfd, int from_tty) +sim_load (SIM_DESC sd, const char *prog, struct bfd * abfd, int from_tty) { check_desc (sd); diff --git a/sim/mcore/ChangeLog b/sim/mcore/ChangeLog index a034cdebd06..c97a2c5c7c8 100644 --- a/sim/mcore/ChangeLog +++ b/sim/mcore/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * interp.c (sim_load): Add const to prog. + 2014-02-17 Mike Frysinger PR gdb/16450 diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c index 72c59f7ecb9..9b08de051af 100644 --- a/sim/mcore/interp.c +++ b/sim/mcore/interp.c @@ -1922,7 +1922,7 @@ sim_close (sd, quitting) SIM_RC sim_load (sd, prog, abfd, from_tty) SIM_DESC sd; - char * prog; + const char * prog; bfd * abfd; int from_tty; { diff --git a/sim/microblaze/ChangeLog b/sim/microblaze/ChangeLog index fe6add2c77d..911a8b3769b 100644 --- a/sim/microblaze/ChangeLog +++ b/sim/microblaze/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * interp.c (sim_load): Add const to prog. + 2014-02-17 Mike Frysinger PR gdb/16450 diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c index 4907b7383d5..8fcf9d964cd 100644 --- a/sim/microblaze/interp.c +++ b/sim/microblaze/interp.c @@ -887,7 +887,7 @@ sim_close (SIM_DESC sd, int quitting) } SIM_RC -sim_load (SIM_DESC sd, char *prog, bfd *abfd, int from_tty) +sim_load (SIM_DESC sd, const char *prog, bfd *abfd, int from_tty) { /* Do the right thing for ELF executables; this turns out to be just about the right thing for any object format that: diff --git a/sim/moxie/ChangeLog b/sim/moxie/ChangeLog index 95daaef06b7..33a27852ffd 100644 --- a/sim/moxie/ChangeLog +++ b/sim/moxie/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * interp.c (sim_load): Add const to prog. + 2014-02-17 Mike Frysinger PR gdb/16450 diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c index 63dc8fc8fd9..32687322297 100644 --- a/sim/moxie/interp.c +++ b/sim/moxie/interp.c @@ -1230,7 +1230,7 @@ load_dtb (SIM_DESC sd, const char *filename) SIM_RC sim_load (sd, prog, abfd, from_tty) SIM_DESC sd; - char * prog; + const char * prog; bfd * abfd; int from_tty; { diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index 749ece73724..3f279fec114 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * sim_calls.c (sim_load): Add const to prog. + 2014-02-17 Aaro Koskinen PR gdb/12202 diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c index a3ebba0f5b3..27ee1fea1a7 100644 --- a/sim/ppc/sim_calls.c +++ b/sim/ppc/sim_calls.c @@ -97,7 +97,7 @@ sim_close (SIM_DESC sd, int quitting) SIM_RC -sim_load (SIM_DESC sd, char *prog, bfd *abfd, int from_tty) +sim_load (SIM_DESC sd, const char *prog, bfd *abfd, int from_tty) { TRACE(trace_gdb, ("sim_load(prog=%s, from_tty=%d) called\n", prog, from_tty)); diff --git a/sim/rl78/ChangeLog b/sim/rl78/ChangeLog index 1cf0e3971a1..4b556cc8beb 100644 --- a/sim/rl78/ChangeLog +++ b/sim/rl78/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * gdb-if.c (sim_load): Add const to prog. + 2013-09-23 Alan Modra * configure: Regenerate. diff --git a/sim/rl78/gdb-if.c b/sim/rl78/gdb-if.c index 5dce5cd8f6c..6c4b5b5fc89 100644 --- a/sim/rl78/gdb-if.c +++ b/sim/rl78/gdb-if.c @@ -140,7 +140,7 @@ open_objfile (const char *filename) /* Load a program. */ SIM_RC -sim_load (SIM_DESC sd, char *prog, struct bfd *abfd, int from_tty) +sim_load (SIM_DESC sd, const char *prog, struct bfd *abfd, int from_tty) { check_desc (sd); diff --git a/sim/rx/ChangeLog b/sim/rx/ChangeLog index dc2e3e50e10..3ce615e0ade 100644 --- a/sim/rx/ChangeLog +++ b/sim/rx/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * gdb-if.c (sim_load): Add const to prog. + 2014-02-17 Kevin Buettner * gdb-if.c (rx_signal_to_host): Rename to diff --git a/sim/rx/gdb-if.c b/sim/rx/gdb-if.c index 4c4434ce394..77048a0a0f9 100644 --- a/sim/rx/gdb-if.c +++ b/sim/rx/gdb-if.c @@ -192,7 +192,7 @@ addr_in_swap_list (bfd_vma addr) } SIM_RC -sim_load (SIM_DESC sd, char *prog, struct bfd *abfd, int from_tty) +sim_load (SIM_DESC sd, const char *prog, struct bfd *abfd, int from_tty) { check_desc (sd); diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog index 8c1b09b4ad3..d479841edb7 100644 --- a/sim/sh/ChangeLog +++ b/sim/sh/ChangeLog @@ -1,3 +1,7 @@ +2014-03-05 Mike Frysinger + + * interp.c (sim_load): Add const to prog. + 2014-02-17 Mike Frysinger PR gdb/16450 diff --git a/sim/sh/interp.c b/sim/sh/interp.c index 5689511fa8b..cf6fd8dae06 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -2685,7 +2685,7 @@ sim_close (sd, quitting) SIM_RC sim_load (sd, prog, abfd, from_tty) SIM_DESC sd; - char *prog; + const char *prog; bfd *abfd; int from_tty; { -- 2.30.2