2005-05-26 Andrew Cagney <cagney@gnu.org>
authorAndrew Cagney <cagney@redhat.com>
Thu, 26 May 2005 20:49:03 +0000 (20:49 +0000)
committerAndrew Cagney <cagney@redhat.com>
Thu, 26 May 2005 20:49:03 +0000 (20:49 +0000)
* 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.

13 files changed:
gdb/ChangeLog
gdb/breakpoint.c
gdb/breakpoint.h
gdb/cli/cli-decode.c
gdb/cli/cli-dump.c
gdb/cli/cli-setshow.c
gdb/command.h
gdb/eval.c
gdb/proc-service.c
gdb/ser-tcp.c
gdb/target.h
gdb/tracepoint.c
gdb/valops.c

index a91f556..b05eb5a 100644 (file)
@@ -1,3 +1,24 @@
+2005-05-26  Andrew Cagney  <cagney@gnu.org>
+
+       * 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  <cagney@gnu.org>
 
        * rs6000-tdep.c (ppc_supply_reg, ppc_collect_reg): Use gdb_byte
index 7e32943..76c73d7 100644 (file)
@@ -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.  */
index 67a67e3..53a6033 100644 (file)
@@ -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
index 30ce415..9933e30 100644 (file)
@@ -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,
index 724f776..e855c4c 100644 (file)
@@ -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.  */
index fca92b0..4002953 100644 (file)
@@ -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:
index 0729752..9bc01e7 100644 (file)
@@ -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,
index 98f5580..0ad7179 100644 (file)
@@ -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;
index d7cd1aa..e0233fc 100644 (file)
@@ -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
index abe6ed4..6b19c31 100644 (file)
@@ -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 *"
index bc10b25..582fa78 100644 (file)
@@ -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);
index ec3c53f..bf4a2c5 100644 (file)
@@ -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)
     {
index 57c8b78..14b845e 100644 (file)
@@ -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);