+/* A helper function for val_print. When printing in "summary" mode,
+ we want to print scalar arguments, but not aggregate arguments.
+ This function distinguishes between the two. */
+
+static int
+scalar_type_p (struct type *type)
+{
+ CHECK_TYPEDEF (type);
+ while (TYPE_CODE (type) == TYPE_CODE_REF)
+ {
+ type = TYPE_TARGET_TYPE (type);
+ CHECK_TYPEDEF (type);
+ }
+ switch (TYPE_CODE (type))
+ {
+ case TYPE_CODE_ARRAY:
+ case TYPE_CODE_STRUCT:
+ case TYPE_CODE_UNION:
+ case TYPE_CODE_SET:
+ case TYPE_CODE_STRING:
+ case TYPE_CODE_BITSTRING:
+ return 0;
+ default:
+ return 1;
+ }
+}
+
+/* Helper function to check the validity of some bits of a value.
+
+ If TYPE represents some aggregate type (e.g., a structure), return 1.
+
+ Otherwise, any of the bytes starting at OFFSET and extending for
+ TYPE_LENGTH(TYPE) bytes are invalid, print a message to STREAM and
+ return 0. The checking is done using FUNCS.
+
+ Otherwise, return 1. */
+
+static int
+valprint_check_validity (struct ui_file *stream,
+ struct type *type,
+ int offset,
+ const struct value *val)
+{
+ CHECK_TYPEDEF (type);
+
+ if (TYPE_CODE (type) != TYPE_CODE_UNION
+ && TYPE_CODE (type) != TYPE_CODE_STRUCT
+ && TYPE_CODE (type) != TYPE_CODE_ARRAY)
+ {
+ if (! value_bits_valid (val, TARGET_CHAR_BIT * offset,
+ TARGET_CHAR_BIT * TYPE_LENGTH (type)))
+ {
+ fprintf_filtered (stream, _("<value optimized out>"));
+ return 0;
+ }
+ }
+
+ return 1;
+}
+