From 47b667dea5dd1f1c4fc7a1304163c254ffa16161 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 26 May 2005 20:49:03 +0000 Subject: [PATCH] 2005-05-26 Andrew Cagney * command.h (add_setshow_integer_cmd): Make VAR an integer. * cli/cli-decode.c (add_setshow_integer_cmd): Update to match. * valops.c (value_string): Add a cast. * eval.c (evaluate_subexp_standard): Use gdb_byte for byte buffers. * breakpoint.c (re_enable_breakpoints_in_shlibs): Use gdb_byte for byte buffers. * target.h (struct target_ops): For to_insert_hw_breakpoint and to_remove_hw_breakpoint use gdb_byte for byte buffer parameters. * breakpoint.h (struct bp_location): Make shadow_contents a gdb_byte buffer. * cli/cli-setshow.c (do_setshow_command): Fix cast. * cli/cli-dump.c (restore_section_callback) (restore_binary_file): Use gdb_byte for byte buffers. * proc-service.c (ps_ptwrite, ps_ptread, ps_pdwrite): Fix casts. (ps_xfer_memory): Use gdb_byte for byte buffers. * tracepoint.c (mem2hex): Use gdb_byte for byte buffers, and char for string buffers. * ser-tcp.c (net_open): Make len a socklen_t. --- gdb/ChangeLog | 21 +++++++++++++++++++++ gdb/breakpoint.c | 3 ++- gdb/breakpoint.h | 2 +- gdb/cli/cli-decode.c | 2 +- gdb/cli/cli-dump.c | 4 ++-- gdb/cli/cli-setshow.c | 8 ++------ gdb/command.h | 2 +- gdb/eval.c | 2 +- gdb/proc-service.c | 8 ++++---- gdb/ser-tcp.c | 3 ++- gdb/target.h | 4 ++-- gdb/tracepoint.c | 8 ++++---- gdb/valops.c | 2 +- 13 files changed, 44 insertions(+), 25 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a91f556ad11..b05eb5aeb01 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,24 @@ +2005-05-26 Andrew Cagney + + * command.h (add_setshow_integer_cmd): Make VAR an integer. + * cli/cli-decode.c (add_setshow_integer_cmd): Update to match. + * valops.c (value_string): Add a cast. + * eval.c (evaluate_subexp_standard): Use gdb_byte for byte buffers. + * breakpoint.c (re_enable_breakpoints_in_shlibs): Use gdb_byte for + byte buffers. + * target.h (struct target_ops): For to_insert_hw_breakpoint and + to_remove_hw_breakpoint use gdb_byte for byte buffer parameters. + * breakpoint.h (struct bp_location): Make shadow_contents a + gdb_byte buffer. + * cli/cli-setshow.c (do_setshow_command): Fix cast. + * cli/cli-dump.c (restore_section_callback) + (restore_binary_file): Use gdb_byte for byte buffers. + * proc-service.c (ps_ptwrite, ps_ptread, ps_pdwrite): Fix casts. + (ps_xfer_memory): Use gdb_byte for byte buffers. + * tracepoint.c (mem2hex): Use gdb_byte for byte buffers, and char + for string buffers. + * ser-tcp.c (net_open): Make len a socklen_t. + 2005-05-24 Andrew Cagney * rs6000-tdep.c (ppc_supply_reg, ppc_collect_reg): Use gdb_byte diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 7e329434aad..76c73d7b9c3 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -4441,7 +4441,8 @@ re_enable_breakpoints_in_shlibs (void) { if (b->enable_state == bp_shlib_disabled) { - char buf[1], *lib; + gdb_byte buf[1]; + char *lib; /* Do not reenable the breakpoint if the shared library is still not mapped in. */ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 67a67e34054..53a6033d054 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -247,7 +247,7 @@ struct bp_location control of the target insert_breakpoint and remove_breakpoint routines. No other code should assume anything about the value(s) here. Valid only for bp_loc_software_breakpoint. */ - char shadow_contents[BREAKPOINT_MAX]; + gdb_byte shadow_contents[BREAKPOINT_MAX]; /* Address at which breakpoint was requested, either by the user or by GDB for internal breakpoints. This will usually be the same diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 30ce415262a..9933e30656c 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -537,7 +537,7 @@ add_setshow_optional_filename_cmd (char *name, enum command_class class, value. SET_DOC and SHOW_DOC are the documentation strings. */ void add_setshow_integer_cmd (char *name, enum command_class class, - unsigned int *var, + int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 724f776f4b8..e855c4c4d27 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -463,7 +463,7 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args) bfd_size_type sec_offset = 0; bfd_size_type sec_load_count = size; struct cleanup *old_chain; - char *buf; + gdb_byte *buf; int ret; /* Ignore non-loadable sections, eg. from elf files. */ @@ -525,7 +525,7 @@ restore_binary_file (char *filename, struct callback_data *data) { FILE *file = fopen_with_cleanup (filename, FOPEN_RB); int status; - char *buf; + gdb_byte *buf; long len; /* Get the file size for reading. */ diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index fca92b07470..4002953bb71 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -301,12 +301,8 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) switch (c->var_type) { case var_string: - { - unsigned char *p; - - if (*(unsigned char **) c->var) - fputstr_filtered (*(unsigned char **) c->var, '"', stb->stream); - } + if (((char *)c->var)[0] != '\0') + fputstr_filtered ((char *)c->var, '"', stb->stream); break; case var_string_noescape: case var_optional_filename: diff --git a/gdb/command.h b/gdb/command.h index 0729752d997..9bc01e7decd 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -305,7 +305,7 @@ extern void add_setshow_optional_filename_cmd (char *name, extern void add_setshow_integer_cmd (char *name, enum command_class class, - unsigned int *var, + int *var, const char *set_doc, const char *show_doc, const char *help_doc, diff --git a/gdb/eval.c b/gdb/eval.c index 98f55809aee..0ad71793f64 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -559,7 +559,7 @@ evaluate_subexp_standard (struct type *expect_type, && TYPE_CODE (type) == TYPE_CODE_SET) { struct value *set = allocate_value (expect_type); - char *valaddr = value_contents_raw (set); + gdb_byte *valaddr = value_contents_raw (set); struct type *element_type = TYPE_INDEX_TYPE (type); struct type *check_type = element_type; LONGEST low_bound, high_bound; diff --git a/gdb/proc-service.c b/gdb/proc-service.c index d7cd1aaf91b..e0233fc704a 100644 --- a/gdb/proc-service.c +++ b/gdb/proc-service.c @@ -67,7 +67,7 @@ typedef size_t gdb_ps_size_t; static ps_err_e ps_xfer_memory (const struct ps_prochandle *ph, paddr_t addr, - char *buf, size_t len, int write) + gdb_byte *buf, size_t len, int write) { struct cleanup *old_chain = save_inferior_ptid (); int ret; @@ -201,7 +201,7 @@ ps_err_e ps_pdwrite (gdb_ps_prochandle_t ph, paddr_t addr, gdb_ps_write_buf_t buf, gdb_ps_size_t size) { - return ps_xfer_memory (ph, addr, (char *) buf, size, 1); + return ps_xfer_memory (ph, addr, (gdb_byte *) buf, size, 1); } /* Read SIZE bytes from the target process PH at address ADDR and copy @@ -211,7 +211,7 @@ ps_err_e ps_ptread (gdb_ps_prochandle_t ph, paddr_t addr, gdb_ps_read_buf_t buf, gdb_ps_size_t size) { - return ps_xfer_memory (ph, addr, buf, size, 0); + return ps_xfer_memory (ph, addr, (gdb_byte *) buf, size, 0); } /* Write SIZE bytes from BUF into the target process PH at address ADDR. */ @@ -220,7 +220,7 @@ ps_err_e ps_ptwrite (gdb_ps_prochandle_t ph, paddr_t addr, gdb_ps_write_buf_t buf, gdb_ps_size_t size) { - return ps_xfer_memory (ph, addr, (char *) buf, size, 1); + return ps_xfer_memory (ph, addr, (gdb_byte *) buf, size, 1); } /* Get the general registers of LWP LWPID within the target process PH diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c index abe6ed4a35b..6b19c31aa4b 100644 --- a/gdb/ser-tcp.c +++ b/gdb/ser-tcp.c @@ -187,7 +187,8 @@ net_open (struct serial *scb, const char *name) /* Got something. Is it an error? */ { - int res, err, len; + int res, err; + socklen_t len; len = sizeof(err); /* On Windows, the fourth parameter to getsockopt is a "char *"; on UNIX systems it is generally "void *". The cast to "void *" diff --git a/gdb/target.h b/gdb/target.h index bc10b25629a..582fa789a67 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -338,8 +338,8 @@ struct target_ops int (*to_insert_breakpoint) (CORE_ADDR, gdb_byte *); int (*to_remove_breakpoint) (CORE_ADDR, gdb_byte *); int (*to_can_use_hw_breakpoint) (int, int, int); - int (*to_insert_hw_breakpoint) (CORE_ADDR, char *); - int (*to_remove_hw_breakpoint) (CORE_ADDR, char *); + int (*to_insert_hw_breakpoint) (CORE_ADDR, gdb_byte *); + int (*to_remove_hw_breakpoint) (CORE_ADDR, gdb_byte *); int (*to_remove_watchpoint) (CORE_ADDR, int, int); int (*to_insert_watchpoint) (CORE_ADDR, int, int); int (*to_stopped_by_watchpoint) (void); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index ec3c53f78ec..bf4a2c519fa 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -150,7 +150,7 @@ static void trace_mention (struct tracepoint *); struct collection_list; static void add_aexpr (struct collection_list *, struct agent_expr *); -static unsigned char *mem2hex (unsigned char *, unsigned char *, int); +static char *mem2hex (gdb_byte *, char *, int); static void add_register (struct collection_list *collection, unsigned int regno); static struct cleanup *make_cleanup_free_actions (struct tracepoint *t); @@ -2645,10 +2645,10 @@ trace_dump_command (char *args, int from_tty) static const char hexchars[] = "0123456789abcdef"; -static unsigned char * -mem2hex (unsigned char *mem, unsigned char *buf, int count) +static char * +mem2hex (gdb_byte *mem, char *buf, int count) { - unsigned char ch; + gdb_byte ch; while (count-- > 0) { diff --git a/gdb/valops.c b/gdb/valops.c index 57c8b78d25f..14b845e7def 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1039,7 +1039,7 @@ value_string (char *ptr, int len) copy LEN bytes from PTR in gdb to that address in the inferior. */ addr = allocate_space_in_inferior (len); - write_memory (addr, ptr, len); + write_memory (addr, (gdb_byte *) ptr, len); val = value_at_lazy (stringtype, addr); return (val); -- 2.30.2