aboutsummaryrefslogtreecommitdiff
path: root/gdb/valops.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/valops.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/valops.c')
-rw-r--r--gdb/valops.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index fe011d0..30e74fa 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1575,8 +1575,7 @@ search_struct_field (char *name, struct value *arg1, int offset,
value_contents_raw (arg1) + boffset,
TYPE_LENGTH (basetype));
}
- VALUE_LVAL (v2) = VALUE_LVAL (arg1);
- VALUE_ADDRESS (v2) = VALUE_ADDRESS (arg1);
+ set_value_component_location (v2, arg1);
VALUE_FRAME_ID (v2) = VALUE_FRAME_ID (arg1);
set_value_offset (v2, value_offset (arg1) + boffset);
}
@@ -2984,12 +2983,7 @@ value_slice (struct value *array, int lowbound, int length)
TYPE_LENGTH (slice_type));
}
- if (VALUE_LVAL (array) == lval_internalvar)
- VALUE_LVAL (slice) = lval_internalvar_component;
- else
- VALUE_LVAL (slice) = VALUE_LVAL (array);
-
- VALUE_ADDRESS (slice) = VALUE_ADDRESS (array);
+ set_value_component_location (slice, array);
VALUE_FRAME_ID (slice) = VALUE_FRAME_ID (array);
set_value_offset (slice, value_offset (array) + offset);
}