aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.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/value.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/value.c')
-rw-r--r--gdb/value.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gdb/value.c b/gdb/value.c
index 1068f1d..f0c8463 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -627,6 +627,17 @@ value_copy (struct value *arg)
}
return val;
}
+
+void
+set_value_component_location (struct value *component, struct value *whole)
+{
+ if (VALUE_LVAL (whole) == lval_internalvar)
+ VALUE_LVAL (component) = lval_internalvar_component;
+ else
+ VALUE_LVAL (component) = VALUE_LVAL (whole);
+ component->location = whole->location;
+}
+
/* Access to the value history. */
@@ -1426,10 +1437,7 @@ value_primitive_field (struct value *arg1, int offset,
v->offset = (value_offset (arg1) + offset
+ value_embedded_offset (arg1));
}
- VALUE_LVAL (v) = VALUE_LVAL (arg1);
- if (VALUE_LVAL (arg1) == lval_internalvar)
- VALUE_LVAL (v) = lval_internalvar_component;
- v->location = arg1->location;
+ set_value_component_location (v, arg1);
VALUE_REGNUM (v) = VALUE_REGNUM (arg1);
VALUE_FRAME_ID (v) = VALUE_FRAME_ID (arg1);
return v;