diff options
author | Tom Tromey <tom@tromey.com> | 2017-09-27 21:08:05 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-09-29 20:46:44 -0600 |
commit | 42518ba746b5b6cb7c169a55430e73551be345f5 (patch) | |
tree | 694083875a6443cfc5cbf438d0dde077cf0828fb /gdb | |
parent | 726b2169b4cda6a0267cb2986ada758270cff093 (diff) | |
download | gdb-42518ba746b5b6cb7c169a55430e73551be345f5.zip gdb-42518ba746b5b6cb7c169a55430e73551be345f5.tar.gz gdb-42518ba746b5b6cb7c169a55430e73551be345f5.tar.bz2 |
Remove cleanup from mt-tdep.c
Remove a cleanup from mt-tdep.c, using gdb::byte_vector.
gdb/ChangeLog
2017-09-29 Tom Tromey <tom@tromey.com>
* mt-tdep.c (mt_push_dummy_call): Use gdb::byte_vector.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/mt-tdep.c | 13 |
2 files changed, 9 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 989c127..2bbe205 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2017-09-29 Tom Tromey <tom@tromey.com> + * mt-tdep.c (mt_push_dummy_call): Use gdb::byte_vector. + +2017-09-29 Tom Tromey <tom@tromey.com> + * xstormy16-tdep.c (xstormy16_push_dummy_call): Use gdb::byte_vector. diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c index e3ea322..7992394 100644 --- a/gdb/mt-tdep.c +++ b/gdb/mt-tdep.c @@ -36,6 +36,7 @@ #include "infcall.h" #include "language.h" #include "valprint.h" +#include "common/byte-vector.h" enum mt_arch_constants { @@ -849,21 +850,17 @@ mt_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* Next, the rest of the arguments go onto the stack, in reverse order. */ for (j = nargs - 1; j >= i; j--) { - gdb_byte *val; - struct cleanup *back_to; const gdb_byte *contents = value_contents (args[j]); /* Right-justify the value in an aligned-length buffer. */ typelen = TYPE_LENGTH (value_type (args[j])); slacklen = (wordsize - (typelen % wordsize)) % wordsize; - 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 this data to the stack. */ stack_dest -= typelen + slacklen; - write_memory (stack_dest, val, typelen + slacklen); - do_cleanups (back_to); + write_memory (stack_dest, val.data (), typelen + slacklen); } /* Finally, if a param needs to be split between registers and stack, |