summaryrefslogtreecommitdiffstats
path: root/gdb/valarith.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/valarith.c
parentd7dc3873fbc2c722d5ee850341be49028dc5c6b0 (diff)
downloadppe42-binutils-74bcbdf3cea56564d1f9f597c8458b86ed71f621.tar.gz
ppe42-binutils-74bcbdf3cea56564d1f9f597c8458b86ed71f621.zip
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/valarith.c')
-rw-r--r--gdb/valarith.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 48f2e95513..f38cdb842f 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -233,11 +233,7 @@ value_subscripted_rvalue (struct value *array, struct value *idx, int lowerbound
memcpy (value_contents_writeable (v),
value_contents (array) + elt_offs, elt_size);
- if (VALUE_LVAL (array) == lval_internalvar)
- VALUE_LVAL (v) = lval_internalvar_component;
- else
- VALUE_LVAL (v) = VALUE_LVAL (array);
- VALUE_ADDRESS (v) = VALUE_ADDRESS (array);
+ set_value_component_location (v, array);
VALUE_REGNUM (v) = VALUE_REGNUM (array);
VALUE_FRAME_ID (v) = VALUE_FRAME_ID (array);
set_value_offset (v, value_offset (array) + elt_offs);
@@ -277,11 +273,7 @@ value_bitstring_subscript (struct type *type,
set_value_bitpos (v, bit_index);
set_value_bitsize (v, 1);
-
- VALUE_LVAL (v) = VALUE_LVAL (bitstring);
- if (VALUE_LVAL (bitstring) == lval_internalvar)
- VALUE_LVAL (v) = lval_internalvar_component;
- VALUE_ADDRESS (v) = VALUE_ADDRESS (bitstring);
+ set_value_component_location (v, bitstring);
VALUE_FRAME_ID (v) = VALUE_FRAME_ID (bitstring);
set_value_offset (v, offset + value_offset (bitstring));
OpenPOWER on IntegriCloud