xref: /dragonfly/contrib/gdb-7/gdb/f-typeprint.c (revision ef5ccd6c)
15796c8dcSSimon Schubert /* Support for printing Fortran types for GDB, the GNU debugger.
25796c8dcSSimon Schubert 
3*ef5ccd6cSJohn Marino    Copyright (C) 1986-2013 Free Software Foundation, Inc.
45796c8dcSSimon Schubert 
55796c8dcSSimon Schubert    Contributed by Motorola.  Adapted from the C version by Farooq Butt
65796c8dcSSimon Schubert    (fmbutt@engage.sps.mot.com).
75796c8dcSSimon Schubert 
85796c8dcSSimon Schubert    This file is part of GDB.
95796c8dcSSimon Schubert 
105796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
115796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
125796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
135796c8dcSSimon Schubert    (at your option) any later version.
145796c8dcSSimon Schubert 
155796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
165796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
175796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
185796c8dcSSimon Schubert    GNU General Public License for more details.
195796c8dcSSimon Schubert 
205796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
215796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
225796c8dcSSimon Schubert 
235796c8dcSSimon Schubert #include "defs.h"
245796c8dcSSimon Schubert #include "gdb_obstack.h"
255796c8dcSSimon Schubert #include "bfd.h"
265796c8dcSSimon Schubert #include "symtab.h"
275796c8dcSSimon Schubert #include "gdbtypes.h"
285796c8dcSSimon Schubert #include "expression.h"
295796c8dcSSimon Schubert #include "value.h"
305796c8dcSSimon Schubert #include "gdbcore.h"
315796c8dcSSimon Schubert #include "target.h"
325796c8dcSSimon Schubert #include "f-lang.h"
335796c8dcSSimon Schubert 
345796c8dcSSimon Schubert #include "gdb_string.h"
355796c8dcSSimon Schubert #include <errno.h>
365796c8dcSSimon Schubert 
37c50c785cSJohn Marino #if 0				/* Currently unused.  */
385796c8dcSSimon Schubert static void f_type_print_args (struct type *, struct ui_file *);
395796c8dcSSimon Schubert #endif
405796c8dcSSimon Schubert 
415796c8dcSSimon Schubert static void f_type_print_varspec_suffix (struct type *, struct ui_file *, int,
425796c8dcSSimon Schubert 					 int, int, int);
435796c8dcSSimon Schubert 
445796c8dcSSimon Schubert void f_type_print_varspec_prefix (struct type *, struct ui_file *,
455796c8dcSSimon Schubert 				  int, int);
465796c8dcSSimon Schubert 
475796c8dcSSimon Schubert void f_type_print_base (struct type *, struct ui_file *, int, int);
485796c8dcSSimon Schubert 
495796c8dcSSimon Schubert 
505796c8dcSSimon Schubert /* LEVEL is the depth to indent lines by.  */
515796c8dcSSimon Schubert 
525796c8dcSSimon Schubert void
f_print_type(struct type * type,const char * varstring,struct ui_file * stream,int show,int level,const struct type_print_options * flags)53cf7f2e2dSJohn Marino f_print_type (struct type *type, const char *varstring, struct ui_file *stream,
54*ef5ccd6cSJohn Marino 	      int show, int level, const struct type_print_options *flags)
555796c8dcSSimon Schubert {
565796c8dcSSimon Schubert   enum type_code code;
575796c8dcSSimon Schubert   int demangled_args;
585796c8dcSSimon Schubert 
595796c8dcSSimon Schubert   f_type_print_base (type, stream, show, level);
605796c8dcSSimon Schubert   code = TYPE_CODE (type);
615796c8dcSSimon Schubert   if ((varstring != NULL && *varstring != '\0')
625796c8dcSSimon Schubert   /* Need a space if going to print stars or brackets;
635796c8dcSSimon Schubert      but not if we will print just a type name.  */
64cf7f2e2dSJohn Marino       || ((show > 0 || TYPE_NAME (type) == 0)
65cf7f2e2dSJohn Marino           && (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC
665796c8dcSSimon Schubert 	      || code == TYPE_CODE_METHOD
675796c8dcSSimon Schubert 	      || code == TYPE_CODE_ARRAY
685796c8dcSSimon Schubert 	      || code == TYPE_CODE_REF)))
695796c8dcSSimon Schubert     fputs_filtered (" ", stream);
705796c8dcSSimon Schubert   f_type_print_varspec_prefix (type, stream, show, 0);
715796c8dcSSimon Schubert 
725796c8dcSSimon Schubert   if (varstring != NULL)
735796c8dcSSimon Schubert     {
745796c8dcSSimon Schubert       fputs_filtered (varstring, stream);
755796c8dcSSimon Schubert 
765796c8dcSSimon Schubert       /* For demangled function names, we have the arglist as part of the name,
77c50c785cSJohn Marino          so don't print an additional pair of ()'s.  */
785796c8dcSSimon Schubert 
795796c8dcSSimon Schubert       demangled_args = varstring[strlen (varstring) - 1] == ')';
805796c8dcSSimon Schubert       f_type_print_varspec_suffix (type, stream, show, 0, demangled_args, 0);
815796c8dcSSimon Schubert    }
825796c8dcSSimon Schubert }
835796c8dcSSimon Schubert 
845796c8dcSSimon Schubert /* Print any asterisks or open-parentheses needed before the
855796c8dcSSimon Schubert    variable name (to describe its type).
865796c8dcSSimon Schubert 
875796c8dcSSimon Schubert    On outermost call, pass 0 for PASSED_A_PTR.
885796c8dcSSimon Schubert    On outermost call, SHOW > 0 means should ignore
895796c8dcSSimon Schubert    any typename for TYPE and show its details.
905796c8dcSSimon Schubert    SHOW is always zero on recursive calls.  */
915796c8dcSSimon Schubert 
925796c8dcSSimon Schubert void
f_type_print_varspec_prefix(struct type * type,struct ui_file * stream,int show,int passed_a_ptr)935796c8dcSSimon Schubert f_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
945796c8dcSSimon Schubert 			     int show, int passed_a_ptr)
955796c8dcSSimon Schubert {
965796c8dcSSimon Schubert   if (type == 0)
975796c8dcSSimon Schubert     return;
985796c8dcSSimon Schubert 
995796c8dcSSimon Schubert   if (TYPE_NAME (type) && show <= 0)
1005796c8dcSSimon Schubert     return;
1015796c8dcSSimon Schubert 
1025796c8dcSSimon Schubert   QUIT;
1035796c8dcSSimon Schubert 
1045796c8dcSSimon Schubert   switch (TYPE_CODE (type))
1055796c8dcSSimon Schubert     {
1065796c8dcSSimon Schubert     case TYPE_CODE_PTR:
1075796c8dcSSimon Schubert       f_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
1085796c8dcSSimon Schubert       break;
1095796c8dcSSimon Schubert 
1105796c8dcSSimon Schubert     case TYPE_CODE_FUNC:
1115796c8dcSSimon Schubert       f_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
1125796c8dcSSimon Schubert       if (passed_a_ptr)
1135796c8dcSSimon Schubert 	fprintf_filtered (stream, "(");
1145796c8dcSSimon Schubert       break;
1155796c8dcSSimon Schubert 
1165796c8dcSSimon Schubert     case TYPE_CODE_ARRAY:
1175796c8dcSSimon Schubert       f_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
1185796c8dcSSimon Schubert       break;
1195796c8dcSSimon Schubert 
1205796c8dcSSimon Schubert     case TYPE_CODE_UNDEF:
1215796c8dcSSimon Schubert     case TYPE_CODE_STRUCT:
1225796c8dcSSimon Schubert     case TYPE_CODE_UNION:
1235796c8dcSSimon Schubert     case TYPE_CODE_ENUM:
1245796c8dcSSimon Schubert     case TYPE_CODE_INT:
1255796c8dcSSimon Schubert     case TYPE_CODE_FLT:
1265796c8dcSSimon Schubert     case TYPE_CODE_VOID:
1275796c8dcSSimon Schubert     case TYPE_CODE_ERROR:
1285796c8dcSSimon Schubert     case TYPE_CODE_CHAR:
1295796c8dcSSimon Schubert     case TYPE_CODE_BOOL:
1305796c8dcSSimon Schubert     case TYPE_CODE_SET:
1315796c8dcSSimon Schubert     case TYPE_CODE_RANGE:
1325796c8dcSSimon Schubert     case TYPE_CODE_STRING:
1335796c8dcSSimon Schubert     case TYPE_CODE_METHOD:
1345796c8dcSSimon Schubert     case TYPE_CODE_REF:
1355796c8dcSSimon Schubert     case TYPE_CODE_COMPLEX:
1365796c8dcSSimon Schubert     case TYPE_CODE_TYPEDEF:
1375796c8dcSSimon Schubert       /* These types need no prefix.  They are listed here so that
1385796c8dcSSimon Schubert          gcc -Wall will reveal any types that haven't been handled.  */
1395796c8dcSSimon Schubert       break;
1405796c8dcSSimon Schubert     }
1415796c8dcSSimon Schubert }
1425796c8dcSSimon Schubert 
1435796c8dcSSimon Schubert /* Print any array sizes, function arguments or close parentheses
1445796c8dcSSimon Schubert    needed after the variable name (to describe its type).
1455796c8dcSSimon Schubert    Args work like c_type_print_varspec_prefix.  */
1465796c8dcSSimon Schubert 
1475796c8dcSSimon Schubert static void
f_type_print_varspec_suffix(struct type * type,struct ui_file * stream,int show,int passed_a_ptr,int demangled_args,int arrayprint_recurse_level)1485796c8dcSSimon Schubert f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
1495796c8dcSSimon Schubert 			     int show, int passed_a_ptr, int demangled_args,
1505796c8dcSSimon Schubert 			     int arrayprint_recurse_level)
1515796c8dcSSimon Schubert {
1525796c8dcSSimon Schubert   int upper_bound, lower_bound;
153cf7f2e2dSJohn Marino 
1545796c8dcSSimon Schubert   /* No static variables are permitted as an error call may occur during
1555796c8dcSSimon Schubert      execution of this function.  */
1565796c8dcSSimon Schubert 
1575796c8dcSSimon Schubert   if (type == 0)
1585796c8dcSSimon Schubert     return;
1595796c8dcSSimon Schubert 
1605796c8dcSSimon Schubert   if (TYPE_NAME (type) && show <= 0)
1615796c8dcSSimon Schubert     return;
1625796c8dcSSimon Schubert 
1635796c8dcSSimon Schubert   QUIT;
1645796c8dcSSimon Schubert 
1655796c8dcSSimon Schubert   switch (TYPE_CODE (type))
1665796c8dcSSimon Schubert     {
1675796c8dcSSimon Schubert     case TYPE_CODE_ARRAY:
1685796c8dcSSimon Schubert       arrayprint_recurse_level++;
1695796c8dcSSimon Schubert 
1705796c8dcSSimon Schubert       if (arrayprint_recurse_level == 1)
1715796c8dcSSimon Schubert 	fprintf_filtered (stream, "(");
1725796c8dcSSimon Schubert 
1735796c8dcSSimon Schubert       if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
1745796c8dcSSimon Schubert 	f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0,
1755796c8dcSSimon Schubert 				     arrayprint_recurse_level);
1765796c8dcSSimon Schubert 
1775796c8dcSSimon Schubert       lower_bound = f77_get_lowerbound (type);
1785796c8dcSSimon Schubert       if (lower_bound != 1)	/* Not the default.  */
1795796c8dcSSimon Schubert 	fprintf_filtered (stream, "%d:", lower_bound);
1805796c8dcSSimon Schubert 
1815796c8dcSSimon Schubert       /* Make sure that, if we have an assumed size array, we
182c50c785cSJohn Marino          print out a warning and print the upperbound as '*'.  */
1835796c8dcSSimon Schubert 
1845796c8dcSSimon Schubert       if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
1855796c8dcSSimon Schubert 	fprintf_filtered (stream, "*");
1865796c8dcSSimon Schubert       else
1875796c8dcSSimon Schubert 	{
1885796c8dcSSimon Schubert 	  upper_bound = f77_get_upperbound (type);
1895796c8dcSSimon Schubert 	  fprintf_filtered (stream, "%d", upper_bound);
1905796c8dcSSimon Schubert 	}
1915796c8dcSSimon Schubert 
1925796c8dcSSimon Schubert       if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
1935796c8dcSSimon Schubert 	f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0,
1945796c8dcSSimon Schubert 				     arrayprint_recurse_level);
1955796c8dcSSimon Schubert       if (arrayprint_recurse_level == 1)
1965796c8dcSSimon Schubert 	fprintf_filtered (stream, ")");
1975796c8dcSSimon Schubert       else
1985796c8dcSSimon Schubert 	fprintf_filtered (stream, ",");
1995796c8dcSSimon Schubert       arrayprint_recurse_level--;
2005796c8dcSSimon Schubert       break;
2015796c8dcSSimon Schubert 
2025796c8dcSSimon Schubert     case TYPE_CODE_PTR:
2035796c8dcSSimon Schubert     case TYPE_CODE_REF:
2045796c8dcSSimon Schubert       f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0,
2055796c8dcSSimon Schubert 				   arrayprint_recurse_level);
2065796c8dcSSimon Schubert       fprintf_filtered (stream, ")");
2075796c8dcSSimon Schubert       break;
2085796c8dcSSimon Schubert 
2095796c8dcSSimon Schubert     case TYPE_CODE_FUNC:
2105796c8dcSSimon Schubert       f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
2115796c8dcSSimon Schubert 				   passed_a_ptr, 0, arrayprint_recurse_level);
2125796c8dcSSimon Schubert       if (passed_a_ptr)
2135796c8dcSSimon Schubert 	fprintf_filtered (stream, ")");
2145796c8dcSSimon Schubert 
2155796c8dcSSimon Schubert       fprintf_filtered (stream, "()");
2165796c8dcSSimon Schubert       break;
2175796c8dcSSimon Schubert 
2185796c8dcSSimon Schubert     case TYPE_CODE_UNDEF:
2195796c8dcSSimon Schubert     case TYPE_CODE_STRUCT:
2205796c8dcSSimon Schubert     case TYPE_CODE_UNION:
2215796c8dcSSimon Schubert     case TYPE_CODE_ENUM:
2225796c8dcSSimon Schubert     case TYPE_CODE_INT:
2235796c8dcSSimon Schubert     case TYPE_CODE_FLT:
2245796c8dcSSimon Schubert     case TYPE_CODE_VOID:
2255796c8dcSSimon Schubert     case TYPE_CODE_ERROR:
2265796c8dcSSimon Schubert     case TYPE_CODE_CHAR:
2275796c8dcSSimon Schubert     case TYPE_CODE_BOOL:
2285796c8dcSSimon Schubert     case TYPE_CODE_SET:
2295796c8dcSSimon Schubert     case TYPE_CODE_RANGE:
2305796c8dcSSimon Schubert     case TYPE_CODE_STRING:
2315796c8dcSSimon Schubert     case TYPE_CODE_METHOD:
2325796c8dcSSimon Schubert     case TYPE_CODE_COMPLEX:
2335796c8dcSSimon Schubert     case TYPE_CODE_TYPEDEF:
2345796c8dcSSimon Schubert       /* These types do not need a suffix.  They are listed so that
2355796c8dcSSimon Schubert          gcc -Wall will report types that may not have been considered.  */
2365796c8dcSSimon Schubert       break;
2375796c8dcSSimon Schubert     }
2385796c8dcSSimon Schubert }
2395796c8dcSSimon Schubert 
2405796c8dcSSimon Schubert /* Print the name of the type (or the ultimate pointer target,
2415796c8dcSSimon Schubert    function value or array element), or the description of a
2425796c8dcSSimon Schubert    structure or union.
2435796c8dcSSimon Schubert 
2445796c8dcSSimon Schubert    SHOW nonzero means don't print this type as just its name;
2455796c8dcSSimon Schubert    show its real definition even if it has a name.
2465796c8dcSSimon Schubert    SHOW zero means print just typename or struct tag if there is one
2475796c8dcSSimon Schubert    SHOW negative means abbreviate structure elements.
2485796c8dcSSimon Schubert    SHOW is decremented for printing of structure elements.
2495796c8dcSSimon Schubert 
2505796c8dcSSimon Schubert    LEVEL is the depth to indent by.
2515796c8dcSSimon Schubert    We increase it for some recursive calls.  */
2525796c8dcSSimon Schubert 
2535796c8dcSSimon Schubert void
f_type_print_base(struct type * type,struct ui_file * stream,int show,int level)2545796c8dcSSimon Schubert f_type_print_base (struct type *type, struct ui_file *stream, int show,
2555796c8dcSSimon Schubert 		   int level)
2565796c8dcSSimon Schubert {
2575796c8dcSSimon Schubert   int upper_bound;
2585796c8dcSSimon Schubert   int index;
2595796c8dcSSimon Schubert 
2605796c8dcSSimon Schubert   QUIT;
2615796c8dcSSimon Schubert 
2625796c8dcSSimon Schubert   wrap_here ("    ");
2635796c8dcSSimon Schubert   if (type == NULL)
2645796c8dcSSimon Schubert     {
2655796c8dcSSimon Schubert       fputs_filtered ("<type unknown>", stream);
2665796c8dcSSimon Schubert       return;
2675796c8dcSSimon Schubert     }
2685796c8dcSSimon Schubert 
2695796c8dcSSimon Schubert   /* When SHOW is zero or less, and there is a valid type name, then always
2705796c8dcSSimon Schubert      just print the type name directly from the type.  */
2715796c8dcSSimon Schubert 
2725796c8dcSSimon Schubert   if ((show <= 0) && (TYPE_NAME (type) != NULL))
2735796c8dcSSimon Schubert     {
2745796c8dcSSimon Schubert       fputs_filtered (TYPE_NAME (type), stream);
2755796c8dcSSimon Schubert       return;
2765796c8dcSSimon Schubert     }
2775796c8dcSSimon Schubert 
2785796c8dcSSimon Schubert   if (TYPE_CODE (type) != TYPE_CODE_TYPEDEF)
2795796c8dcSSimon Schubert     CHECK_TYPEDEF (type);
2805796c8dcSSimon Schubert 
2815796c8dcSSimon Schubert   switch (TYPE_CODE (type))
2825796c8dcSSimon Schubert     {
2835796c8dcSSimon Schubert     case TYPE_CODE_TYPEDEF:
2845796c8dcSSimon Schubert       f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
2855796c8dcSSimon Schubert       break;
2865796c8dcSSimon Schubert 
2875796c8dcSSimon Schubert     case TYPE_CODE_ARRAY:
2885796c8dcSSimon Schubert     case TYPE_CODE_FUNC:
2895796c8dcSSimon Schubert       f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
2905796c8dcSSimon Schubert       break;
2915796c8dcSSimon Schubert 
2925796c8dcSSimon Schubert     case TYPE_CODE_PTR:
2935796c8dcSSimon Schubert       fprintf_filtered (stream, "PTR TO -> ( ");
2945796c8dcSSimon Schubert       f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
2955796c8dcSSimon Schubert       break;
2965796c8dcSSimon Schubert 
2975796c8dcSSimon Schubert     case TYPE_CODE_REF:
2985796c8dcSSimon Schubert       fprintf_filtered (stream, "REF TO -> ( ");
2995796c8dcSSimon Schubert       f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
3005796c8dcSSimon Schubert       break;
3015796c8dcSSimon Schubert 
3025796c8dcSSimon Schubert     case TYPE_CODE_VOID:
3035796c8dcSSimon Schubert       fprintfi_filtered (level, stream, "VOID");
3045796c8dcSSimon Schubert       break;
3055796c8dcSSimon Schubert 
3065796c8dcSSimon Schubert     case TYPE_CODE_UNDEF:
3075796c8dcSSimon Schubert       fprintfi_filtered (level, stream, "struct <unknown>");
3085796c8dcSSimon Schubert       break;
3095796c8dcSSimon Schubert 
3105796c8dcSSimon Schubert     case TYPE_CODE_ERROR:
311cf7f2e2dSJohn Marino       fprintfi_filtered (level, stream, "%s", TYPE_ERROR_NAME (type));
3125796c8dcSSimon Schubert       break;
3135796c8dcSSimon Schubert 
3145796c8dcSSimon Schubert     case TYPE_CODE_RANGE:
315c50c785cSJohn Marino       /* This should not occur.  */
3165796c8dcSSimon Schubert       fprintfi_filtered (level, stream, "<range type>");
3175796c8dcSSimon Schubert       break;
3185796c8dcSSimon Schubert 
3195796c8dcSSimon Schubert     case TYPE_CODE_CHAR:
3205796c8dcSSimon Schubert     case TYPE_CODE_INT:
3215796c8dcSSimon Schubert       /* There may be some character types that attempt to come
3225796c8dcSSimon Schubert          through as TYPE_CODE_INT since dbxstclass.h is so
3235796c8dcSSimon Schubert          C-oriented, we must change these to "character" from "char".  */
3245796c8dcSSimon Schubert 
3255796c8dcSSimon Schubert       if (strcmp (TYPE_NAME (type), "char") == 0)
3265796c8dcSSimon Schubert 	fprintfi_filtered (level, stream, "character");
3275796c8dcSSimon Schubert       else
3285796c8dcSSimon Schubert 	goto default_case;
3295796c8dcSSimon Schubert       break;
3305796c8dcSSimon Schubert 
3315796c8dcSSimon Schubert     case TYPE_CODE_STRING:
3325796c8dcSSimon Schubert       /* Strings may have dynamic upperbounds (lengths) like arrays.  */
3335796c8dcSSimon Schubert 
3345796c8dcSSimon Schubert       if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
3355796c8dcSSimon Schubert 	fprintfi_filtered (level, stream, "character*(*)");
3365796c8dcSSimon Schubert       else
3375796c8dcSSimon Schubert 	{
3385796c8dcSSimon Schubert 	  upper_bound = f77_get_upperbound (type);
3395796c8dcSSimon Schubert 	  fprintf_filtered (stream, "character*%d", upper_bound);
3405796c8dcSSimon Schubert 	}
3415796c8dcSSimon Schubert       break;
3425796c8dcSSimon Schubert 
3435796c8dcSSimon Schubert     case TYPE_CODE_STRUCT:
3445796c8dcSSimon Schubert     case TYPE_CODE_UNION:
3455796c8dcSSimon Schubert       if (TYPE_CODE (type) == TYPE_CODE_UNION)
3465796c8dcSSimon Schubert 	fprintfi_filtered (level, stream, "Type, C_Union :: ");
3475796c8dcSSimon Schubert       else
3485796c8dcSSimon Schubert 	fprintfi_filtered (level, stream, "Type ");
3495796c8dcSSimon Schubert       fputs_filtered (TYPE_TAG_NAME (type), stream);
3505796c8dcSSimon Schubert       fputs_filtered ("\n", stream);
3515796c8dcSSimon Schubert       for (index = 0; index < TYPE_NFIELDS (type); index++)
3525796c8dcSSimon Schubert 	{
3535796c8dcSSimon Schubert 	  f_type_print_base (TYPE_FIELD_TYPE (type, index), stream, show,
3545796c8dcSSimon Schubert 			     level + 4);
3555796c8dcSSimon Schubert 	  fputs_filtered (" :: ", stream);
3565796c8dcSSimon Schubert 	  fputs_filtered (TYPE_FIELD_NAME (type, index), stream);
3575796c8dcSSimon Schubert 	  f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index),
3585796c8dcSSimon Schubert 				       stream, 0, 0, 0, 0);
3595796c8dcSSimon Schubert 	  fputs_filtered ("\n", stream);
3605796c8dcSSimon Schubert 	}
3615796c8dcSSimon Schubert       fprintfi_filtered (level, stream, "End Type ");
3625796c8dcSSimon Schubert       fputs_filtered (TYPE_TAG_NAME (type), stream);
3635796c8dcSSimon Schubert       break;
3645796c8dcSSimon Schubert 
365cf7f2e2dSJohn Marino     case TYPE_CODE_MODULE:
366cf7f2e2dSJohn Marino       fprintfi_filtered (level, stream, "module %s", TYPE_TAG_NAME (type));
367cf7f2e2dSJohn Marino       break;
368cf7f2e2dSJohn Marino 
3695796c8dcSSimon Schubert     default_case:
3705796c8dcSSimon Schubert     default:
3715796c8dcSSimon Schubert       /* Handle types not explicitly handled by the other cases,
3725796c8dcSSimon Schubert          such as fundamental types.  For these, just print whatever
3735796c8dcSSimon Schubert          the type name is, as recorded in the type itself.  If there
3745796c8dcSSimon Schubert          is no type name, then complain.  */
3755796c8dcSSimon Schubert       if (TYPE_NAME (type) != NULL)
3765796c8dcSSimon Schubert 	fprintfi_filtered (level, stream, "%s", TYPE_NAME (type));
3775796c8dcSSimon Schubert       else
3785796c8dcSSimon Schubert 	error (_("Invalid type code (%d) in symbol table."), TYPE_CODE (type));
3795796c8dcSSimon Schubert       break;
3805796c8dcSSimon Schubert     }
3815796c8dcSSimon Schubert }
382