aboutsummaryrefslogtreecommitdiff
path: root/gdb/tilegx-tdep.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-09-27 20:39:32 -0600
committerTom Tromey <tom@tromey.com>2017-09-29 20:46:43 -0600
commit8f8accb58078b1f249dc6865b8784a0a8e8881dd (patch)
treef1d4964a93ea586d1c2bae4309a3215295399c2f /gdb/tilegx-tdep.c
parent200aa7b154b25423eb72ceecade0fcd76edc4686 (diff)
downloadgdb-8f8accb58078b1f249dc6865b8784a0a8e8881dd.zip
gdb-8f8accb58078b1f249dc6865b8784a0a8e8881dd.tar.gz
gdb-8f8accb58078b1f249dc6865b8784a0a8e8881dd.tar.bz2
Remove cleanup from tilegx-tdep.c
This removes a cleanup from tilegx-tdep.c, by using gdb::byte_vector. gdb/ChangeLog 2017-09-29 Tom Tromey <tom@tromey.com> * tilegx-tdep.c (tilegx_push_dummy_call): Use gdb::byte_vector.
Diffstat (limited to 'gdb/tilegx-tdep.c')
-rw-r--r--gdb/tilegx-tdep.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index b26622d..5291e10 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -42,6 +42,7 @@
#include "tilegx-tdep.h"
#include "opcode/tilegx.h"
#include <algorithm>
+#include "common/byte-vector.h"
struct tilegx_frame_cache
{
@@ -328,21 +329,17 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch,
the stack, word aligned. */
for (j = nargs - 1; j >= i; j--)
{
- gdb_byte *val;
- struct cleanup *back_to;
const gdb_byte *contents = value_contents (args[j]);
typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
slacklen = align_up (typelen, 8) - typelen;
- val = (gdb_byte *) xmalloc (typelen + slacklen);
- back_to = make_cleanup (xfree, val);
- memcpy (val, contents, typelen);
- memset (val + typelen, 0, slacklen);
+ gdb::byte_vector val (typelen + slacklen);
+ memcpy (val.data (), contents, typelen);
+ memset (val.data () + typelen, 0, slacklen);
/* Now write data to the stack. The stack grows downwards. */
stack_dest -= typelen + slacklen;
- write_memory (stack_dest, val, typelen + slacklen);
- do_cleanups (back_to);
+ write_memory (stack_dest, val.data (), typelen + slacklen);
}
/* Add 16 bytes for linkage space to the stack. */