formatting cleanups
[deliverable/binutils-gdb.git] / gdb / ch-valprint.c
index c0ec4f79ea63e3cdc4e3281bfa59e53e2bd5b4c6..23891e88fcc80228c59620fd82f5b4e9df01c15e 100644 (file)
@@ -157,7 +157,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
        }
       if (addressprint && format != 's')
        {
-         fprintf_filtered (stream, "0x%x", addr);
+         fprintf_filtered (stream, "H'%x", addr);
        }
       
       /* For a pointer to char or unsigned char, also print the string
@@ -185,7 +185,9 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
        }
       if (addressprint && format != 's')
        {
-         fprintf_filtered (stream, "0x%x ", addr);
+         /* This used to say `addr', which is unset at this point.
+            Is `address' what is meant?  */
+         fprintf_filtered (stream, "H'%x ", address);
        }
       i = TYPE_LENGTH (type);
       LA_PRINT_STRING (stream, valaddr, i, 0);
@@ -199,20 +201,50 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
                                0);
       break;
 
-    case TYPE_CODE_MEMBER:
     case TYPE_CODE_REF:
-    case TYPE_CODE_UNION:
+      if (addressprint)
+        {
+         fprintf_filtered (stream, "LOC(H'%lx)",
+                           unpack_long (builtin_type_int, valaddr));
+         if (deref_ref)
+           fputs_filtered (": ", stream);
+        }
+      /* De-reference the reference.  */
+      if (deref_ref)
+       {
+         if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_UNDEF)
+           {
+             value deref_val =
+               value_at
+                 (TYPE_TARGET_TYPE (type),
+                  unpack_pointer (lookup_pointer_type (builtin_type_void),
+                                  valaddr));
+             val_print (VALUE_TYPE (deref_val),
+                        VALUE_CONTENTS (deref_val),
+                        VALUE_ADDRESS (deref_val), stream, format,
+                        deref_ref, recurse + 1, pretty);
+           }
+         else
+           fputs_filtered ("???", stream);
+       }
+      break;
+
     case TYPE_CODE_ENUM:
+      c_val_print (type, valaddr, address, stream, format,
+                  deref_ref, recurse, pretty);
+      break;
+
+    case TYPE_CODE_MEMBER:
+    case TYPE_CODE_UNION:
     case TYPE_CODE_FUNC:
     case TYPE_CODE_VOID:
     case TYPE_CODE_ERROR:
     case TYPE_CODE_RANGE:
-      error ("Unimplemented chill_val_print support for type %d",
-            TYPE_CODE (type));
-      break;
-
     default:
-      error ("Invalid Chill type code %d in symbol table.", TYPE_CODE (type));
+      /* Let's derfer printing to the C printer, rather than
+        print an error message.  FIXME! */
+      c_val_print (type, valaddr, address, stream, format,
+                  deref_ref, recurse, pretty);
     }
   fflush (stream);
   return (0);
@@ -243,7 +275,7 @@ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
 
   check_stub_type (type);
 
-  fprintf_filtered (stream, "(");
+  fprintf_filtered (stream, "[");
   len = TYPE_NFIELDS (type);
   if (len == 0)
     {
@@ -267,9 +299,10 @@ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
            {
              wrap_here (n_spaces (2 + 2 * recurse));
            }
+         fputs_filtered (".", stream);
          fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
                                   language_chill, DMGL_NO_OPTS);
-         fputs_filtered (" = ", stream);
+         fputs_filtered (": ", stream);
          if (TYPE_FIELD_PACKED (type, i))
            {
              value v;
@@ -295,6 +328,6 @@ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
          print_spaces_filtered (2 * recurse, stream);
        }
     }
-  fprintf_filtered (stream, ")");
+  fprintf_filtered (stream, "]");
 }
 
This page took 0.024005 seconds and 4 git commands to generate.