aboutsummaryrefslogtreecommitdiff
path: root/gdb/mt-tdep.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2012-08-24 03:57:22 +0000
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2012-08-24 03:57:22 +0000
commitecfb0d68c570de8a5e29858d104d82a76982de15 (patch)
treef9c92bc9004a0809c534981af704cfb6c0428656 /gdb/mt-tdep.c
parente7d50cc9e6af53a13f3a3140795d7b5065e8fe33 (diff)
downloadgdb-ecfb0d68c570de8a5e29858d104d82a76982de15.zip
gdb-ecfb0d68c570de8a5e29858d104d82a76982de15.tar.gz
gdb-ecfb0d68c570de8a5e29858d104d82a76982de15.tar.bz2
* h8300-tdep.c (h8300_push_dummy_call): Replace unsafe alloca
with xmalloc/cleanup. * mt-tdep.c (mt_push_dummy_call): Likewise. * tilegx-tdep.c (tilegx_push_dummy_call): Likewise. * xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise.
Diffstat (limited to 'gdb/mt-tdep.c')
-rw-r--r--gdb/mt-tdep.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c
index ee4b6eb..0ae51b3 100644
--- a/gdb/mt-tdep.c
+++ b/gdb/mt-tdep.c
@@ -845,16 +845,20 @@ mt_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
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 = alloca (typelen + slacklen);
- memcpy (val, value_contents (args[j]), typelen);
+ val = xmalloc (typelen + slacklen);
+ back_to = make_cleanup (xfree, val);
+ memcpy (val, contents, typelen);
memset (val + 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);
}
/* Finally, if a param needs to be split between registers and stack,