* linux-thread-db.c (BUILD_THREAD): Delete.
[deliverable/binutils-gdb.git] / gdb / f-valprint.c
index cc337e9481e67e8d8e7304178224724162ff5c9b..24f7b3d345ba0f1699b8e09297e8db51a9a1759d 100644 (file)
@@ -276,6 +276,7 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream)
 
 /* Actual function which prints out F77 arrays, Valaddr == address in 
    the superior.  Address == the address in the inferior.  */
+
 static void
 f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr,
                   CORE_ADDR address, struct ui_file *stream, int format,
@@ -295,13 +296,13 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr,
                             stream, format, deref_ref, recurse, pretty, elts);
          fprintf_filtered (stream, ") ");
        }
-      if (*elts >= print_max && i < F77_DIM_SIZE (nss)) {
+      if (*elts >= print_max && i < F77_DIM_SIZE (nss)) 
        fprintf_filtered (stream, "...");
-      }
     }
   else
     {
-      for (i = 0; (i < F77_DIM_SIZE (nss) && (*elts) < print_max); i++, (*elts)++)
+      for (i = 0; i < F77_DIM_SIZE (nss) && (*elts) < print_max; 
+          i++, (*elts)++)
        {
          val_print (TYPE_TARGET_TYPE (type),
                     valaddr + i * F77_DIM_OFFSET (ndimensions),
@@ -312,7 +313,7 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr,
          if (i != (F77_DIM_SIZE (nss) - 1))
            fprintf_filtered (stream, ", ");
 
-         if ((( *elts) == print_max - 1) && (i != (F77_DIM_SIZE (nss) - 1)))
+         if ((*elts == print_max - 1) && (i != (F77_DIM_SIZE (nss) - 1)))
            fprintf_filtered (stream, "...");
        }
     }
@@ -383,11 +384,7 @@ f_val_print (struct type *type, char *valaddr, int embedded_offset,
                       deref_ref, recurse, pretty);
       fprintf_filtered (stream, ")");
       break;
-#if 0
-      /* Array of unspecified length: treat like pointer to first elt.  */
-      valaddr = (char *) &address;
-      /* FALL THROUGH */
-#endif
+
     case TYPE_CODE_PTR:
       if (format && format != 's')
        {
@@ -408,7 +405,7 @@ f_val_print (struct type *type, char *valaddr, int embedded_offset,
            }
 
          if (addressprint && format != 's')
-           fprintf_filtered (stream, "0x%s", paddr_nz (addr));
+           print_address_numeric (addr, 1, stream);
 
          /* For a pointer to char or unsigned char, also print the string
             pointed to, unless pointer is null.  */
@@ -418,9 +415,46 @@ f_val_print (struct type *type, char *valaddr, int embedded_offset,
              && addr != 0)
            i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream);
 
-         /* Return number of characters printed, plus one for the
-            terminating null if we have "reached the end".  */
-         return (i + (print_max && i != print_max));
+         /* Return number of characters printed, including the terminating
+            '\0' if we reached the end.  val_print_string takes care including
+            the terminating '\0' if necessary.  */
+         return i;
+       }
+      break;
+
+    case TYPE_CODE_REF:
+      elttype = check_typedef (TYPE_TARGET_TYPE (type));
+      if (addressprint)
+       {
+         CORE_ADDR addr
+           = extract_typed_address (valaddr + embedded_offset, type);
+         fprintf_filtered (stream, "@");
+         print_address_numeric (addr, 1, stream);
+         if (deref_ref)
+           fputs_filtered (": ", stream);
+       }
+      /* De-reference the reference.  */
+      if (deref_ref)
+       {
+         if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
+           {
+             struct value *deref_val =
+             value_at
+             (TYPE_TARGET_TYPE (type),
+              unpack_pointer (lookup_pointer_type (builtin_type_void),
+                              valaddr + embedded_offset));
+             val_print (value_type (deref_val),
+                        VALUE_CONTENTS (deref_val),
+                        0,
+                        VALUE_ADDRESS (deref_val),
+                        stream,
+                        format,
+                        deref_ref,
+                        recurse,
+                        pretty);
+           }
+         else
+           fputs_filtered ("???", stream);
        }
       break;
 
This page took 0.025457 seconds and 4 git commands to generate.