]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use gdb::byte_vector in ppc-linux-tdep.c
authorTom Tromey <tom@tromey.com>
Thu, 2 Nov 2017 00:52:30 +0000 (18:52 -0600)
committerTom Tromey <tom@tromey.com>
Sat, 4 Nov 2017 16:27:18 +0000 (10:27 -0600)
This removes a cleanup from ppc-linux-tdep.c, replacing it with
gdb::byte_vector.

gdb/ChangeLog
2017-11-04  Tom Tromey  <tom@tromey.com>

* ppc-linux-tdep.c (ppc_linux_get_syscall_number): Use
gdb::byte_vector.

gdb/ChangeLog
gdb/ppc-linux-tdep.c

index 6db35dd1e1993878a56faa93a4766aa9d459270b..d6c4b6f8054cb897173e7944e07975d687532bca 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-04  Tom Tromey  <tom@tromey.com>
+
+       * ppc-linux-tdep.c (ppc_linux_get_syscall_number): Use
+       gdb::byte_vector.
+
 2017-11-04  Tom Tromey  <tom@tromey.com>
 
        * objfiles.c (do_free_objfile_cleanup): Remove.
index 847908a6da73741af6ed2ce9f7806ee283de78ff..ee80a71c6b97e239997e9a4c7ca75961df31d9d2 100644 (file)
@@ -725,28 +725,19 @@ ppc_linux_get_syscall_number (struct gdbarch *gdbarch,
   struct regcache *regcache = get_thread_regcache (ptid);
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  struct cleanup *cleanbuf;
-  /* The content of a register */
-  gdb_byte *buf;
-  /* The result */
-  LONGEST ret;
 
   /* Make sure we're in a 32- or 64-bit machine */
   gdb_assert (tdep->wordsize == 4 || tdep->wordsize == 8);
 
-  buf = (gdb_byte *) xmalloc (tdep->wordsize * sizeof (gdb_byte));
-
-  cleanbuf = make_cleanup (xfree, buf);
+  /* The content of a register */
+  gdb::byte_vector buf (tdep->wordsize);
 
   /* Getting the system call number from the register.
      When dealing with PowerPC architecture, this information
      is stored at 0th register.  */
-  regcache_cooked_read (regcache, tdep->ppc_gp0_regnum, buf);
-
-  ret = extract_signed_integer (buf, tdep->wordsize, byte_order);
-  do_cleanups (cleanbuf);
+  regcache_cooked_read (regcache, tdep->ppc_gp0_regnum, buf.data ());
 
-  return ret;
+  return extract_signed_integer (buf.data (), tdep->wordsize, byte_order);
 }
 
 /* PPC process record-replay */