This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: arm-tdep.c -vs- value_contents_writeable
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 27 May 2010 13:05:53 -0600
- Subject: FYI: arm-tdep.c -vs- value_contents_writeable
- Reply-to: Tom Tromey <tromey at redhat dot com>
I'm checking this in.
This is yet another little value_contents_writeable cleanup. This time,
it is arm-tdep.c:arm_push_dummy_call that calls it but then never writes
to the result.
Again, no ARM box here, but I believe this patch is obviously correct.
Tom
2010-05-27 Tom Tromey <tromey@redhat.com>
* arm-tdep.c (push_stack_item): 'contents' now const.
(arm_push_dummy_call): Make 'val' const. Use value_contents, not
value_contents_writeable. Introduce new temporary.
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.303
diff -u -r1.303 arm-tdep.c
--- arm-tdep.c 5 May 2010 15:05:57 -0000 1.303
+++ arm-tdep.c 27 May 2010 19:03:19 -0000
@@ -1697,7 +1697,7 @@
};
static struct stack_item *
-push_stack_item (struct stack_item *prev, void *contents, int len)
+push_stack_item (struct stack_item *prev, const void *contents, int len)
{
struct stack_item *si;
si = xmalloc (sizeof (struct stack_item));
@@ -2038,7 +2038,7 @@
struct type *arg_type;
struct type *target_type;
enum type_code typecode;
- bfd_byte *val;
+ const bfd_byte *val;
int align;
enum arm_vfp_cprc_base_type vfp_base_type;
int vfp_base_count;
@@ -2048,7 +2048,7 @@
len = TYPE_LENGTH (arg_type);
target_type = TYPE_TARGET_TYPE (arg_type);
typecode = TYPE_CODE (arg_type);
- val = value_contents_writeable (args[argnum]);
+ val = value_contents (args[argnum]);
align = arm_type_align (arg_type);
/* Round alignment up to a whole number of words. */
@@ -2149,9 +2149,10 @@
CORE_ADDR regval = extract_unsigned_integer (val, len, byte_order);
if (arm_pc_is_thumb (regval))
{
- val = alloca (len);
- store_unsigned_integer (val, len, byte_order,
+ bfd_byte *copy = alloca (len);
+ store_unsigned_integer (copy, len, byte_order,
MAKE_THUMB_ADDR (regval));
+ val = copy;
}
}