]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
-Wpointer-sign: gdb_byte -> char.
authorPedro Alves <palves@redhat.com>
Fri, 19 Apr 2013 15:10:53 +0000 (15:10 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 19 Apr 2013 15:10:53 +0000 (15:10 +0000)
This is sort of the opposite of the previous patch.  Places that
manipulate strings or interfaces that return strings are changed to
use char* instead of gdb_byte*.

gdb/
2013-04-19  Pedro Alves  <palves@redhat.com>

* avr-tdep.c (avr_io_reg_read_command): New local 'bufstr'.  Use
it to get a string view of the byte buffer.
* i386-cygwin-tdep.c (core_process_module_section): Change local 'buf'
type to gdb_byte *.  Adjust.
* linux-tdep.c (linux_info_proc, linux_find_memory_regions_full):
Change local to char *.
* solib-darwin.c (find_program_interpreter): Change return type to
char *.  Adjust.
(darwin_solib_get_all_image_info_addr_at_init): Adjust.
* solib-dsbt.c (enable_break2): Change local 'buf' to char *.
* solib-frv.c (enable_break2): Change local 'buf' to char *.
* solib-spu.c (spu_current_sos): Add gdb_byte * cast.
* solib-svr4.c (find_program_interpreter): Change return type to
char *.  Adjust.
(enable_break): Change local 'interp_name' to char *.
* spu-multiarch.c (spu_xfer_partial): Add cast to 'char *'.
* spu-tdep.c (spu_pseudo_register_read_spu): Add cast to 'char *'.
(spu_pseudo_register_write_spu): Use char for string buffer.
Adjust.
(info_spu_event_command, info_spu_signal_command): Add casts to
'char *'.

gdb/ChangeLog
gdb/avr-tdep.c
gdb/i386-cygwin-tdep.c
gdb/linux-tdep.c
gdb/solib-darwin.c
gdb/solib-dsbt.c
gdb/solib-frv.c
gdb/solib-spu.c
gdb/solib-svr4.c
gdb/spu-multiarch.c
gdb/spu-tdep.c

index 0c97a683e48ce2f07c2f90347a5ab57dad1f4ce0..b1ce7ee152ff60eee8d5be06c1354a443ee0bfff 100644 (file)
@@ -1,3 +1,27 @@
+2013-04-19  Pedro Alves  <palves@redhat.com>
+
+       * avr-tdep.c (avr_io_reg_read_command): New local 'bufstr'.  Use
+       it to get a string view of the byte buffer.
+       * i386-cygwin-tdep.c (core_process_module_section): Change local 'buf'
+       type to gdb_byte *.  Adjust.
+       * linux-tdep.c (linux_info_proc, linux_find_memory_regions_full):
+       Change local to char *.
+       * solib-darwin.c (find_program_interpreter): Change return type to
+       char *.  Adjust.
+       (darwin_solib_get_all_image_info_addr_at_init): Adjust.
+       * solib-dsbt.c (enable_break2): Change local 'buf' to char *.
+       * solib-frv.c (enable_break2): Change local 'buf' to char *.
+       * solib-spu.c (spu_current_sos): Add gdb_byte * cast.
+       * solib-svr4.c (find_program_interpreter): Change return type to
+       char *.  Adjust.
+       (enable_break): Change local 'interp_name' to char *.
+       * spu-multiarch.c (spu_xfer_partial): Add cast to 'char *'.
+       * spu-tdep.c (spu_pseudo_register_read_spu): Add cast to 'char *'.
+       (spu_pseudo_register_write_spu): Use char for string buffer.
+       Adjust.
+       (info_spu_event_command, info_spu_signal_command): Add casts to
+       'char *'.
+
 2013-04-19  Pedro Alves  <palves@redhat.com>
 
        * aarch64-tdep.c (aarch64_default_breakpoint): Change type to
index b14bf83612e24c1ec6c3f6e376b9070e41e99d85..0bc08a8e74144f2052ceb38fdd6c5bb5f9ae9135 100644 (file)
@@ -1468,8 +1468,9 @@ avr_io_reg_read_command (char *args, int from_tty)
 {
   LONGEST bufsiz = 0;
   gdb_byte *buf;
+  const char *bufstr;
   char query[400];
-  char *p;
+  const char *p;
   unsigned int nreg = 0;
   unsigned int val;
   int i, j, k, step;
@@ -1477,6 +1478,7 @@ avr_io_reg_read_command (char *args, int from_tty)
   /* Find out how many io registers the target has.  */
   bufsiz = target_read_alloc (&current_target, TARGET_OBJECT_AVR,
                              "avr.io_reg", &buf);
+  bufstr = (const char *) buf;
 
   if (bufsiz <= 0)
     {
@@ -1486,7 +1488,7 @@ avr_io_reg_read_command (char *args, int from_tty)
       return;
     }
 
-  if (sscanf (buf, "%x", &nreg) != 1)
+  if (sscanf (bufstr, "%x", &nreg) != 1)
     {
       fprintf_unfiltered (gdb_stderr,
                          _("Error fetching number of io registers\n"));
@@ -1514,7 +1516,7 @@ avr_io_reg_read_command (char *args, int from_tty)
       bufsiz = target_read_alloc (&current_target, TARGET_OBJECT_AVR,
                                  query, &buf);
 
-      p = buf;
+      p = (const char *) buf;
       for (k = i; k < (i + j); k++)
        {
          if (sscanf (p, "%[^,],%x;", query, &val) == 2)
index cee2adf6970a813e92540ca79b933acf944746a3..dc5d614e5ec09c6bad83f32fc52399e2db0f2933 100644 (file)
@@ -129,7 +129,7 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj)
   size_t module_name_size;
   CORE_ADDR base_addr;
 
-  char *buf = NULL;
+  gdb_byte *buf = NULL;
 
   if (strncmp (sect->name, ".module", 7) != 0)
     return;
@@ -154,9 +154,9 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj)
   module_name_size =
     extract_unsigned_integer (buf + 8, 4, byte_order);
 
-  module_name = buf + 12;
-  if (module_name - buf + module_name_size > bfd_get_section_size (sect))
+  if (12 + module_name_size > bfd_get_section_size (sect))
     goto out;
+  module_name = (char *) buf + 12;
 
   /* The first module is the .exe itself.  */
   if (data->module_count != 0)
index 9def1086483d3db4bf2a05c27ad01bc57bb207d3..9623d190ae8f3dd368b78b9175b79d9a61ab895f 100644 (file)
@@ -261,7 +261,7 @@ linux_info_proc (struct gdbarch *gdbarch, char *args,
   int status_f = (what == IP_STATUS || what == IP_ALL);
   int stat_f = (what == IP_STAT || what == IP_ALL);
   char filename[100];
-  gdb_byte *data;
+  char *data;
   int target_errno;
 
   if (args && isdigit (args[0]))
@@ -676,7 +676,7 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
                                void *obfd)
 {
   char mapsfilename[100];
-  gdb_byte *data;
+  char *data;
 
   /* We need to know the real target PID to access /proc.  */
   if (current_inferior ()->fake_pid_p)
index 8c2307e0ade8784e9c17ef4c38cd9155820a2317..c4c6308cf251934cf525ce0d5ced370f542cfe3a 100644 (file)
@@ -210,10 +210,10 @@ lookup_symbol_from_bfd (bfd *abfd, char *symname)
 
 /* Return program interpreter string.  */
 
-static gdb_byte *
+static char *
 find_program_interpreter (void)
 {
-  gdb_byte *buf = NULL;
+  char *buf = NULL;
 
   /* If we have an exec_bfd, get the interpreter from the load commands.  */
   if (exec_bfd)
@@ -420,7 +420,7 @@ gdb_bfd_mach_o_fat_extract (bfd *abfd, bfd_format format,
 static void
 darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info)
 {
-  gdb_byte *interp_name;
+  char *interp_name;
   CORE_ADDR load_addr = 0;
   bfd *dyld_bfd = NULL;
   struct cleanup *cleanup;
index e2822c1b0c6887a5bc581b325723cae38daa438b..90321d9bf35d13d609103c69d13a97752ebe8f17 100644 (file)
@@ -840,7 +840,7 @@ enable_break2 (void)
   if (interp_sect)
     {
       unsigned int interp_sect_size;
-      gdb_byte *buf;
+      char *buf;
       bfd *tmp_bfd = NULL;
       CORE_ADDR addr;
       gdb_byte addr_buf[TIC6X_PTR_SIZE];
index 52588bc880dfe07fb030be0aee986dc506e2348e..0f3e5d737460d8979154d811c88541ea1a44c2f9 100644 (file)
@@ -535,7 +535,7 @@ enable_break2 (void)
   if (interp_sect)
     {
       unsigned int interp_sect_size;
-      gdb_byte *buf;
+      char *buf;
       bfd *tmp_bfd = NULL;
       int status;
       CORE_ADDR addr, interp_loadmap_addr;
index fc9dcda72b83771b9a5f4a0acd4dcb33db7b8d9d..626cc8f7e72b5bd96881b8134b82817f7db1a935 100644 (file)
@@ -209,7 +209,7 @@ spu_current_sos (void)
         yet.  Skip such entries; we'll be back for them later.  */
       xsnprintf (annex, sizeof annex, "%d/object-id", fd);
       len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
-                        id, 0, sizeof id);
+                        (gdb_byte *) id, 0, sizeof id);
       if (len <= 0 || len >= sizeof id)
        continue;
       id[len] = 0;
index bb2a4e9d5aa22118cca1d62b30da86d30c1ff40d..f3bff6e297e51fff90e82cfb002ef603aafc3c10 100644 (file)
@@ -496,7 +496,7 @@ read_program_header (int type, int *p_sect_size, int *p_arch_size)
 
 
 /* Return program interpreter string.  */
-static gdb_byte *
+static char *
 find_program_interpreter (void)
 {
   gdb_byte *buf = NULL;
@@ -521,7 +521,7 @@ find_program_interpreter (void)
   if (!buf)
     buf = read_program_header (PT_INTERP, NULL, NULL);
 
-  return buf;
+  return (char *) buf;
 }
 
 
@@ -1446,7 +1446,7 @@ enable_break (struct svr4_info *info, int from_tty)
   struct minimal_symbol *msymbol;
   const char * const *bkpt_namep;
   asection *interp_sect;
-  gdb_byte *interp_name;
+  char *interp_name;
   CORE_ADDR sym_addr;
 
   info->interp_text_sect_low = info->interp_text_sect_high = 0;
index 0922d042298ae4ba50a89257a115f2a12ce2c496..a74bd30a9963d32238085f3d9dbd8121b87b256d 100644 (file)
@@ -285,7 +285,7 @@ spu_xfer_partial (struct target_ops *ops, enum target_object object,
                                            0, sizeof buf) <= 0)
            return ret;
 
-         lslr = strtoulst (buf, NULL, 16);
+         lslr = strtoulst ((char *) buf, NULL, 16);
          return ops_beneath->to_xfer_partial (ops_beneath, TARGET_OBJECT_SPU,
                                               mem_annex, readbuf, writebuf,
                                               addr & lslr, len);
index e7dda8d9fda3de58cea21a649d25d3fb9bc70848..46f3e2c18032b9ad717aee07dfe52b4149f3e1d9 100644 (file)
@@ -192,6 +192,7 @@ spu_pseudo_register_read_spu (struct regcache *regcache, const char *regname,
   gdb_byte reg[32];
   char annex[32];
   ULONGEST id;
+  ULONGEST ul;
 
   status = regcache_raw_read_unsigned (regcache, SPU_ID_REGNUM, &id);
   if (status != REG_VALID)
@@ -201,7 +202,8 @@ spu_pseudo_register_read_spu (struct regcache *regcache, const char *regname,
   target_read (&current_target, TARGET_OBJECT_SPU, annex,
               reg, 0, sizeof reg);
 
-  store_unsigned_integer (buf, 4, byte_order, strtoulst (reg, NULL, 16));
+  ul = strtoulst ((char *) reg, NULL, 16);
+  store_unsigned_integer (buf, 4, byte_order, ul);
   return REG_VALID;
 }
 
@@ -254,7 +256,7 @@ spu_pseudo_register_write_spu (struct regcache *regcache, const char *regname,
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  gdb_byte reg[32];
+  char reg[32];
   char annex[32];
   ULONGEST id;
 
@@ -263,7 +265,7 @@ spu_pseudo_register_write_spu (struct regcache *regcache, const char *regname,
   xsnprintf (reg, sizeof reg, "0x%s",
             phex_nz (extract_unsigned_integer (buf, 4, byte_order), 4));
   target_write (&current_target, TARGET_OBJECT_SPU, annex,
-               reg, 0, strlen (reg));
+               (gdb_byte *) reg, 0, strlen (reg));
 }
 
 static void
@@ -2045,7 +2047,7 @@ info_spu_event_command (char *args, int from_tty)
   if (len <= 0)
     error (_("Could not read event_status."));
   buf[len] = '\0';
-  event_status = strtoulst (buf, NULL, 16);
+  event_status = strtoulst ((char *) buf, NULL, 16);
  
   xsnprintf (annex, sizeof annex, "%d/event_mask", id);
   len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
@@ -2053,7 +2055,7 @@ info_spu_event_command (char *args, int from_tty)
   if (len <= 0)
     error (_("Could not read event_mask."));
   buf[len] = '\0';
-  event_mask = strtoulst (buf, NULL, 16);
+  event_mask = strtoulst ((char *) buf, NULL, 16);
  
   chain = make_cleanup_ui_out_tuple_begin_end (current_uiout, "SPUInfoEvent");
 
@@ -2112,7 +2114,7 @@ info_spu_signal_command (char *args, int from_tty)
   if (len <= 0)
     error (_("Could not read signal1_type."));
   buf[len] = '\0';
-  signal1_type = strtoulst (buf, NULL, 16);
+  signal1_type = strtoulst ((char *) buf, NULL, 16);
 
   xsnprintf (annex, sizeof annex, "%d/signal2", id);
   len = target_read (&current_target, TARGET_OBJECT_SPU, annex, buf, 0, 4);
@@ -2130,7 +2132,7 @@ info_spu_signal_command (char *args, int from_tty)
   if (len <= 0)
     error (_("Could not read signal2_type."));
   buf[len] = '\0';
-  signal2_type = strtoulst (buf, NULL, 16);
+  signal2_type = strtoulst ((char *) buf, NULL, 16);
 
   chain = make_cleanup_ui_out_tuple_begin_end (current_uiout, "SPUInfoSignal");