- wrap_here (" ");
- }
- if (show < 0)
- fprintf_filtered (stream, "{...}");
- else
- {
- check_stub_type (type);
-
- type_print_derivation_info (stream, type);
-
- fprintf_filtered (stream, "{");
- len = TYPE_NFIELDS (type);
- if (len)
- fprintf_filtered (stream, "\n");
- else
- {
- if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
- fprintf_filtered (stream, "<incomplete type>\n");
- else
- fprintf_filtered (stream, "<no data fields>\n");
- }
-
- /* If there is a base class for this type,
- do not print the field that it occupies. */
- for (i = TYPE_N_BASECLASSES (type); i < len; i++)
- {
- QUIT;
- /* Don't print out virtual function table. */
- if ((TYPE_FIELD_NAME (type, i))[5] == CPLUS_MARKER &&
- !strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5))
- continue;
-
- print_spaces_filtered (level + 4, stream);
- if (TYPE_FIELD_STATIC (type, i))
- {
- fprintf_filtered (stream, "static ");
- }
- type_print_1 (TYPE_FIELD_TYPE (type, i),
- TYPE_FIELD_NAME (type, i),
- stream, show - 1, level + 4);
- if (!TYPE_FIELD_STATIC (type, i)
- && TYPE_FIELD_PACKED (type, i))
- {
- /* It is a bitfield. This code does not attempt
- to look at the bitpos and reconstruct filler,
- unnamed fields. This would lead to misleading
- results if the compiler does not put out fields
- for such things (I don't know what it does). */
- fprintf_filtered (stream, " : %d",
- TYPE_FIELD_BITSIZE (type, i));
- }
- fprintf_filtered (stream, ";\n");
- }
-
- /* C++: print out the methods */
- len = TYPE_NFN_FIELDS (type);
- if (len) fprintf_filtered (stream, "\n");
- for (i = 0; i < len; i++)
- {
- struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
- int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
-
- for (j = 0; j < len2; j++)
- {
- QUIT;
- print_spaces_filtered (level + 4, stream);
- if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
- fprintf_filtered (stream, "virtual ");
- else if (TYPE_FN_FIELD_STATIC_P (f, j))
- fprintf_filtered (stream, "static ");
- if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0)
- {
- /* Keep GDB from crashing here. */
- fprintf (stream, "<undefined type> %s;\n",
- TYPE_FN_FIELD_PHYSNAME (f, j));
- break;
- }
- else
- type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)), "", stream, 0);
- if (TYPE_FLAGS (TYPE_FN_FIELD_TYPE (f, j)) & TYPE_FLAG_STUB)
- {
- /* Build something we can demangle. */
- char *strchr (), *gdb_mangle_name (), *cplus_demangle ();
- char *mangled_name = gdb_mangle_name (type, i, j);
- char *demangled_name = cplus_demangle (mangled_name, 1);
- if (demangled_name == 0)
- fprintf_filtered (stream, " <badly mangled name %s>",
- mangled_name);
- else
- {
- fprintf_filtered (stream, " %s",
- strchr (demangled_name, ':') + 2);
- free (demangled_name);
- }
- free (mangled_name);
- }
- else if (TYPE_FN_FIELD_PHYSNAME (f, j)[0] == '_'
- && TYPE_FN_FIELD_PHYSNAME (f, j)[1] == CPLUS_MARKER)
- type_print_method_args
- (TYPE_FN_FIELD_ARGS (f, j) + 1, "~",
- TYPE_FN_FIELDLIST_NAME (type, i), 0, stream);
- else
- type_print_method_args
- (TYPE_FN_FIELD_ARGS (f, j), "",
- TYPE_FN_FIELDLIST_NAME (type, i),
- TYPE_FN_FIELD_STATIC_P (f, j), stream);
-
- fprintf_filtered (stream, ";\n");
- }
- }
-
- print_spaces_filtered (level, stream);
- fprintf_filtered (stream, "}");