X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fc-typeprint.c;h=374c90e3be6a1f3bab3396b8c23a89006181b5db;hb=36e9d67b868c85232ab630514260f0d9c9c6b27b;hp=d91005850c50d92cfdadfe36e10fe5772ea92257;hpb=b86138fb0484f42db6cb83abed1e3d0ad2ec4eac;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index d91005850c..374c90e3be 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -31,8 +31,6 @@ #include "typeprint.h" #include "cp-abi.h" #include "jv-lang.h" -#include -#include #include "cp-support.h" static void c_type_print_varspec_prefix (struct type *, @@ -1328,6 +1326,8 @@ c_type_print_base (struct type *type, struct ui_file *stream, case TYPE_CODE_ENUM: c_type_print_modifier (type, stream, 0, 1); fprintf_filtered (stream, "enum "); + if (TYPE_DECLARED_CLASS (type)) + fprintf_filtered (stream, "class "); /* Print the tag name if it exists. The aCC compiler emits a spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}" @@ -1353,6 +1353,23 @@ c_type_print_base (struct type *type, struct ui_file *stream, { LONGEST lastval = 0; + /* We can't handle this case perfectly, as DWARF does not + tell us whether or not the underlying type was specified + in the source (and other debug formats don't provide this + at all). We choose to print the underlying type, if it + has a name, when in C++ on the theory that it's better to + print too much than too little; but conversely not to + print something egregiously outside the current + language's syntax. */ + if (current_language->la_language == language_cplus + && TYPE_TARGET_TYPE (type) != NULL) + { + struct type *underlying = check_typedef (TYPE_TARGET_TYPE (type)); + + if (TYPE_NAME (underlying) != NULL) + fprintf_filtered (stream, ": %s ", TYPE_NAME (underlying)); + } + fprintf_filtered (stream, "{"); len = TYPE_NFIELDS (type); for (i = 0; i < len; i++)