Trivial patch to remove dependency on host unsigned long type
[deliverable/binutils-gdb.git] / gdb / c-valprint.c
index 646aed72f7551058de0d183d4de01f37137be9bd..3466df02d2d9ffdc8c6120c0fcd3a402f5c45bcd 100644 (file)
@@ -161,7 +161,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
 
          eltlen = TYPE_LENGTH (elttype);
          len = high_bound - low_bound + 1;
-         if (options->prettyprint_arrays)
+         if (options->prettyformat_arrays)
            {
              print_spaces_filtered (2 + 2 * recurse, stream);
            }
@@ -353,7 +353,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
                  vt_val = value_at (wtype, vt_address);
                  common_val_print (vt_val, stream, recurse + 1,
                                    options, current_language);
-                 if (options->pretty)
+                 if (options->prettyformat)
                    {
                      fprintf_filtered (stream, "\n");
                      print_spaces_filtered (2 + 2 * recurse, stream);
@@ -497,18 +497,11 @@ c_value_print (struct value *val, struct ui_file *stream,
       else if (options->objectprint
               && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
        {
+         int is_ref = TYPE_CODE (type) == TYPE_CODE_REF;
+
+         if (is_ref)
+           val = value_addr (val);
 
-         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.  */
-             struct value *temparg;
-             temparg=value_copy(val);
-             deprecated_set_value_type
-               (temparg, lookup_pointer_type (TYPE_TARGET_TYPE (type)));
-             val = temparg;
-           }
          /* Pointer to class, check real type of object.  */
          fprintf_filtered (stream, "(");
 
@@ -522,7 +515,14 @@ c_value_print (struct value *val, struct ui_file *stream,
                  type = real_type;
 
                  /* Need to adjust pointer value.  */
-                 val = value_from_pointer (type, value_as_address (val) - top);
+                 val = value_from_pointer (real_type,
+                                           value_as_address (val) - top);
+
+                 if (is_ref)
+                   {
+                     val = value_ref (value_ind (val));
+                     type = value_type (val);
+                   }
 
                  /* Note: When we look up RTTI entries, we don't get
                     any information on const or volatile
This page took 0.024143 seconds and 4 git commands to generate.