* [PATCH] sim: constify sim_write source buffer @ 2010-04-10 21:58 Mike Frysinger 2010-04-13 15:35 ` Joel Brobecker 0 siblings, 1 reply; 6+ messages in thread From: Mike Frysinger @ 2010-04-10 21:58 UTC (permalink / raw) To: gdb-patches Most the sim write functions declare their source buffer const because they only ever read from it. The global sim_write() function does not follow this convention though which causes some warnings when trying to pass it const strings or buffers. Signed-off-by: Mike Frysinger <vapier@gentoo.org> --- include/gdb/: 2010-04-10 Mike Frysinger <vapier@gentoo.org> * remote-sim.h (sim_write): Add const to buf arg. sim/common/: 2010-04-10 Mike Frysinger <vapier@gentoo.org> * sim-hrw.c (sim_write): Add const to buf arg. * sim-utils.h (sim_write_fn): Likewise. include/gdb/remote-sim.h | 2 +- sim/common/sim-hrw.c | 2 +- sim/common/sim-utils.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/gdb/remote-sim.h b/include/gdb/remote-sim.h index cfb1c11..37f029a 100644 --- a/include/gdb/remote-sim.h +++ b/include/gdb/remote-sim.h @@ -175,7 +175,7 @@ int sim_read PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) memory. Store bytes starting at virtual address MEM. Result is number of bytes write, or zero if error. */ -int sim_write PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)); +int sim_write PARAMS ((SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length)); /* Fetch register REGNO storing its raw (target endian) value in the diff --git a/sim/common/sim-hrw.c b/sim/common/sim-hrw.c index e76a196..cedae87 100644 --- a/sim/common/sim-hrw.c +++ b/sim/common/sim-hrw.c @@ -32,7 +32,7 @@ sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) } int -sim_write (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) +sim_write (SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length) { SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); return sim_core_write_buffer (sd, NULL, write_map, diff --git a/sim/common/sim-utils.h b/sim/common/sim-utils.h index 75d2fb4..e3ff63a 100644 --- a/sim/common/sim-utils.h +++ b/sim/common/sim-utils.h @@ -63,7 +63,7 @@ SIM_RC sim_analyze_program (SIM_DESC sd, char *prog_name, This is still accommodated for backward compatibility reasons. */ typedef int sim_write_fn PARAMS ((SIM_DESC sd, SIM_ADDR mem, - unsigned char *buf, int length)); + const unsigned char *buf, int length)); struct bfd *sim_load_file (SIM_DESC sd, const char *myname, host_callback *callback, char *prog, struct bfd *prog_bfd, int verbose_p, -- 1.7.0.2 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sim: constify sim_write source buffer 2010-04-10 21:58 [PATCH] sim: constify sim_write source buffer Mike Frysinger @ 2010-04-13 15:35 ` Joel Brobecker 2010-04-13 20:39 ` [PATCH] sim: drop PARAMS Mike Frysinger 0 siblings, 1 reply; 6+ messages in thread From: Joel Brobecker @ 2010-04-13 15:35 UTC (permalink / raw) To: Mike Frysinger; +Cc: gdb-patches > include/gdb/: > 2010-04-10 Mike Frysinger <vapier@gentoo.org> > > * remote-sim.h (sim_write): Add const to buf arg. > > sim/common/: > 2010-04-10 Mike Frysinger <vapier@gentoo.org> > > * sim-hrw.c (sim_write): Add const to buf arg. > * sim-utils.h (sim_write_fn): Likewise. This is OK. If you feel courageous, I noticed that the .h files in the include/gdb subdirectory are still using the PARAMS macro. We stopped using them a very long time ago... A patch removing them is pre-approved. -- Joel ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] sim: drop PARAMS 2010-04-13 15:35 ` Joel Brobecker @ 2010-04-13 20:39 ` Mike Frysinger 0 siblings, 0 replies; 6+ messages in thread From: Mike Frysinger @ 2010-04-13 20:39 UTC (permalink / raw) To: Joel Brobecker; +Cc: gdb-patches [-- Attachment #1: Type: Text/Plain, Size: 13001 bytes --] On Tuesday 13 April 2010 11:35:32 Joel Brobecker wrote: > If you feel courageous, I noticed that the .h files in the include/gdb > subdirectory are still using the PARAMS macro. We stopped using them > a very long time ago... A patch removing them is pre-approved. ive committed this then, thanks -mike 2010-04-13 Mike Frysinger <vapier@gentoo.org> * callback.h: Strip PARAMS from prototypes. * remote-sim.h: Likewise. RCS file: /cvs/src/src/include/gdb/callback.h,v retrieving revision 1.17 diff -u -p -r1.17 callback.h --- include/gdb/callback.h 1 Jan 2010 10:03:24 -0000 1.17 +++ include/gdb/callback.h 13 Apr 2010 20:37:45 -0000 @@ -72,59 +72,59 @@ typedef struct host_callback_struct host struct host_callback_struct { - int (*close) PARAMS ((host_callback *,int)); - int (*get_errno) PARAMS ((host_callback *)); - int (*isatty) PARAMS ((host_callback *, int)); - int (*lseek) PARAMS ((host_callback *, int, long , int)); - int (*open) PARAMS ((host_callback *, const char*, int mode)); - int (*read) PARAMS ((host_callback *,int, char *, int)); - int (*read_stdin) PARAMS (( host_callback *, char *, int)); - int (*rename) PARAMS ((host_callback *, const char *, const char *)); - int (*system) PARAMS ((host_callback *, const char *)); - long (*time) PARAMS ((host_callback *, long *)); - int (*unlink) PARAMS ((host_callback *, const char *)); - int (*write) PARAMS ((host_callback *,int, const char *, int)); - int (*write_stdout) PARAMS ((host_callback *, const char *, int)); - void (*flush_stdout) PARAMS ((host_callback *)); - int (*write_stderr) PARAMS ((host_callback *, const char *, int)); - void (*flush_stderr) PARAMS ((host_callback *)); - int (*stat) PARAMS ((host_callback *, const char *, struct stat *)); - int (*fstat) PARAMS ((host_callback *, int, struct stat *)); - int (*lstat) PARAMS ((host_callback *, const char *, struct stat *)); - int (*ftruncate) PARAMS ((host_callback *, int, long)); - int (*truncate) PARAMS ((host_callback *, const char *, long)); - int (*pipe) PARAMS ((host_callback *, int *)); + int (*close) (host_callback *,int); + int (*get_errno) (host_callback *); + int (*isatty) (host_callback *, int); + int (*lseek) (host_callback *, int, long , int); + int (*open) (host_callback *, const char*, int mode); + int (*read) (host_callback *,int, char *, int); + int (*read_stdin) ( host_callback *, char *, int); + int (*rename) (host_callback *, const char *, const char *); + int (*system) (host_callback *, const char *); + long (*time) (host_callback *, long *); + int (*unlink) (host_callback *, const char *); + int (*write) (host_callback *,int, const char *, int); + int (*write_stdout) (host_callback *, const char *, int); + void (*flush_stdout) (host_callback *); + int (*write_stderr) (host_callback *, const char *, int); + void (*flush_stderr) (host_callback *); + int (*stat) (host_callback *, const char *, struct stat *); + int (*fstat) (host_callback *, int, struct stat *); + int (*lstat) (host_callback *, const char *, struct stat *); + int (*ftruncate) (host_callback *, int, long); + int (*truncate) (host_callback *, const char *, long); + int (*pipe) (host_callback *, int *); /* Called by the framework when a read call has emptied a pipe buffer. */ - void (*pipe_empty) PARAMS ((host_callback *, int read_fd, int write_fd)); + void (*pipe_empty) (host_callback *, int read_fd, int write_fd); /* Called by the framework when a write call makes a pipe buffer non-empty. */ - void (*pipe_nonempty) PARAMS ((host_callback *, int read_fd, int write_fd)); + void (*pipe_nonempty) (host_callback *, int read_fd, int write_fd); /* When present, call to the client to give it the oportunity to poll any io devices for a request to quit (indicated by a nonzero return value). */ - int (*poll_quit) PARAMS ((host_callback *)); + int (*poll_quit) (host_callback *); /* Used when the target has gone away, so we can close open handles and free memory etc etc. */ - int (*shutdown) PARAMS ((host_callback *)); - int (*init) PARAMS ((host_callback *)); + int (*shutdown) (host_callback *); + int (*init) (host_callback *); /* depreciated, use vprintf_filtered - Talk to the user on a console. */ - void (*printf_filtered) PARAMS ((host_callback *, const char *, ...)); + void (*printf_filtered) (host_callback *, const char *, ...); /* Talk to the user on a console. */ - void (*vprintf_filtered) PARAMS ((host_callback *, const char *, va_list)); + void (*vprintf_filtered) (host_callback *, const char *, va_list); /* Same as vprintf_filtered but to stderr. */ - void (*evprintf_filtered) PARAMS ((host_callback *, const char *, va_list)); + void (*evprintf_filtered) (host_callback *, const char *, va_list); /* Print an error message and "exit". In the case of gdb "exiting" means doing a longjmp back to the main command loop. */ - void (*error) PARAMS ((host_callback *, const char *, ...)) + void (*error) (host_callback *, const char *, ...) #ifdef __GNUC__ __attribute__ ((__noreturn__)) #endif @@ -260,12 +260,12 @@ typedef struct cb_syscall { argument here. We mimic sim_{read,write} for now. Be careful to test any changes with -Wall -Werror, mixed signed comparisons will get you. */ - int (*read_mem) PARAMS ((host_callback * /*cb*/, struct cb_syscall * /*sc*/, - unsigned long /*taddr*/, char * /*buf*/, - int /*bytes*/)); - int (*write_mem) PARAMS ((host_callback * /*cb*/, struct cb_syscall * /*sc*/, - unsigned long /*taddr*/, const char * /*buf*/, - int /*bytes*/)); + int (*read_mem) (host_callback * /*cb*/, struct cb_syscall * /*sc*/, + unsigned long /*taddr*/, char * /*buf*/, + int /*bytes*/); + int (*write_mem) (host_callback * /*cb*/, struct cb_syscall * /*sc*/, + unsigned long /*taddr*/, const char * /*buf*/, + int /*bytes*/); /* For sanity checking, should be last entry. */ int magic; @@ -294,37 +294,37 @@ typedef enum { } CB_RC; /* Read in target values for system call numbers, errno values, signals. */ -CB_RC cb_read_target_syscall_maps PARAMS ((host_callback *, const char *)); +CB_RC cb_read_target_syscall_maps (host_callback *, const char *); /* Translate target to host syscall function numbers. */ -int cb_target_to_host_syscall PARAMS ((host_callback *, int)); +int cb_target_to_host_syscall (host_callback *, int); /* Translate host to target errno value. */ -int cb_host_to_target_errno PARAMS ((host_callback *, int)); +int cb_host_to_target_errno (host_callback *, int); /* Translate target to host open flags. */ -int cb_target_to_host_open PARAMS ((host_callback *, int)); +int cb_target_to_host_open (host_callback *, int); /* Translate target signal number to host. */ -int cb_target_to_host_signal PARAMS ((host_callback *, int)); +int cb_target_to_host_signal (host_callback *, int); /* Translate host signal number to target. */ -int cb_host_to_target_signal PARAMS ((host_callback *, int)); +int cb_host_to_target_signal (host_callback *, int); /* Translate host stat struct to target. If stat struct ptr is NULL, just compute target stat struct size. Result is size of target stat struct or 0 if error. */ -int cb_host_to_target_stat PARAMS ((host_callback *, const struct stat *, PTR)); +int cb_host_to_target_stat (host_callback *, const struct stat *, PTR); /* Translate a value to target endian. */ -void cb_store_target_endian PARAMS ((host_callback *, char *, int, long)); +void cb_store_target_endian (host_callback *, char *, int, long); /* Tests for special fds. */ -int cb_is_stdin PARAMS ((host_callback *, int)); -int cb_is_stdout PARAMS ((host_callback *, int)); -int cb_is_stderr PARAMS ((host_callback *, int)); +int cb_is_stdin (host_callback *, int); +int cb_is_stdout (host_callback *, int); +int cb_is_stderr (host_callback *, int); /* Perform a system call. */ -CB_RC cb_syscall PARAMS ((host_callback *, CB_SYSCALL *)); +CB_RC cb_syscall (host_callback *, CB_SYSCALL *); #endif RCS file: /cvs/src/src/include/gdb/remote-sim.h,v retrieving revision 1.10 diff -u -p -r1.10 remote-sim.h --- include/gdb/remote-sim.h 13 Apr 2010 20:28:19 -0000 1.10 +++ include/gdb/remote-sim.h 13 Apr 2010 20:37:45 -0000 @@ -104,7 +104,7 @@ struct bfd; sim_create_inferior. FIXME: What should the state of the simulator be? */ -SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND kind, struct host_callback_struct *callback, struct bfd *abfd, char **argv)); +SIM_DESC sim_open (SIM_OPEN_KIND kind, struct host_callback_struct *callback, struct bfd *abfd, char **argv); /* Destory a simulator instance. @@ -115,7 +115,7 @@ SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND and mmap'd areas. You cannot assume sim_kill has already been called. */ -void sim_close PARAMS ((SIM_DESC sd, int quitting)); +void sim_close (SIM_DESC sd, int quitting); /* Load program PROG into the simulators memory. @@ -141,7 +141,7 @@ void sim_close PARAMS ((SIM_DESC sd, int Such manipulation should probably (?) occure in sim_create_inferior. */ -SIM_RC sim_load PARAMS ((SIM_DESC sd, char *prog, struct bfd *abfd, int from_tty)); +SIM_RC sim_load (SIM_DESC sd, char *prog, struct bfd *abfd, int from_tty); /* Prepare to run the simulated program. @@ -161,21 +161,21 @@ SIM_RC sim_load PARAMS ((SIM_DESC sd, ch address space (according to the applicable ABI) and the program counter and stack pointer set accordingly. */ -SIM_RC sim_create_inferior PARAMS ((SIM_DESC sd, struct bfd *abfd, char **argv, char **env)); +SIM_RC sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env); /* Fetch LENGTH bytes of the simulated program's memory. Start fetch at virtual address MEM and store in BUF. Result is number of bytes read, or zero if error. */ -int sim_read PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)); +int sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length); /* Store LENGTH bytes from BUF into the simulated program's memory. Store bytes starting at virtual address MEM. Result is number of bytes write, or zero if error. */ -int sim_write PARAMS ((SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length)); +int sim_write (SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length); /* Fetch register REGNO storing its raw (target endian) value in the @@ -187,7 +187,7 @@ int sim_write PARAMS ((SIM_DESC sd, SIM_ If LENGTH does not match the size of REGNO no data is transfered (the actual register size is still returned). */ -int sim_fetch_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf, int length)); +int sim_fetch_register (SIM_DESC sd, int regno, unsigned char *buf, int length); /* Store register REGNO from the raw (target endian) value in BUF. @@ -199,14 +199,14 @@ int sim_fetch_register PARAMS ((SIM_DESC If LENGTH does not match the size of REGNO no data is transfered (the actual register size is still returned). */ -int sim_store_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf, int length)); +int sim_store_register (SIM_DESC sd, int regno, unsigned char *buf, int length); /* Print whatever statistics the simulator has collected. VERBOSE is currently unused and must always be zero. */ -void sim_info PARAMS ((SIM_DESC sd, int verbose)); +void sim_info (SIM_DESC sd, int verbose); /* Run (or resume) the simulated program. @@ -231,14 +231,14 @@ void sim_info PARAMS ((SIM_DESC sd, int continued. A zero SIGRC value indicates that the program should continue as normal. */ -void sim_resume PARAMS ((SIM_DESC sd, int step, int siggnal)); +void sim_resume (SIM_DESC sd, int step, int siggnal); /* Asynchronous request to stop the simulation. A nonzero return indicates that the simulator is able to handle the request */ -int sim_stop PARAMS ((SIM_DESC sd)); +int sim_stop (SIM_DESC sd); /* Fetch the REASON why the program stopped. @@ -265,14 +265,14 @@ int sim_stop PARAMS ((SIM_DESC sd)); enum sim_stop { sim_running, sim_polling, sim_exited, sim_stopped, sim_signalled }; -void sim_stop_reason PARAMS ((SIM_DESC sd, enum sim_stop *reason, int *sigrc)); +void sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc); /* Passthru for other commands that the simulator might support. Simulators should be prepared to deal with any combination of NULL or empty CMD. */ -void sim_do_command PARAMS ((SIM_DESC sd, char *cmd)); +void sim_do_command (SIM_DESC sd, char *cmd); #ifdef __cplusplus } [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sim: constify sim_write source buffer
@ 2010-04-13 23:25 Sandra Loosemore
2010-04-14 0:39 ` Mike Frysinger
0 siblings, 1 reply; 6+ messages in thread
From: Sandra Loosemore @ 2010-04-13 23:25 UTC (permalink / raw)
To: Mike Frysinger; +Cc: gdb-patches
FYI, this patch:
2010-04-13 Mike Frysinger <vapier@gentoo.org>
* remote-sim.h (sim_write): Add const to buf arg.
caused the ARM simulator to fail to build. See sim/arm/wrapper.c:158:
int
sim_write (sd, addr, buffer, size)
SIM_DESC sd ATTRIBUTE_UNUSED;
SIM_ADDR addr;
unsigned char * buffer;
int size;
The obvious patch makes it build, at least.
-Sandra
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] sim: constify sim_write source buffer 2010-04-13 23:25 [PATCH] sim: constify sim_write source buffer Sandra Loosemore @ 2010-04-14 0:39 ` Mike Frysinger 2010-04-14 6:03 ` Hans-Peter Nilsson 0 siblings, 1 reply; 6+ messages in thread From: Mike Frysinger @ 2010-04-14 0:39 UTC (permalink / raw) To: Sandra Loosemore; +Cc: gdb-patches [-- Attachment #1: Type: Text/Plain, Size: 9953 bytes --] On Tuesday 13 April 2010 19:26:10 Sandra Loosemore wrote: > FYI, this patch: > > 2010-04-13 Mike Frysinger <vapier@gentoo.org> > > * remote-sim.h (sim_write): Add const to buf arg. > > caused the ARM simulator to fail to build. See sim/arm/wrapper.c:158: hmm, i didnt realize so many sim ports arent using the common/ code. the targets ive been testing all do. this patch should build fine for the targets that otherwise work (seems like some have been marked for removal apparently, and moxie requires some random "dtc" program). -mike arm/ 2010-04-13 Mike Frysinger <vapier@gentoo.org> * wrapper.c (sim_write): Add const to buffer arg. RCS file: /cvs/src/src/sim/arm/wrapper.c,v retrieving revision 1.38 diff -u -p -r1.38 wrapper.c --- sim/arm/wrapper.c 1 Jan 2010 10:03:26 -0000 1.38 +++ sim/arm/wrapper.c 14 Apr 2010 00:20:26 -0000 @@ -158,7 +158,7 @@ int sim_write (sd, addr, buffer, size) SIM_DESC sd ATTRIBUTE_UNUSED; SIM_ADDR addr; - unsigned char * buffer; + const unsigned char * buffer; int size; { int i; avr/ 2010-04-13 Mike Frysinger <vapier@gentoo.org> * interp.c (sim_write): Add const to buffer arg. RCS file: /cvs/src/src/sim/avr/interp.c,v retrieving revision 1.6 diff -u -p -r1.6 interp.c --- sim/avr/interp.c 1 Jan 2010 10:03:26 -0000 1.6 +++ sim/avr/interp.c 14 Apr 2010 00:20:26 -0000 @@ -1622,7 +1622,7 @@ sim_trace (SIM_DESC sd) } int -sim_write (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size) +sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size) { int osize = size; cr16/ 2010-04-13 Mike Frysinger <vapier@gentoo.org> * interp.c (sim_write): Add const to buffer arg. RCS file: /cvs/src/src/sim/cr16/interp.c,v retrieving revision 1.5 diff -u -p -r1.5 interp.c --- sim/cr16/interp.c 1 Jan 2010 10:03:27 -0000 1.5 +++ sim/cr16/interp.c 14 Apr 2010 00:20:26 -0000 @@ -883,7 +883,7 @@ int sim_write (sd, addr, buffer, size) SIM_DESC sd; SIM_ADDR addr; - unsigned char *buffer; + const unsigned char *buffer; int size; { /* FIXME: this should be performing a virtual transfer */ d10v/ 2010-04-13 Mike Frysinger <vapier@gentoo.org> * interp.c (sim_write): Add const to buffer arg. RCS file: /cvs/src/src/sim/d10v/interp.c,v retrieving revision 1.18 diff -u -p -r1.18 interp.c --- sim/d10v/interp.c 18 Apr 2006 09:15:29 -0000 1.18 +++ sim/d10v/interp.c 14 Apr 2010 00:20:26 -0000 @@ -761,7 +761,7 @@ int sim_write (sd, addr, buffer, size) SIM_DESC sd; SIM_ADDR addr; - unsigned char *buffer; + const unsigned char *buffer; int size; { /* FIXME: this should be performing a virtual transfer */ erc32/ 2010-04-13 Mike Frysinger <vapier@gentoo.org> * interp.c (sim_write): Add const to buf arg. RCS file: /cvs/src/src/sim/erc32/interf.c,v retrieving revision 1.6 diff -u -p -r1.6 interf.c --- sim/erc32/interf.c 28 Nov 2005 18:33:03 -0000 1.6 +++ sim/erc32/interf.c 14 Apr 2010 00:20:26 -0000 @@ -351,7 +351,7 @@ int sim_write(sd, mem, buf, length) SIM_DESC sd; SIM_ADDR mem; - unsigned char *buf; + const unsigned char *buf; int length; { return (sis_memory_write(mem, buf, length)); h8300/ 2010-04-13 Mike Frysinger <vapier@gentoo.org> * compile.c (sim_write): Add const to buffer arg. RCS file: /cvs/src/src/sim/h8300/compile.c,v retrieving revision 1.46 diff -u -p -r1.46 compile.c --- sim/h8300/compile.c 9 Dec 2009 05:32:16 -0000 1.46 +++ sim/h8300/compile.c 14 Apr 2010 00:20:26 -0000 @@ -4616,7 +4616,7 @@ sim_trace (SIM_DESC sd) } int -sim_write (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size) +sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size) { int i; m32c/ 2010-04-13 Mike Frysinger <vapier@gentoo.org> * gdb-if.c (sim_write): Add const to buf arg. * mem.h (mem_put_blk): Add const to bufptr arg. * mem.c (mem_put_blk): Likewise, and add const to cast. RCS file: /cvs/src/src/sim/m32c/gdb-if.c,v retrieving revision 1.9 diff -u -p -r1.9 gdb-if.c --- sim/m32c/gdb-if.c 1 Jan 2010 10:03:31 -0000 1.9 +++ sim/m32c/gdb-if.c 14 Apr 2010 00:20:26 -0000 @@ -167,7 +167,7 @@ sim_read (SIM_DESC sd, SIM_ADDR mem, uns } int -sim_write (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) +sim_write (SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length) { check_desc (sd); RCS file: /cvs/src/src/sim/m32c/mem.c,v retrieving revision 1.11 diff -u -p -r1.11 mem.c --- sim/m32c/mem.c 1 Jan 2010 10:03:31 -0000 1.11 +++ sim/m32c/mem.c 14 Apr 2010 00:34:30 -0000 @@ -365,13 +365,13 @@ mem_put_si (int address, unsigned long v } void -mem_put_blk (int address, void *bufptr, int nbytes) +mem_put_blk (int address, const void *bufptr, int nbytes) { S ("<="); if (enable_counting) mem_counters[1][1] += nbytes; while (nbytes--) - mem_put_byte (address++, *(unsigned char *) bufptr++); + mem_put_byte (address++, *(const unsigned char *) bufptr++); E (); } RCS file: /cvs/src/src/sim/m32c/mem.h,v retrieving revision 1.8 diff -u -p -r1.8 mem.h --- sim/m32c/mem.h 1 Jan 2010 10:03:31 -0000 1.8 +++ sim/m32c/mem.h 14 Apr 2010 00:34:30 -0000 @@ -27,7 +27,7 @@ void mem_put_hi (int address, unsigned s void mem_put_psi (int address, unsigned long value); void mem_put_si (int address, unsigned long value); -void mem_put_blk (int address, void *bufptr, int nbytes); +void mem_put_blk (int address, const void *bufptr, int nbytes); unsigned char mem_get_pc (); mcore/ 2010-04-13 Mike Frysinger <vapier@gentoo.org> * interp.c (sim_write): Add const to buffer arg. RCS file: /cvs/src/src/sim/mcore/interp.c,v retrieving revision 1.12 diff -u -p -r1.12 interp.c --- sim/mcore/interp.c 1 Jan 2010 10:03:32 -0000 1.12 +++ sim/mcore/interp.c 14 Apr 2010 00:20:26 -0000 @@ -1718,7 +1718,7 @@ int sim_write (sd, addr, buffer, size) SIM_DESC sd; SIM_ADDR addr; - unsigned char * buffer; + const unsigned char * buffer; int size; { int i; microblaze/ 2010-04-13 Mike Frysinger <vapier@gentoo.org> * interp.c (sim_write): Add const to buffer arg. RCS file: /cvs/src/src/sim/microblaze/interp.c,v retrieving revision 1.3 diff -u -p -r1.3 interp.c --- sim/microblaze/interp.c 1 Jan 2010 10:03:32 -0000 1.3 +++ sim/microblaze/interp.c 14 Apr 2010 00:20:26 -0000 @@ -704,7 +704,7 @@ sim_resume (SIM_DESC sd, int step, int s int -sim_write (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size) +sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size) { int i; init_pointers (); mips/ 2010-04-13 Mike Frysinger <vapier@gentoo.org> * interp.c (sim_write): Add const to buffer arg. RCS file: /cvs/src/src/sim/mips/interp.c,v retrieving revision 1.25 diff -u -p -r1.25 interp.c --- sim/mips/interp.c 18 Jan 2010 03:30:28 -0000 1.25 +++ sim/mips/interp.c 14 Apr 2010 00:20:26 -0000 @@ -862,7 +862,7 @@ int sim_write (sd,addr,buffer,size) SIM_DESC sd; SIM_ADDR addr; - unsigned char *buffer; + const unsigned char *buffer; int size; { int index; moxie/ 2010-04-13 Mike Frysinger <vapier@gentoo.org> * interp.c (sim_write): Add const to buffer arg. RCS file: /cvs/src/src/sim/moxie/interp.c,v retrieving revision 1.10 diff -u -p -r1.10 interp.c --- sim/moxie/interp.c 27 Feb 2010 01:24:37 -0000 1.10 +++ sim/moxie/interp.c 14 Apr 2010 00:20:26 -0000 @@ -1028,7 +1028,7 @@ int sim_write (sd, addr, buffer, size) SIM_DESC sd; SIM_ADDR addr; - unsigned char * buffer; + const unsigned char * buffer; int size; { sim_cpu *scpu = STATE_CPU (sd, 0); /* FIXME */ ppc/ 2010-04-13 Mike Frysinger <vapier@gentoo.org> * sim_calls.c (sim_write): Add const to buf arg. RCS file: /cvs/src/src/sim/ppc/sim_calls.c,v retrieving revision 1.12 diff -u -p -r1.12 sim_calls.c --- sim/ppc/sim_calls.c 28 Nov 2005 18:33:03 -0000 1.12 +++ sim/ppc/sim_calls.c 14 Apr 2010 00:20:26 -0000 @@ -144,7 +144,7 @@ sim_read (SIM_DESC sd, SIM_ADDR mem, uns int -sim_write (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) +sim_write (SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length) { int result = psim_write_memory(simulator, MAX_NR_PROCESSORS, buf, mem, length, rx/ 2010-04-13 Mike Frysinger <vapier@gentoo.org> * gdb-if.c (sim_write): Add const to buf arg. RCS file: /cvs/src/src/sim/rx/gdb-if.c,v retrieving revision 1.2 diff -u -p -r1.2 gdb-if.c --- sim/rx/gdb-if.c 1 Jan 2010 10:03:33 -0000 1.2 +++ sim/rx/gdb-if.c 14 Apr 2010 00:20:26 -0000 @@ -245,7 +245,7 @@ sim_read (SIM_DESC sd, SIM_ADDR mem, uns } int -sim_write (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) +sim_write (SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length) { int i; sh/ 2010-04-13 Mike Frysinger <vapier@gentoo.org> * interp.c (sim_write): Add const to buffer arg. RCS file: /cvs/src/src/sim/sh/interp.c,v retrieving revision 1.21 diff -u -p -r1.21 interp.c --- sim/sh/interp.c 14 Feb 2010 07:15:57 -0000 1.21 +++ sim/sh/interp.c 14 Apr 2010 00:20:26 -0000 @@ -81,7 +81,7 @@ extern unsigned short sh_jump_table[], sh_dsp_table[0x1000], ppi_table[]; -int sim_write (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size); +int sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size); #define O_RECOMPILE 85 #define DEFINE_TABLE @@ -2141,7 +2141,7 @@ int sim_write (sd, addr, buffer, size) SIM_DESC sd; SIM_ADDR addr; - unsigned char *buffer; + const unsigned char *buffer; int size; { int i; [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sim: constify sim_write source buffer 2010-04-14 0:39 ` Mike Frysinger @ 2010-04-14 6:03 ` Hans-Peter Nilsson 0 siblings, 0 replies; 6+ messages in thread From: Hans-Peter Nilsson @ 2010-04-14 6:03 UTC (permalink / raw) To: Mike Frysinger; +Cc: Sandra Loosemore, gdb-patches On Tue, 13 Apr 2010, Mike Frysinger wrote: > hmm, i didnt realize so many sim ports arent using the common/ code. the > targets ive been testing all do. this patch should build fine for the targets > that otherwise work (seems like some have been marked for removal apparently, > and moxie requires some random "dtc" program). Approved. Obvious, actually. brgds, H-P ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-04-14 6:03 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-04-10 21:58 [PATCH] sim: constify sim_write source buffer Mike Frysinger 2010-04-13 15:35 ` Joel Brobecker 2010-04-13 20:39 ` [PATCH] sim: drop PARAMS Mike Frysinger 2010-04-13 23:25 [PATCH] sim: constify sim_write source buffer Sandra Loosemore 2010-04-14 0:39 ` Mike Frysinger 2010-04-14 6:03 ` Hans-Peter Nilsson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox