aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
authorAnton Gorenkov <xgsa@sourceware.org>2012-02-21 13:48:59 +0000
committerAnton Gorenkov <xgsa@sourceware.org>2012-02-21 13:48:59 +0000
commitdfcee124897d3395925bdfbfded468c9c81394a0 (patch)
treeff8b1acd9e1b0763ff5edff8183a73fbc997643e /gdb/value.c
parent16a87420985f256b5cde070586ebcdfda2225b01 (diff)
downloadgdb-dfcee124897d3395925bdfbfded468c9c81394a0.zip
gdb-dfcee124897d3395925bdfbfded468c9c81394a0.tar.gz
gdb-dfcee124897d3395925bdfbfded468c9c81394a0.tar.bz2
gdb/
* c-valprint.c (c_value_print): Use value_rtti_indirect_type instead of value_rtti_target_type. * eval.c (evaluate_subexp_standard): Use value_rtti_indirect_type instead of value_rtti_target_type. * typeprint.c (whatis_exp): Use value_rtti_indirect_type instead of value_rtti_target_type. * valops.c (value_ind): Extract function readjust_indirect_value_type. (value_rtti_target_type): Rename to ... (value_rtti_indirect_type): ... here and make it indirect. Update function comment. * value.c (readjust_indirect_value_type): New function. (coerce_ref): Support for enclosing type setting for references with readjust_indirect_value_type. * value.h (readjust_value_type): New declaration. (value_rtti_target_type): Rename to ... (value_rtti_indirect_type): ... here.
Diffstat (limited to 'gdb/value.c')
-rw-r--r--gdb/value.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/gdb/value.c b/gdb/value.c
index 583be33..85ea970 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -3134,11 +3134,30 @@ coerce_ref_if_computed (const struct value *arg)
return funcs->coerce_ref (arg);
}
+/* Look at value.h for description. */
+
+struct value *
+readjust_indirect_value_type (struct value *value, struct type *enc_type,
+ struct type *original_type,
+ struct value *original_value)
+{
+ /* Re-adjust type. */
+ deprecated_set_value_type (value, TYPE_TARGET_TYPE (original_type));
+
+ /* Add embedding info. */
+ set_value_enclosing_type (value, enc_type);
+ set_value_embedded_offset (value, value_pointed_to_offset (original_value));
+
+ /* We may be pointing to an object of some derived type. */
+ return value_full_object (value, NULL, 0, 0, 0);
+}
+
struct value *
coerce_ref (struct value *arg)
{
struct type *value_type_arg_tmp = check_typedef (value_type (arg));
struct value *retval;
+ struct type *enc_type;
retval = coerce_ref_if_computed (arg);
if (retval)
@@ -3147,9 +3166,14 @@ coerce_ref (struct value *arg)
if (TYPE_CODE (value_type_arg_tmp) != TYPE_CODE_REF)
return arg;
- return value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp),
- unpack_pointer (value_type (arg),
- value_contents (arg)));
+ enc_type = check_typedef (value_enclosing_type (arg));
+ enc_type = TYPE_TARGET_TYPE (enc_type);
+
+ retval = value_at_lazy (enc_type,
+ unpack_pointer (value_type (arg),
+ value_contents (arg)));
+ return readjust_indirect_value_type (retval, enc_type,
+ value_type_arg_tmp, arg);
}
struct value *