aboutsummaryrefslogtreecommitdiff
path: root/gdb/ppc-linux-tdep.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-11-01 18:52:30 -0600
committerTom Tromey <tom@tromey.com>2017-11-04 10:27:18 -0600
commit779bc38eca950c7f3b64173e99e25f0c0edfbe3b (patch)
treee5f1387588eb7eb94fc2d2d3f2ff8cf0ff0e3ed0 /gdb/ppc-linux-tdep.c
parented2b3126d1828d55d57880c6b6045a4e58c05cde (diff)
downloadgdb-779bc38eca950c7f3b64173e99e25f0c0edfbe3b.zip
gdb-779bc38eca950c7f3b64173e99e25f0c0edfbe3b.tar.gz
gdb-779bc38eca950c7f3b64173e99e25f0c0edfbe3b.tar.bz2
Use gdb::byte_vector in ppc-linux-tdep.c
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.
Diffstat (limited to 'gdb/ppc-linux-tdep.c')
-rw-r--r--gdb/ppc-linux-tdep.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 847908a..ee80a71 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -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 */