From 070ad9f02e4caeb3ee1aae1b8d62310ebb9e00d6 Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Tue, 4 Apr 2000 04:53:50 +0000 Subject: C++ changes for 5.0, finally committed. --- gdb/c-valprint.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'gdb/c-valprint.c') diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 07289de..ec4b3cf 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -481,6 +481,17 @@ c_value_print (val, stream, format, pretty) } else if (objectprint && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS)) { + + if (TYPE_CODE(type) == TYPE_CODE_REF) + { + /* Copy value, change to pointer, so we don't get an + * error about a non-pointer type in value_rtti_target_type + */ + value_ptr temparg; + temparg=value_copy(val); + VALUE_TYPE (temparg) = lookup_pointer_type(TYPE_TARGET_TYPE(type)); + val=temparg; + } /* Pointer to class, check real type of object */ fprintf_filtered (stream, "("); real_type = value_rtti_target_type (val, &full, &top, &using_enc); @@ -497,6 +508,9 @@ c_value_print (val, stream, format, pretty) /* create a reference type referencing the real type */ type = lookup_reference_type (real_type); } + /* JYG: Need to adjust pointer value. */ + val->aligner.contents[0] -= top; + /* Note: When we look up RTTI entries, we don't get any information on const or volatile attributes */ } -- cgit v1.1