Simple -Wshadow=local fixes
[deliverable/binutils-gdb.git] / gdb / linux-tdep.c
index da8a1f07f77f37511380915c9e2d06e6ca5e1eb3..8c76ec316b84310e7e939a6917a71f50c9a53420 100644 (file)
@@ -419,9 +419,9 @@ linux_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
 {
   static char buf[80];
 
-  if (ptid_get_lwp (ptid) != 0)
+  if (ptid.lwp () != 0)
     {
-      snprintf (buf, sizeof (buf), "LWP %ld", ptid_get_lwp (ptid));
+      snprintf (buf, sizeof (buf), "LWP %ld", ptid.lwp ());
       return buf;
     }
 
@@ -726,7 +726,6 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
   int status_f = (what == IP_STATUS || what == IP_ALL);
   int stat_f = (what == IP_STAT || what == IP_ALL);
   char filename[100];
-  char *data;
   int target_errno;
 
   if (args && isdigit (args[0]))
@@ -823,13 +822,13 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
               line = strtok (NULL, "\n"))
            {
              ULONGEST addr, endaddr, offset, inode;
-             const char *permissions, *device, *filename;
+             const char *permissions, *device, *mapping_filename;
              size_t permissions_len, device_len;
 
              read_mapping (line, &addr, &endaddr,
                            &permissions, &permissions_len,
                            &offset, &device, &device_len,
-                           &inode, &filename);
+                           &inode, &mapping_filename);
 
              if (gdbarch_addr_bit (gdbarch) == 32)
                {
@@ -838,7 +837,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
                                   paddress (gdbarch, endaddr),
                                   hex_string (endaddr - addr),
                                   hex_string (offset),
-                                  *filename? filename : "");
+                                  *mapping_filename ? mapping_filename : "");
                }
              else
                {
@@ -847,7 +846,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
                                   paddress (gdbarch, endaddr),
                                   hex_string (endaddr - addr),
                                   hex_string (offset),
-                                  *filename? filename : "");
+                                  *mapping_filename ? mapping_filename : "");
                }
            }
        }
@@ -1580,21 +1579,26 @@ struct linux_collect_regset_section_cb_data
    regset in the corefile note section.  */
 
 static void
-linux_collect_regset_section_cb (const char *sect_name, int size,
-                                const struct regset *regset,
+linux_collect_regset_section_cb (const char *sect_name, int supply_size,
+                                int collect_size, const struct regset *regset,
                                 const char *human_name, void *cb_data)
 {
   char *buf;
   struct linux_collect_regset_section_cb_data *data
     = (struct linux_collect_regset_section_cb_data *) cb_data;
+  bool variable_size_section = (regset != NULL
+                               && regset->flags & REGSET_VARIABLE_SIZE);
+
+  if (!variable_size_section)
+    gdb_assert (supply_size == collect_size);
 
   if (data->abort_iteration)
     return;
 
   gdb_assert (regset && regset->collect_regset);
 
-  buf = (char *) xmalloc (size);
-  regset->collect_regset (regset, data->regcache, -1, buf, size);
+  buf = (char *) xmalloc (collect_size);
+  regset->collect_regset (regset, data->regcache, -1, buf, collect_size);
 
   /* PRSTATUS still needs to be treated specially.  */
   if (strcmp (sect_name, ".reg") == 0)
@@ -1604,7 +1608,7 @@ linux_collect_regset_section_cb (const char *sect_name, int size,
   else
     data->note_data = (char *) elfcore_write_register_note
       (data->obfd, data->note_data, data->note_size,
-       sect_name, buf, size);
+       sect_name, buf, collect_size);
   xfree (buf);
 
   if (data->note_data == NULL)
@@ -1632,9 +1636,9 @@ linux_collect_thread_registers (const struct regcache *regcache,
   data.abort_iteration = 0;
 
   /* For remote targets the LWP may not be available, so use the TID.  */
-  data.lwp = ptid_get_lwp (ptid);
+  data.lwp = ptid.lwp ();
   if (!data.lwp)
-    data.lwp = ptid_get_tid (ptid);
+    data.lwp = ptid.tid ();
 
   gdbarch_iterate_over_regset_sections (gdbarch,
                                        linux_collect_regset_section_cb,
@@ -1724,7 +1728,7 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
   char filename[100];
   /* The basename of the executable.  */
   const char *basename;
-  char *infargs;
+  const char *infargs;
   /* Temporary buffer.  */
   char *tmpstr;
   /* The valid states of a process, according to the Linux kernel.  */
This page took 0.028152 seconds and 4 git commands to generate.