1 /* Print values for GNU debugger gdb.
2 Copyright (C) 1986, 1988 Free Software Foundation, Inc.
4 GDB is distributed in the hope that it will be useful, but WITHOUT ANY
5 WARRANTY. No author or distributor accepts responsibility to anyone
6 for the consequences of using it or for whether it serves any
7 particular purpose or works at all, unless he says so in writing.
8 Refer to the GDB General Public License for full details.
10 Everyone is granted permission to copy, modify and redistribute GDB,
11 but only under the conditions described in the GDB General Public
12 License. A copy of this license is supposed to have been given to you
13 along with GDB so you can know your rights and responsibilities. It
14 should be in a file named COPYING. Among other things, the copyright
15 notice and this notice must be preserved on all copies.
17 In other words, go ahead and share GDB, but don't try to stop
18 anyone else from sharing it farther. Help stamp out software hoarding!
23 #include "initialize.h"
28 /* Maximum number of chars to print for a string pointer value
29 or vector contents. */
33 static void type_print_varspec_suffix ();
34 static void type_print_varspec_prefix ();
35 static void type_print_base ();
36 static void type_print_method_args ();
40 char **unsigned_type_table
;
41 char **signed_type_table
;
42 char **float_type_table
;
44 /* Print the value VAL in C-ish syntax on stream STREAM.
45 FORMAT is a format-letter, or 0 for print in natural format of data type.
46 If the object printed is a string pointer, returns
47 the number of string bytes printed. */
49 value_print (val
, stream
, format
)
54 register int i
, n
, typelen
;
56 /* A "repeated" value really contains several values in a row.
57 They are made by the @ operator.
58 Print such values as if they were arrays. */
60 if (VALUE_REPEATED (val
))
62 n
= VALUE_REPETITIONS (val
);
63 typelen
= TYPE_LENGTH (VALUE_TYPE (val
));
65 /* Print arrays of characters using string syntax. */
66 if (typelen
== 1 && TYPE_CODE (VALUE_TYPE (val
)) == TYPE_CODE_INT
70 for (i
= 0; i
< n
&& i
< print_max
; i
++)
73 printchar (VALUE_CONTENTS (val
)[i
], stream
, '"');
76 fprintf (stream
, "...");
81 for (i
= 0; i
< n
&& i
< print_max
; i
++)
84 fprintf (stream
, ", ");
85 val_print (VALUE_TYPE (val
), VALUE_CONTENTS (val
) + typelen
* i
,
86 VALUE_ADDRESS (val
) + typelen
* i
, stream
, format
, 1);
89 fprintf (stream
, "...");
95 /* A simple (nonrepeated) value */
96 /* If it is a pointer, indicate what it points to.
98 C++: print type also if it is a reference.
100 If it is a member pointer, we will take care
101 of that when we print it. */
102 if (TYPE_CODE (VALUE_TYPE (val
)) == TYPE_CODE_PTR
103 || TYPE_CODE (VALUE_TYPE (val
)) == TYPE_CODE_REF
)
105 fprintf (stream
, "(");
106 type_print (VALUE_TYPE (val
), "", stream
, -1);
107 fprintf (stream
, ") ");
109 return val_print (VALUE_TYPE (val
), VALUE_CONTENTS (val
),
110 VALUE_ADDRESS (val
), stream
, format
, 1);
114 /* Print data of type TYPE located at VALADDR (within GDB),
115 which came from the inferior at address ADDRESS,
116 onto stdio stream STREAM according to FORMAT
117 (a letter or 0 for natural format).
119 If the data are a string pointer, returns the number of
120 sting characters printed.
122 If DEREF_REF is nonzero, then dereference references,
123 otherwise just print them like pointers. */
126 val_print (type
, valaddr
, address
, stream
, format
, deref_ref
)
135 int len
, n_baseclasses
;
136 struct type
*elttype
;
143 switch (TYPE_CODE (type
))
145 case TYPE_CODE_ARRAY
:
146 if (TYPE_LENGTH (type
) >= 0)
148 elttype
= TYPE_TARGET_TYPE (type
);
149 eltlen
= TYPE_LENGTH (elttype
);
150 len
= TYPE_LENGTH (type
) / eltlen
;
151 fprintf (stream
, "{");
152 /* For an array of chars, print with string syntax. */
153 if (eltlen
== 1 && TYPE_CODE (elttype
) == TYPE_CODE_INT
157 for (i
= 0; i
< len
&& i
< print_max
; i
++)
160 printchar (valaddr
[i
], stream
, '"');
163 fprintf (stream
, "...");
168 for (i
= 0; i
< len
&& i
< print_max
; i
++)
170 if (i
) fprintf (stream
, ", ");
171 val_print (elttype
, valaddr
+ i
* eltlen
,
172 0, stream
, format
, deref_ref
);
175 fprintf (stream
, "...");
177 fprintf (stream
, "}");
180 /* Array of unspecified length: treat like pointer. */
185 print_scalar_formatted (valaddr
, type
, format
, 0, stream
);
188 if (TYPE_CODE (TYPE_TARGET_TYPE (type
)) == TYPE_CODE_MEMBER
)
190 struct type
*domain
= TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (type
));
191 struct type
*target
= TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (type
));
196 val
= unpack_long (builtin_type_int
, valaddr
);
197 if (TYPE_CODE (target
) == TYPE_CODE_FUNC
)
201 len
= TYPE_NFN_FIELDS (domain
);
202 for (i
= 0; i
< len
; i
++)
204 f
= TYPE_FN_FIELDLIST1 (domain
, i
);
205 len2
= TYPE_FN_FIELDLIST_LENGTH (domain
, i
);
207 for (j
= 0; j
< len2
; j
++)
210 if (TYPE_FN_FIELD_VOFFSET (f
, j
) == val
)
220 struct symbol
*sym
= find_pc_function (val
);
222 error ("invalid pointer to member function");
223 len
= TYPE_NFN_FIELDS (domain
);
224 for (i
= 0; i
< len
; i
++)
226 f
= TYPE_FN_FIELDLIST1 (domain
, i
);
227 len2
= TYPE_FN_FIELDLIST_LENGTH (domain
, i
);
229 for (j
= 0; j
< len2
; j
++)
232 if (!strcmp (SYMBOL_NAME (sym
), TYPE_FN_FIELD_PHYSNAME (f
, j
)))
241 type_print_varspec_prefix (TYPE_FN_FIELD_TYPE (f
, j
), stream
, 0, 0);
242 fprintf (stream
, kind
);
243 if (TYPE_FN_FIELD_PHYSNAME (f
, j
)[0] == '_'
244 && TYPE_FN_FIELD_PHYSNAME (f
, j
)[1] == '$')
245 type_print_method_args
246 (TYPE_FN_FIELD_ARGS (f
, j
) + 1, "~",
247 TYPE_FN_FIELDLIST_NAME (domain
, i
), stream
);
249 type_print_method_args
250 (TYPE_FN_FIELD_ARGS (f
, j
), "",
251 TYPE_FN_FIELDLIST_NAME (domain
, i
), stream
);
257 /* VAL is a byte offset into the structure type DOMAIN.
258 Find the name of the field for that offset and
262 len
= TYPE_NFIELDS (domain
);
263 val
<<= 3; /* @@ Make VAL into bit offset */
264 for (i
= 0; i
< len
; i
++)
266 int bitpos
= TYPE_FIELD_BITPOS (domain
, i
);
270 if (val
< bitpos
&& i
> 0)
272 int ptrsize
= (TYPE_LENGTH (builtin_type_char
) * TYPE_LENGTH (target
));
273 /* Somehow pointing into a field. */
275 extra
= (val
- TYPE_FIELD_BITPOS (domain
, i
));
286 type_print_base (domain
, stream
, 0, 0);
287 fprintf (stream
, "::");
288 fprintf (stream
, "%s", TYPE_FIELD_NAME (domain
, i
));
290 fprintf (stream
, " + %d bytes", extra
);
292 fprintf (stream
, " (offset in bits)");
297 type_print (type
, "", stream
, -1);
298 fprintf (stream
, ") %d", val
>> 3);
302 fprintf (stream
, "0x%x", * (int *) valaddr
);
303 /* For a pointer to char or unsigned char,
304 also print the string pointed to, unless pointer is null. */
306 /* For an array of chars, print with string syntax. */
307 elttype
= TYPE_TARGET_TYPE (type
);
308 if (TYPE_LENGTH (elttype
) == 1 && TYPE_CODE (elttype
) == TYPE_CODE_INT
310 && unpack_long (type
, valaddr
) != 0)
314 for (i
= 0; i
< print_max
; i
++)
317 read_memory (unpack_long (type
, valaddr
) + i
, &c
, 1);
320 printchar (c
, stream
, '"');
324 fprintf (stream
, "...");
326 /* Return number of characters printed, plus one for the
327 terminating null if we have "reached the end". */
328 return i
+ (i
!= print_max
);
333 case TYPE_CODE_MEMBER
:
334 error ("not implemented: member type in val_print");
338 fprintf (stream
, "0x%x", * (int *) valaddr
);
339 /* De-reference the reference. */
341 if (TYPE_CODE (TYPE_TARGET_TYPE (type
)) != TYPE_CODE_UNDEF
)
343 value val
= value_at (TYPE_TARGET_TYPE (type
), * (int *)valaddr
);
344 fprintf (stream
, " = ");
345 val_print (VALUE_TYPE (val
), VALUE_CONTENTS (val
),
346 VALUE_ADDRESS (val
), stream
, format
, deref_ref
);
349 fprintf (stream
, " = ???");
352 case TYPE_CODE_STRUCT
:
353 case TYPE_CODE_UNION
:
354 fprintf (stream
, "{");
355 len
= TYPE_NFIELDS (type
);
356 n_baseclasses
= TYPE_N_BASECLASSES (type
);
357 for (i
= 1; i
<= n_baseclasses
; i
++)
359 fprintf (stream
, "\n<%s> = ", TYPE_NAME (TYPE_BASECLASS (type
, i
)));
360 val_print (TYPE_FIELD_TYPE (type
, 0),
361 valaddr
+ TYPE_FIELD_BITPOS (type
, i
-1) / 8,
364 if (i
> 1) fprintf (stream
, "\nmembers of %s: ", TYPE_NAME (type
));
365 for (i
-= 1; i
< len
; i
++)
367 if (i
> n_baseclasses
) fprintf (stream
, ", ");
368 fprintf (stream
, "%s = ", TYPE_FIELD_NAME (type
, i
));
369 /* check if static field */
370 if (TYPE_FIELD_STATIC (type
, i
))
374 v
= value_static_field (type
, TYPE_FIELD_NAME (type
, i
), i
);
375 val_print (TYPE_FIELD_TYPE (type
, i
),
376 VALUE_CONTENTS (v
), 0, stream
, format
, deref_ref
);
378 else if (TYPE_FIELD_PACKED (type
, i
))
380 val
= unpack_field_as_long (type
, valaddr
, i
);
381 val_print (TYPE_FIELD_TYPE (type
, i
), &val
, 0, stream
, format
, deref_ref
);
384 val_print (TYPE_FIELD_TYPE (type
, i
),
385 valaddr
+ TYPE_FIELD_BITPOS (type
, i
) / 8,
386 0, stream
, format
, deref_ref
);
388 fprintf (stream
, "}");
394 print_scalar_formatted (valaddr
, type
, format
, 0, stream
);
397 len
= TYPE_NFIELDS (type
);
398 val
= unpack_long (builtin_type_int
, valaddr
);
399 for (i
= 0; i
< len
; i
++)
402 if (val
== TYPE_FIELD_VALUE (type
, i
))
406 fprintf (stream
, "%s", TYPE_FIELD_NAME (type
, i
));
408 fprintf (stream
, "%d", val
);
414 print_scalar_formatted (valaddr
, type
, format
, 0, stream
);
417 fprintf (stream
, "{");
418 type_print (type
, "", stream
, -1);
419 fprintf (stream
, "} ");
420 fprintf (stream
, "0x%x", address
);
426 print_scalar_formatted (valaddr
, type
, format
, 0, stream
);
430 TYPE_UNSIGNED (type
) ? "%u" : "%d",
431 unpack_long (type
, valaddr
));
432 if (TYPE_LENGTH (type
) == 1)
434 fprintf (stream
, " '");
435 printchar (unpack_long (type
, valaddr
), stream
, '\'');
436 fputc ('\'', stream
);
443 print_scalar_formatted (valaddr
, type
, format
, 0, stream
);
447 if (is_nan (unpack_double (type
, valaddr
)))
449 fprintf (stream
, "Nan");
453 fprintf (stream
, "%g", unpack_double (type
, valaddr
));
457 fprintf (stream
, "void");
461 error ("Invalid type code in symbol table.");
473 /* Nonzero if ARG (a double) is a NAN. */
479 int lowhalf
, highhalf
;
480 union { int i
; char c
; } test
;
482 /* Separate the high and low words of the double.
483 Distinguish big and little-endian machines. */
486 /* Big-endian machine */
487 lowhalf
= arg
.i
[1], highhalf
= arg
.i
[0];
489 lowhalf
= arg
.i
[0], highhalf
= arg
.i
[1];
491 /* Nan: exponent is the maximum possible, and fraction is nonzero. */
492 return (((highhalf
>>20) & 0x7ff) == 0x7ff
494 ! ((highhalf
& 0xfffff == 0) && (lowhalf
== 0)));
498 /* Print a description of a type TYPE
499 in the form of a declaration of a variable named VARSTRING.
500 Output goes to STREAM (via stdio).
501 If SHOW is positive, we show the contents of the outermost level
502 of structure even if there is a type name that could be used instead.
503 If SHOW is negative, we never show the details of elements' types. */
505 type_print (type
, varstring
, stream
, show
)
511 type_print_1 (type
, varstring
, stream
, show
, 0);
514 /* LEVEL is the depth to indent lines by. */
516 type_print_1 (type
, varstring
, stream
, show
, level
)
523 register enum type_code code
;
524 type_print_base (type
, stream
, show
, level
);
525 code
= TYPE_CODE (type
);
526 if ((varstring
&& *varstring
)
528 /* Need a space if going to print stars or brackets;
529 but not if we will print just a type name. */
530 ((show
> 0 || TYPE_NAME (type
) == 0)
532 (code
== TYPE_CODE_PTR
|| code
== TYPE_CODE_FUNC
533 || code
== TYPE_CODE_ARRAY
534 || code
== TYPE_CODE_MEMBER
535 || code
== TYPE_CODE_REF
)))
536 fprintf (stream
, " ");
537 type_print_varspec_prefix (type
, stream
, show
, 0);
538 fprintf (stream
, "%s", varstring
);
539 type_print_varspec_suffix (type
, stream
, show
, 0);
542 /* Print the method arguments ARGS to the file STREAM. */
544 type_print_method_args (args
, prefix
, varstring
, stream
)
546 char *prefix
, *varstring
;
551 fprintf (stream
, " %s%s (", prefix
, varstring
);
552 if (args
[1] && args
[1]->code
!= TYPE_CODE_VOID
)
554 i
= 1; /* skip the class variable */
557 type_print (args
[i
++], "", stream
, 0);
560 fprintf (stream
, " ...");
563 else if (args
[i
]->code
!= TYPE_CODE_VOID
)
565 fprintf (stream
, ", ");
570 fprintf (stream
, ")");
573 /* If TYPE is a derived type, then print out derivation
574 information. Print out all layers of the type heirarchy
575 until we encounter one with multiple inheritance.
576 At that point, print out that ply, and return. */
578 type_print_derivation_info (stream
, type
)
583 int i
, n_baseclasses
= TYPE_N_BASECLASSES (type
);
584 struct type
*basetype
= 0;
586 while (type
&& n_baseclasses
== 1)
588 basetype
= TYPE_BASECLASS (type
, 1);
589 if (TYPE_NAME (basetype
) && (name
= TYPE_NAME (basetype
)))
591 while (*name
!= ' ') name
++;
592 fprintf (stream
, ": %s%s %s ",
593 TYPE_VIA_PUBLIC (basetype
) ? "public" : "private",
594 TYPE_VIA_VIRTUAL (basetype
) ? " virtual" : "",
597 n_baseclasses
= TYPE_N_BASECLASSES (basetype
);
603 if (n_baseclasses
!= 0)
604 fprintf (stream
, ": ");
605 for (i
= 1; i
<= n_baseclasses
; i
++)
607 basetype
= TYPE_BASECLASS (type
, i
);
608 if (TYPE_NAME (basetype
) && (name
= TYPE_NAME (basetype
)))
610 while (*name
!= ' ') name
++;
611 fprintf (stream
, "%s%s %s",
612 TYPE_VIA_PUBLIC (basetype
) ? "public" : "private",
613 TYPE_VIA_VIRTUAL (basetype
) ? " virtual" : "",
616 if (i
< n_baseclasses
)
617 fprintf (stream
, ", ");
623 /* Print any asterisks or open-parentheses needed before the
624 variable name (to describe its type).
626 On outermost call, pass 0 for PASSED_A_PTR.
627 On outermost call, SHOW > 0 means should ignore
628 any typename for TYPE and show its details.
629 SHOW is always zero on recursive calls. */
632 type_print_varspec_prefix (type
, stream
, show
, passed_a_ptr
)
641 if (TYPE_NAME (type
) && show
<= 0)
646 switch (TYPE_CODE (type
))
649 type_print_varspec_prefix (TYPE_TARGET_TYPE (type
), stream
, 0, 1);
653 case TYPE_CODE_MEMBER
:
654 type_print_varspec_prefix (TYPE_TARGET_TYPE (type
), stream
, 0,
657 type_print_base (TYPE_DOMAIN_TYPE (type
), stream
, 0,
659 fprintf (stream
, "::");
663 type_print_varspec_prefix (TYPE_TARGET_TYPE (type
), stream
, 0, 1);
668 case TYPE_CODE_ARRAY
:
669 type_print_varspec_prefix (TYPE_TARGET_TYPE (type
), stream
, 0, 0);
676 /* Print any array sizes, function arguments or close parentheses
677 needed after the variable name (to describe its type).
678 Args work like type_print_varspec_prefix. */
681 type_print_varspec_suffix (type
, stream
, show
, passed_a_ptr
)
690 if (TYPE_NAME (type
) && show
<= 0)
695 switch (TYPE_CODE (type
))
697 case TYPE_CODE_ARRAY
:
698 type_print_varspec_suffix (TYPE_TARGET_TYPE (type
), stream
, 0, 0);
700 fprintf (stream
, ")");
701 fprintf (stream
, "[");
702 if (TYPE_LENGTH (type
) >= 0)
703 fprintf (stream
, "%d",
704 TYPE_LENGTH (type
) / TYPE_LENGTH (TYPE_TARGET_TYPE (type
)));
705 fprintf (stream
, "]");
708 case TYPE_CODE_MEMBER
:
711 type_print_varspec_suffix (TYPE_TARGET_TYPE (type
), stream
, 0, 0);
716 type_print_varspec_suffix (TYPE_TARGET_TYPE (type
), stream
, 0, 1);
720 type_print_varspec_suffix (TYPE_TARGET_TYPE (type
), stream
, 0, 0);
722 fprintf (stream
, ")");
723 fprintf (stream
, "()");
728 /* Print the name of the type (or the ultimate pointer target,
729 function value or array element), or the description of a
732 SHOW nonzero means don't print this type as just its name;
733 show its real definition even if it has a name.
734 SHOW zero means print just typename or struct tag if there is one
735 SHOW negative means abbreviate structure elements.
736 SHOW is decremented for printing of structure elements.
738 LEVEL is the depth to indent by.
739 We increase it for some recursive calls. */
742 type_print_base (type
, stream
, show
, level
)
751 register int lastval
;
757 fprintf (stream
, "type unknown");
761 if (TYPE_NAME (type
) && show
<= 0)
763 fprintf (stream
, TYPE_NAME (type
));
767 switch (TYPE_CODE (type
))
769 case TYPE_CODE_ARRAY
:
771 case TYPE_CODE_MEMBER
:
774 type_print_base (TYPE_TARGET_TYPE (type
), stream
, show
, level
);
777 case TYPE_CODE_STRUCT
:
778 fprintf (stream
, "struct ");
781 case TYPE_CODE_UNION
:
782 fprintf (stream
, "union ");
784 if (TYPE_NAME (type
) && (name
= TYPE_NAME (type
)))
786 while (*name
!= ' ') name
++;
787 fprintf (stream
, "%s ", name
+ 1);
790 fprintf (stream
, "{...}");
795 type_print_derivation_info (stream
, type
);
797 fprintf (stream
, "{");
798 len
= TYPE_NFIELDS (type
);
799 if (len
) fprintf (stream
, "\n");
800 else fprintf (stream
, "<no data fields>\n");
802 for (i
= TYPE_N_BASECLASSES (type
); i
< len
; i
++)
805 /* Don't print out virtual function table. */
806 if (! strncmp (TYPE_FIELD_NAME (type
, i
),
810 print_spaces (level
+ 4, stream
);
812 /* If this is a bit-field and there is a gap before it,
813 print a nameless field to account for the gap. */
815 if (TYPE_FIELD_PACKED (type
, i
))
817 int gap
= (TYPE_FIELD_BITPOS (type
, i
)
819 ? (TYPE_FIELD_BITPOS (type
, i
- 1)
820 + (TYPE_FIELD_PACKED (type
, i
- 1)
821 ? TYPE_FIELD_BITSIZE (type
, i
- 1)
822 : TYPE_LENGTH (TYPE_FIELD_TYPE (type
, i
- 1)) * 8))
826 fprintf (stream
, "int : %d;\n", gap
);
827 print_spaces (level
+ 4, stream
);
831 /* Print the declaration of this field. */
833 if (TYPE_FIELD_STATIC (type
, i
))
835 fprintf (stream
, "static ");
837 type_print_1 (TYPE_FIELD_TYPE (type
, i
),
838 TYPE_FIELD_NAME (type
, i
),
839 stream
, show
- 1, level
+ 4);
841 /* Print the field width. */
843 if (TYPE_FIELD_PACKED (type
, i
))
844 fprintf (stream
, " : %d", TYPE_FIELD_BITSIZE (type
, i
));
846 fprintf (stream
, ";\n");
849 /* C++: print out the methods */
850 len
= TYPE_NFN_FIELDS (type
);
851 if (len
) fprintf (stream
, "\n");
852 for (i
= 0; i
< len
; i
++)
854 struct fn_field
*f
= TYPE_FN_FIELDLIST1 (type
, i
);
855 int j
, len2
= TYPE_FN_FIELDLIST_LENGTH (type
, i
);
857 for (j
= 0; j
< len2
; j
++)
860 print_spaces (level
+ 4, stream
);
861 if (TYPE_FN_FIELD_VIRTUAL_P (f
, j
))
862 fprintf (stream
, "virtual ");
863 type_print (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f
, j
))), "", stream
, 0);
864 if (TYPE_FN_FIELD_PHYSNAME (f
, j
)[0] == '_'
865 && TYPE_FN_FIELD_PHYSNAME (f
, j
)[1] == '$')
866 type_print_method_args
867 (TYPE_FN_FIELD_ARGS (f
, j
) + 1, "~",
868 TYPE_FN_FIELDLIST_NAME (type
, i
), stream
);
870 type_print_method_args
871 (TYPE_FN_FIELD_ARGS (f
, j
), "",
872 TYPE_FN_FIELDLIST_NAME (type
, i
), stream
);
874 fprintf (stream
, ";\n");
876 if (len2
) fprintf (stream
, "\n");
879 print_spaces (level
, stream
);
885 fprintf (stream
, "enum ");
886 if (TYPE_NAME (type
))
888 name
= TYPE_NAME (type
);
889 while (*name
!= ' ') name
++;
890 fprintf (stream
, "%s ", name
+ 1);
893 fprintf (stream
, "{...}");
896 fprintf (stream
, "{");
897 len
= TYPE_NFIELDS (type
);
899 for (i
= 0; i
< len
; i
++)
902 if (i
) fprintf (stream
, ", ");
903 fprintf (stream
, "%s", TYPE_FIELD_NAME (type
, i
));
904 if (lastval
!= TYPE_FIELD_VALUE (type
, i
))
906 fprintf (stream
, " : %d", TYPE_FIELD_VALUE (type
, i
));
907 lastval
= TYPE_FIELD_VALUE (type
, i
);
911 fprintf (stream
, "}");
916 if (TYPE_UNSIGNED (type
))
917 name
= unsigned_type_table
[TYPE_LENGTH (type
)];
919 name
= signed_type_table
[TYPE_LENGTH (type
)];
920 fprintf (stream
, "%s", name
);
924 name
= float_type_table
[TYPE_LENGTH (type
)];
925 fprintf (stream
, "%s", name
);
929 fprintf (stream
, "void");
933 fprintf (stream
, "struct unknown");
937 error ("Invalid type code in symbol table.");
942 set_maximum_command (arg
)
945 if (!arg
) error_no_arg ("value for maximum elements to print");
946 print_max
= atoi (arg
);
952 add_com ("set-maximum", class_vars
, set_maximum_command
,
953 "Set NUMBER as limit on string chars or array elements to print.");
958 = (char **) xmalloc ((1 + sizeof (unsigned long)) * sizeof (char *));
959 bzero (unsigned_type_table
, (1 + sizeof (unsigned long)));
960 unsigned_type_table
[sizeof (unsigned char)] = "unsigned char";
961 unsigned_type_table
[sizeof (unsigned short)] = "unsigned short";
962 unsigned_type_table
[sizeof (unsigned long)] = "unsigned long";
963 unsigned_type_table
[sizeof (unsigned int)] = "unsigned int";
966 = (char **) xmalloc ((1 + sizeof (long)) * sizeof (char *));
967 bzero (signed_type_table
, (1 + sizeof (long)));
968 signed_type_table
[sizeof (char)] = "char";
969 signed_type_table
[sizeof (short)] = "short";
970 signed_type_table
[sizeof (long)] = "long";
971 signed_type_table
[sizeof (int)] = "int";
974 = (char **) xmalloc ((1 + sizeof (double)) * sizeof (char *));
975 bzero (float_type_table
, (1 + sizeof (double)));
976 float_type_table
[sizeof (float)] = "float";
977 float_type_table
[sizeof (double)] = "double";