+ print_address_demangle (gdbarch, func_addr, stream, demangle);
+}
+
+
+/* A helper for c_textual_element_type. This checks the name of the
+ typedef. This is bogus but it isn't apparent that the compiler
+ provides us the help we may need. */
+
+static int
+textual_name (const char *name)
+{
+ return (!strcmp (name, "wchar_t")
+ || !strcmp (name, "char16_t")
+ || !strcmp (name, "char32_t"));
+}
+
+/* Apply a heuristic to decide whether an array of TYPE or a pointer
+ to TYPE should be printed as a textual string. Return non-zero if
+ it should, or zero if it should be treated as an array of integers
+ or pointer to integers. FORMAT is the current format letter,
+ or 0 if none.
+
+ We guess that "char" is a character. Explicitly signed and
+ unsigned character types are also characters. Integer data from
+ vector types is not. The user can override this by using the /s
+ format letter. */
+
+int
+c_textual_element_type (struct type *type, char format)
+{
+ struct type *true_type, *iter_type;
+
+ if (format != 0 && format != 's')
+ return 0;
+
+ /* We also rely on this for its side effect of setting up all the
+ typedef pointers. */
+ true_type = check_typedef (type);
+
+ /* TYPE_CODE_CHAR is always textual. */
+ if (TYPE_CODE (true_type) == TYPE_CODE_CHAR)
+ return 1;
+
+ /* Any other character-like types must be integral. */
+ if (TYPE_CODE (true_type) != TYPE_CODE_INT)
+ return 0;
+
+ /* We peel typedefs one by one, looking for a match. */
+ iter_type = type;
+ while (iter_type)
+ {
+ /* Check the name of the type. */
+ if (TYPE_NAME (iter_type) && textual_name (TYPE_NAME (iter_type)))
+ return 1;
+
+ if (TYPE_CODE (iter_type) != TYPE_CODE_TYPEDEF)
+ break;
+
+ /* Peel a single typedef. If the typedef doesn't have a target
+ type, we use check_typedef and hope the result is ok -- it
+ might be for C++, where wchar_t is a built-in type. */
+ if (TYPE_TARGET_TYPE (iter_type))
+ iter_type = TYPE_TARGET_TYPE (iter_type);
+ else
+ iter_type = check_typedef (iter_type);
+ }
+
+ if (format == 's')
+ {
+ /* Print this as a string if we can manage it. For now, no
+ wide character support. */
+ if (TYPE_CODE (true_type) == TYPE_CODE_INT
+ && TYPE_LENGTH (true_type) == 1)
+ return 1;
+ }
+ else
+ {
+ /* If a one-byte TYPE_CODE_INT is missing the not-a-character
+ flag, then we treat it as text; otherwise, we assume it's
+ being used as data. */
+ if (TYPE_CODE (true_type) == TYPE_CODE_INT
+ && TYPE_LENGTH (true_type) == 1
+ && !TYPE_NOTTEXT (true_type))
+ return 1;
+ }
+
+ return 0;