* inftarg.c (child_thread_alive): New function to see if a
[deliverable/binutils-gdb.git] / gdb / ch-valprint.c
index 00f556529e661c49ea4d4a2f583098d97f069f96..31eeb1289a1d5be6e7aa3e367edcd14b3589bc9d 100644 (file)
@@ -30,11 +30,36 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "c-lang.h" /* For c_val_print */
 #include "typeprint.h"
 #include "ch-lang.h"
+#include "annotate.h"
 
 static void
 chill_print_value_fields PARAMS ((struct type *, char *, GDB_FILE *, int, int,
                                  enum val_prettyprint, struct type **));
 
+\f
+/* Print integral scalar data VAL, of type TYPE, onto stdio stream STREAM.
+   Used to print data from type structures in a specified type.  For example,
+   array bounds may be characters or booleans in some languages, and this
+   allows the ranges to be printed in their "natural" form rather than as
+   decimal integer values. */
+
+void
+chill_print_type_scalar (type, val, stream)
+     struct type *type;
+     LONGEST val;
+     GDB_FILE *stream;
+{
+  switch (TYPE_CODE (type))
+    {
+    case TYPE_CODE_RANGE:
+      if (TYPE_TARGET_TYPE (type))
+       {
+         chill_print_type_scalar (TYPE_TARGET_TYPE (type), val, stream);
+         return;
+       }
+    }
+  print_type_scalar (type, val, stream);
+}
 \f
 /* Print the elements of an array.
    Similar to val_print_array_elements, but prints
@@ -99,11 +124,12 @@ chill_val_print_array_elements (type, valaddr, address, stream,
        }
 
       fputs_filtered ("(", stream);
-      print_type_scalar (index_type, low_bound + i, stream);
+      chill_print_type_scalar (index_type, low_bound + i, stream);
       if (reps > 1)
        {
          fputs_filtered (":", stream);
-         print_type_scalar (index_type, low_bound + i + reps - 1, stream);
+         chill_print_type_scalar (index_type, low_bound + i + reps - 1,
+                                  stream);
          fputs_filtered ("): ", stream);
          val_print (elttype, valaddr + i * eltlen, 0, stream, format,
                     deref_ref, recurse + 1, pretty);
@@ -280,11 +306,6 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
       break;
 
     case TYPE_CODE_STRING:
-      if (format && format != 's')
-       {
-         print_scalar_formatted (valaddr, type, format, 0, stream);
-         break;
-       }
       i = TYPE_LENGTH (type);
       LA_PRINT_STRING (stream, valaddr, i, 0);
       /* Return number of characters printed, plus one for the terminating
@@ -294,7 +315,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
 
     case TYPE_CODE_BITSTRING:
     case TYPE_CODE_SET:
-      elttype = TYPE_FIELD_TYPE (type, 0);
+      elttype = TYPE_INDEX_TYPE (type);
       check_stub_type (elttype);
       if (TYPE_FLAGS (elttype) & TYPE_FLAG_STUB)
        {
@@ -323,7 +344,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
              {
                if (need_comma)
                  fputs_filtered (", ", stream);
-               print_type_scalar (TYPE_TARGET_TYPE (range), i, stream);
+               chill_print_type_scalar (range, i, stream);
                need_comma = 1;
 
                /* Look for a continuous range of true elements. */
@@ -334,7 +355,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
                    while (i+1 <= high_bound
                           && value_bit_index (type, valaddr, ++i))
                      j = i;
-                   print_type_scalar (TYPE_TARGET_TYPE (range), j, stream);
+                   chill_print_type_scalar (range, j, stream);
                  }
              }
          }
@@ -346,7 +367,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
       break;
 
     case TYPE_CODE_STRUCT:
-      if (chill_is_varying_struct (type))
+      if (chill_varying_type (type))
        {
          struct type *inner = TYPE_FIELD_TYPE (type, 1);
          long length = unpack_long (TYPE_FIELD_TYPE (type, 0), valaddr);
This page took 0.024406 seconds and 4 git commands to generate.