gdb/gdb-rhbz795424-bitpos-10of25.patch
2012-11-09 19:03:10 +01:00

120 lines
4.3 KiB
Diff

http://sourceware.org/ml/gdb-cvs/2012-08/msg00187.html
### src/gdb/ChangeLog 2012/08/24 03:17:12 1.14628
### src/gdb/ChangeLog 2012/08/24 03:57:22 1.14629
## -1,3 +1,11 @@
+2012-08-24 Siddhesh Poyarekar <siddhesh@redhat.com>
+
+ * 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.
+
2012-08-24 Yao Qi <yao@codesourcery.com>
* jv-exp.y (push_expression_name): Add "." at the end of error
--- src/gdb/h8300-tdep.c 2012/05/18 21:02:47 1.133
+++ src/gdb/h8300-tdep.c 2012/08/24 03:57:22 1.134
@@ -666,13 +666,15 @@
for (argument = 0; argument < nargs; argument++)
{
+ struct cleanup *back_to;
struct type *type = value_type (args[argument]);
int len = TYPE_LENGTH (type);
char *contents = (char *) value_contents (args[argument]);
/* Pad the argument appropriately. */
int padded_len = align_up (len, wordsize);
- gdb_byte *padded = alloca (padded_len);
+ gdb_byte *padded = xmalloc (padded_len);
+ back_to = make_cleanup (xfree, padded);
memset (padded, 0, padded_len);
memcpy (len < wordsize ? padded + padded_len - len : padded,
@@ -720,6 +722,8 @@
subsequent arguments go on the stack. */
reg = E_ARGLAST_REGNUM + 1;
}
+
+ do_cleanups (back_to);
}
/* Store return address. */
--- src/gdb/mt-tdep.c 2012/05/16 14:35:06 1.40
+++ src/gdb/mt-tdep.c 2012/08/24 03:57:22 1.41
@@ -845,16 +845,20 @@
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,
--- src/gdb/tilegx-tdep.c 2012/05/30 19:31:44 1.1
+++ src/gdb/tilegx-tdep.c 2012/08/24 03:57:22 1.2
@@ -343,16 +343,20 @@
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 = ((typelen + 3) & (~3)) - typelen;
- 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 data to the stack. The stack grows downwards. */
stack_dest -= typelen + slacklen;
write_memory (stack_dest, val, typelen + slacklen);
+ do_cleanups (back_to);
}
/* Add 2 words for linkage space to the stack. */
--- src/gdb/xstormy16-tdep.c 2012/05/16 14:35:08 1.118
+++ src/gdb/xstormy16-tdep.c 2012/08/24 03:57:22 1.119
@@ -279,16 +279,20 @@
for (j = nargs - 1; j >= i; j--)
{
char *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 = alloca (typelen + slacklen);
- memcpy (val, value_contents (args[j]), typelen);
+ val = xmalloc (typelen + slacklen);
+ back_to = make_cleanup (xfree, val);
+ memcpy (val, bytes, typelen);
memset (val + typelen, 0, slacklen);
/* Now write this data to the stack. The stack grows upwards. */
write_memory (stack_dest, val, typelen + slacklen);
stack_dest += typelen + slacklen;
+ do_cleanups (back_to);
}
store_unsigned_integer (buf, xstormy16_pc_size, byte_order, bp_addr);