aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2009-01-13 10:34:31 +0000
committerPedro Alves <palves@redhat.com>2009-01-13 10:34:31 +0000
commit74bcbdf3cea56564d1f9f597c8458b86ed71f621 (patch)
tree1ab2d8991bf751064e627c0f1cd8ba18a63357e2 /gdb/ada-lang.c
parentd7dc3873fbc2c722d5ee850341be49028dc5c6b0 (diff)
downloadgdb-74bcbdf3cea56564d1f9f597c8458b86ed71f621.zip
gdb-74bcbdf3cea56564d1f9f597c8458b86ed71f621.tar.gz
gdb-74bcbdf3cea56564d1f9f597c8458b86ed71f621.tar.bz2
2009-01-13 Jim Blandy <jimb@codesourcery.com>
Abstract out common code for copying value locations. * value.h (set_value_component_location): New declaration. * value.c (set_value_component_location): New function. (value_primitive_field): Use it. * valarith.c (value_subscript, value_subscripted_rvalue): Same. * valops.c (search_struct_field, value_slice): Same. * ada-lang.c (coerce_unspec_val_to_type) (ada_value_primitive_packed_val): Same.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 71d99b0..656e771 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -483,10 +483,10 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
check_size (type);
result = allocate_value (type);
- VALUE_LVAL (result) = VALUE_LVAL (val);
+ set_value_component_location (result, val);
set_value_bitsize (result, value_bitsize (val));
set_value_bitpos (result, value_bitpos (val));
- VALUE_ADDRESS (result) = VALUE_ADDRESS (val) + value_offset (val);
+ VALUE_ADDRESS (result) += value_offset (val);
if (value_lazy (val)
|| TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val)))
set_value_lazy (result, 1);
@@ -2018,10 +2018,8 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
if (obj != NULL)
{
- VALUE_LVAL (v) = VALUE_LVAL (obj);
- if (VALUE_LVAL (obj) == lval_internalvar)
- VALUE_LVAL (v) = lval_internalvar_component;
- VALUE_ADDRESS (v) = VALUE_ADDRESS (obj) + value_offset (obj) + offset;
+ set_value_component_location (v, obj);
+ VALUE_ADDRESS (v) += value_offset (obj) + offset;
set_value_bitpos (v, bit_offset + value_bitpos (obj));
set_value_bitsize (v, bit_size);
if (value_bitpos (v) >= HOST_CHAR_BIT)