aboutsummaryrefslogtreecommitdiff
path: root/gdb/xstormy16-tdep.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-09-27 21:06:21 -0600
committerTom Tromey <tom@tromey.com>2017-09-29 20:46:44 -0600
commit726b2169b4cda6a0267cb2986ada758270cff093 (patch)
tree92d01f8d55cdc3606f24a3383af4498087c26878 /gdb/xstormy16-tdep.c
parent55b064321eed6cccf511fd698c732890e3ba4c6b (diff)
downloadgdb-726b2169b4cda6a0267cb2986ada758270cff093.zip
gdb-726b2169b4cda6a0267cb2986ada758270cff093.tar.gz
gdb-726b2169b4cda6a0267cb2986ada758270cff093.tar.bz2
Remove cleanup from xstormy16-tdep.c
This removes a cleanup from xstormy16-tdep.c, using gdb::byte_vector. gdb/ChangeLog 2017-09-29 Tom Tromey <tom@tromey.com> * xstormy16-tdep.c (xstormy16_push_dummy_call): Use gdb::byte_vector.
Diffstat (limited to 'gdb/xstormy16-tdep.c')
-rw-r--r--gdb/xstormy16-tdep.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 40a6d98..bed4305 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -35,6 +35,7 @@
#include "doublest.h"
#include "osabi.h"
#include "objfiles.h"
+#include "common/byte-vector.h"
enum gdb_regnum
{
@@ -276,21 +277,17 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
wordaligned. */
for (j = nargs - 1; j >= i; j--)
{
- gdb_byte *val;
- struct cleanup *back_to;
const gdb_byte *bytes = value_contents (args[j]);
typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
slacklen = typelen & 1;
- val = (gdb_byte *) xmalloc (typelen + slacklen);
- back_to = make_cleanup (xfree, val);
- memcpy (val, bytes, typelen);
- memset (val + typelen, 0, slacklen);
+ gdb::byte_vector val (typelen + slacklen);
+ memcpy (val.data (), bytes, typelen);
+ memset (val.data () + typelen, 0, slacklen);
/* Now write this data to the stack. The stack grows upwards. */
- write_memory (stack_dest, val, typelen + slacklen);
+ write_memory (stack_dest, val.data (), typelen + slacklen);
stack_dest += typelen + slacklen;
- do_cleanups (back_to);
}
store_unsigned_integer (buf, xstormy16_pc_size, byte_order, bp_addr);