+ if (objectprint && (TYPE_CODE (value_type (val)) == TYPE_CODE_CLASS))
+ {
+ /* Attempt to determine real type of object */
+ real_type = value_rtti_type (val, &full, &top, &using_enc);
+ if (real_type)
+ {
+ /* We have RTTI information, so use it */
+ val = value_full_object (val, real_type, full, top, using_enc);
+ fprintf_filtered (stream, "(%s%s) ",
+ TYPE_NAME (real_type),
+ full ? "" : _(" [incomplete object]"));
+ /* Print out object: enclosing type is same as real_type if full */
+ return val_print (value_enclosing_type (val),
+ value_contents_all (val), 0,
+ VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
+ /* Note: When we look up RTTI entries, we don't get any information on
+ const or volatile attributes */
+ }
+ else if (type != value_enclosing_type (val))
+ {
+ /* No RTTI information, so let's do our best */
+ fprintf_filtered (stream, "(%s ?) ",
+ TYPE_NAME (value_enclosing_type (val)));
+ return val_print (value_enclosing_type (val),
+ value_contents_all (val), 0,
+ VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
+ }
+ /* Otherwise, we end up at the return outside this "if" */
+ }
+
+ return val_print (type, value_contents_all (val),
+ VALUE_EMBEDDED_OFFSET (val),
+ VALUE_ADDRESS (val) + value_offset (val),