Remove cleanups from link_callbacks_einfo
[deliverable/binutils-gdb.git] / gdb / sparc64-tdep.c
index 8722f0acc80c73931e7bce34b3b09421a432cc46..a756834cba45e1e64e8ad02c6d060b81f7f6822e 100644 (file)
@@ -20,7 +20,6 @@
 #include "defs.h"
 #include "arch-utils.h"
 #include "dwarf2-frame.h"
-#include "floatformat.h"
 #include "frame.h"
 #include "frame-base.h"
 #include "frame-unwind.h"
@@ -188,7 +187,7 @@ sparc64_forget_process (pid_t pid)
 }
 
 static void
-info_adi_command (char *args, int from_tty)
+info_adi_command (const char *args, int from_tty)
 {
   printf_unfiltered ("\"adi\" must be followed by \"examine\" "
                      "or \"assign\".\n");
@@ -312,13 +311,13 @@ adi_is_addr_mapped (CORE_ADDR vaddr, size_t cnt)
 
   pid_t pid = ptid_get_pid (inferior_ptid);
   snprintf (filename, sizeof filename, "/proc/%ld/adi/maps", (long) pid);
-  char *data = target_fileio_read_stralloc (NULL, filename);
+  gdb::unique_xmalloc_ptr<char> data
+    = target_fileio_read_stralloc (NULL, filename);
   if (data)
     {
-      struct cleanup *cleanup = make_cleanup (xfree, data);
       adi_stat_t adi_stat = get_adi_info (pid);
       char *line;
-      for (line = strtok (data, "\n"); line; line = strtok (NULL, "\n"))
+      for (line = strtok (data.get (), "\n"); line; line = strtok (NULL, "\n"))
         {
           ULONGEST addr, endaddr;
 
@@ -328,13 +327,9 @@ adi_is_addr_mapped (CORE_ADDR vaddr, size_t cnt)
                  && ((vaddr + i) * adi_stat.blksize) < endaddr)
             {
               if (++i == cnt)
-                {
-                  do_cleanups (cleanup);
-                  return true;
-                }
+               return true;
             }
         }
-        do_cleanups (cleanup);
       }
     else
       warning (_("unable to open /proc file '%s'"), filename);
@@ -1216,7 +1211,7 @@ static void
 sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
                               const gdb_byte *valbuf, int element, int bitpos)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   int len = TYPE_LENGTH (type);
 
   gdb_assert (element < 16);
@@ -1308,7 +1303,7 @@ static void
 sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
                                 gdb_byte *valbuf, int bitpos)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
 
   if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
     {
@@ -1377,7 +1372,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
                         struct value **args, CORE_ADDR sp,
                         int struct_return, CORE_ADDR struct_addr)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   /* Number of extended words in the "parameter array".  */
   int num_elements = 0;
   int element = 0;
@@ -1888,7 +1883,7 @@ sparc64_supply_gregset (const struct sparc_gregmap *gregmap,
                        struct regcache *regcache,
                        int regnum, const void *gregs)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int sparc32 = (gdbarch_ptr_bit (gdbarch) == 32);
   const gdb_byte *regs = (const gdb_byte *) gregs;
@@ -2005,7 +2000,7 @@ sparc64_collect_gregset (const struct sparc_gregmap *gregmap,
                         const struct regcache *regcache,
                         int regnum, void *gregs)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int sparc32 = (gdbarch_ptr_bit (gdbarch) == 32);
   gdb_byte *regs = (gdb_byte *) gregs;
@@ -2115,7 +2110,7 @@ sparc64_supply_fpregset (const struct sparc_fpregmap *fpregmap,
                         struct regcache *regcache,
                         int regnum, const void *fpregs)
 {
-  int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
+  int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
   const gdb_byte *regs = (const gdb_byte *) fpregs;
   int i;
 
@@ -2153,7 +2148,7 @@ sparc64_collect_fpregset (const struct sparc_fpregmap *fpregmap,
                          const struct regcache *regcache,
                          int regnum, void *fpregs)
 {
-  int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
+  int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
   gdb_byte *regs = (gdb_byte *) fpregs;
   int i;
 
This page took 0.025173 seconds and 4 git commands to generate.