* valprint.c (val_print): Extend comment.
[deliverable/binutils-gdb.git] / gdb / m2-valprint.c
CommitLineData
c906108c 1/* Support for printing Modula 2 values for GDB, the GNU debugger.
a8d6eb4a 2
6aba47ca 3 Copyright (C) 1986, 1988, 1989, 1991, 1992, 1996, 1998, 2000, 2005, 2006,
7b6bb8da 4 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
c906108c 5
c5aa993b 6 This file is part of GDB.
c906108c 7
c5aa993b
JM
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
a9762ec7 10 the Free Software Foundation; either version 3 of the License, or
c5aa993b 11 (at your option) any later version.
c906108c 12
c5aa993b
JM
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
c906108c 17
c5aa993b 18 You should have received a copy of the GNU General Public License
a9762ec7 19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c906108c
SS
20
21#include "defs.h"
c906108c
SS
22#include "symtab.h"
23#include "gdbtypes.h"
72019c9c
GM
24#include "expression.h"
25#include "value.h"
26#include "valprint.h"
27#include "language.h"
28#include "typeprint.h"
a8d6eb4a 29#include "c-lang.h"
72019c9c
GM
30#include "m2-lang.h"
31#include "target.h"
32
79a45b7d
TT
33static int print_unpacked_pointer (struct type *type,
34 CORE_ADDR address, CORE_ADDR addr,
35 const struct value_print_options *options,
36 struct ui_file *stream);
844781a1
GM
37static void
38m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
39 int embedded_offset, CORE_ADDR address,
79a45b7d 40 struct ui_file *stream, int recurse,
0e03807e 41 const struct value *val,
79a45b7d
TT
42 const struct value_print_options *options,
43 int len);
72019c9c
GM
44
45
46/* Print function pointer with inferior address ADDRESS onto stdio
47 stream STREAM. */
48
49static void
50810684
UW
50print_function_pointer_address (struct gdbarch *gdbarch, CORE_ADDR address,
51 struct ui_file *stream, int addressprint)
72019c9c 52{
50810684 53 CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (gdbarch, address,
72019c9c
GM
54 &current_target);
55
56 /* If the function pointer is represented by a description, print the
57 address of the description. */
58 if (addressprint && func_addr != address)
59 {
60 fputs_filtered ("@", stream);
5af949e3 61 fputs_filtered (paddress (gdbarch, address), stream);
72019c9c
GM
62 fputs_filtered (": ", stream);
63 }
5af949e3 64 print_address_demangle (gdbarch, func_addr, stream, demangle);
72019c9c
GM
65}
66
844781a1
GM
67/* get_long_set_bounds - assigns the bounds of the long set to low and
68 high. */
72019c9c
GM
69
70int
71get_long_set_bounds (struct type *type, LONGEST *low, LONGEST *high)
72{
73 int len, i;
74
75 if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
76 {
77 len = TYPE_NFIELDS (type);
78 i = TYPE_N_BASECLASSES (type);
79 if (len == 0)
80 return 0;
81 *low = TYPE_LOW_BOUND (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, i)));
82 *high = TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type,
83 len-1)));
84 return 1;
85 }
86 error (_("expecting long_set"));
87 return 0;
88}
89
90static void
91m2_print_long_set (struct type *type, const gdb_byte *valaddr,
92 int embedded_offset, CORE_ADDR address,
79a45b7d 93 struct ui_file *stream)
72019c9c
GM
94{
95 int empty_set = 1;
96 int element_seen = 0;
97 LONGEST previous_low = 0;
98 LONGEST previous_high= 0;
99 LONGEST i, low_bound, high_bound;
100 LONGEST field_low, field_high;
101 struct type *range;
102 int len, field;
103 struct type *target;
104 int bitval;
105
106 CHECK_TYPEDEF (type);
107
108 fprintf_filtered (stream, "{");
109 len = TYPE_NFIELDS (type);
110 if (get_long_set_bounds (type, &low_bound, &high_bound))
111 {
112 field = TYPE_N_BASECLASSES (type);
113 range = TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, field));
114 }
115 else
116 {
117 fprintf_filtered (stream, " %s }", _("<unknown bounds of set>"));
118 return;
119 }
120
121 target = TYPE_TARGET_TYPE (range);
72019c9c
GM
122
123 if (get_discrete_bounds (range, &field_low, &field_high) >= 0)
124 {
125 for (i = low_bound; i <= high_bound; i++)
126 {
127 bitval = value_bit_index (TYPE_FIELD_TYPE (type, field),
128 (TYPE_FIELD_BITPOS (type, field) / 8) +
129 valaddr + embedded_offset, i);
130 if (bitval < 0)
131 error (_("bit test is out of range"));
132 else if (bitval > 0)
133 {
134 previous_high = i;
135 if (! element_seen)
136 {
137 if (! empty_set)
138 fprintf_filtered (stream, ", ");
139 print_type_scalar (target, i, stream);
140 empty_set = 0;
141 element_seen = 1;
142 previous_low = i;
143 }
144 }
145 else
146 {
147 /* bit is not set */
148 if (element_seen)
149 {
150 if (previous_low+1 < previous_high)
151 fprintf_filtered (stream, "..");
152 if (previous_low+1 < previous_high)
153 print_type_scalar (target, previous_high, stream);
154 element_seen = 0;
155 }
156 }
157 if (i == field_high)
158 {
159 field++;
160 if (field == len)
161 break;
162 range = TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, field));
163 if (get_discrete_bounds (range, &field_low, &field_high) < 0)
164 break;
165 target = TYPE_TARGET_TYPE (range);
72019c9c
GM
166 }
167 }
168 if (element_seen)
169 {
170 if (previous_low+1 < previous_high)
171 {
172 fprintf_filtered (stream, "..");
173 print_type_scalar (target, previous_high, stream);
174 }
175 element_seen = 0;
176 }
177 fprintf_filtered (stream, "}");
178 }
179}
180
844781a1
GM
181static void
182m2_print_unbounded_array (struct type *type, const gdb_byte *valaddr,
183 int embedded_offset, CORE_ADDR address,
79a45b7d
TT
184 struct ui_file *stream, int recurse,
185 const struct value_print_options *options)
844781a1
GM
186{
187 struct type *content_type;
188 CORE_ADDR addr;
189 LONGEST len;
190 struct value *val;
191
192 CHECK_TYPEDEF (type);
193 content_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0));
194
195 addr = unpack_pointer (TYPE_FIELD_TYPE (type, 0),
196 (TYPE_FIELD_BITPOS (type, 0) / 8) +
197 valaddr + embedded_offset);
198
199 val = value_at_lazy (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0)),
200 addr);
201 len = unpack_field_as_long (type, valaddr + embedded_offset, 1);
202
203 fprintf_filtered (stream, "{");
66d61a4c
PA
204 m2_print_array_contents (value_type (val),
205 value_contents_for_printing (val),
844781a1 206 value_embedded_offset (val), addr, stream,
66d61a4c 207 recurse, val, options, len);
844781a1
GM
208 fprintf_filtered (stream, ", HIGH = %d}", (int) len);
209}
210
79a45b7d 211static int
72019c9c
GM
212print_unpacked_pointer (struct type *type,
213 CORE_ADDR address, CORE_ADDR addr,
79a45b7d
TT
214 const struct value_print_options *options,
215 struct ui_file *stream)
72019c9c 216{
50810684 217 struct gdbarch *gdbarch = get_type_arch (type);
72019c9c
GM
218 struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
219
220 if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
221 {
222 /* Try to print what function it points to. */
50810684
UW
223 print_function_pointer_address (gdbarch, addr, stream,
224 options->addressprint);
72019c9c
GM
225 /* Return value is irrelevant except for string pointers. */
226 return 0;
227 }
228
79a45b7d 229 if (options->addressprint && options->format != 's')
5af949e3 230 fputs_filtered (paddress (gdbarch, address), stream);
72019c9c
GM
231
232 /* For a pointer to char or unsigned char, also print the string
233 pointed to, unless pointer is null. */
234
235 if (TYPE_LENGTH (elttype) == 1
236 && TYPE_CODE (elttype) == TYPE_CODE_INT
79a45b7d 237 && (options->format == 0 || options->format == 's')
72019c9c 238 && addr != 0)
09ca9e2e 239 return val_print_string (TYPE_TARGET_TYPE (type), NULL, addr, -1,
6c7a06a3 240 stream, options);
72019c9c
GM
241
242 return 0;
243}
244
245static void
844781a1
GM
246print_variable_at_address (struct type *type,
247 const gdb_byte *valaddr,
79a45b7d
TT
248 struct ui_file *stream,
249 int recurse,
250 const struct value_print_options *options)
72019c9c 251{
5af949e3 252 struct gdbarch *gdbarch = get_type_arch (type);
72019c9c
GM
253 CORE_ADDR addr = unpack_pointer (type, valaddr);
254 struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
255
256 fprintf_filtered (stream, "[");
5af949e3 257 fputs_filtered (paddress (gdbarch, addr), stream);
72019c9c
GM
258 fprintf_filtered (stream, "] : ");
259
260 if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
261 {
262 struct value *deref_val =
d8631d21 263 value_at (TYPE_TARGET_TYPE (type), unpack_pointer (type, valaddr));
b8d56208 264
79a45b7d 265 common_val_print (deref_val, stream, recurse, options, current_language);
72019c9c
GM
266 }
267 else
268 fputs_filtered ("???", stream);
269}
270
844781a1
GM
271
272/* m2_print_array_contents - prints out the contents of an
273 array up to a max_print values.
274 It prints arrays of char as a string
275 and all other data types as comma
276 separated values. */
277
278static void
279m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
280 int embedded_offset, CORE_ADDR address,
79a45b7d 281 struct ui_file *stream, int recurse,
0e03807e 282 const struct value *val,
79a45b7d
TT
283 const struct value_print_options *options,
284 int len)
844781a1
GM
285{
286 int eltlen;
287 CHECK_TYPEDEF (type);
288
289 if (TYPE_LENGTH (type) > 0)
290 {
291 eltlen = TYPE_LENGTH (type);
79a45b7d 292 if (options->prettyprint_arrays)
844781a1
GM
293 print_spaces_filtered (2 + 2 * recurse, stream);
294 /* For an array of chars, print with string syntax. */
295 if (eltlen == 1 &&
296 ((TYPE_CODE (type) == TYPE_CODE_INT)
297 || ((current_language->la_language == language_m2)
298 && (TYPE_CODE (type) == TYPE_CODE_CHAR)))
79a45b7d 299 && (options->format == 0 || options->format == 's'))
09ca9e2e 300 val_print_string (type, NULL, address, len+1, stream, options);
844781a1
GM
301 else
302 {
303 fprintf_filtered (stream, "{");
490f124f 304 val_print_array_elements (type, valaddr, embedded_offset,
0e03807e
TT
305 address, stream, recurse, val,
306 options, 0);
844781a1
GM
307 fprintf_filtered (stream, "}");
308 }
309 }
310}
311
312
32b72a42
PA
313/* See val_print for a description of the various parameters of this
314 function; they are identical. The semantics of the return value is
315 also identical to val_print. */
c906108c
SS
316
317int
fc1a4b47 318m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
79a45b7d 319 CORE_ADDR address, struct ui_file *stream, int recurse,
0e03807e 320 const struct value *original_value,
79a45b7d 321 const struct value_print_options *options)
c906108c 322{
5af949e3 323 struct gdbarch *gdbarch = get_type_arch (type);
025bb325 324 unsigned int i = 0; /* Number of characters printed. */
72019c9c
GM
325 unsigned len;
326 struct type *elttype;
327 unsigned eltlen;
72019c9c
GM
328 LONGEST val;
329 CORE_ADDR addr;
330
331 CHECK_TYPEDEF (type);
332 switch (TYPE_CODE (type))
333 {
334 case TYPE_CODE_ARRAY:
335 if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
336 {
337 elttype = check_typedef (TYPE_TARGET_TYPE (type));
338 eltlen = TYPE_LENGTH (elttype);
339 len = TYPE_LENGTH (type) / eltlen;
79a45b7d 340 if (options->prettyprint_arrays)
72019c9c
GM
341 print_spaces_filtered (2 + 2 * recurse, stream);
342 /* For an array of chars, print with string syntax. */
343 if (eltlen == 1 &&
344 ((TYPE_CODE (elttype) == TYPE_CODE_INT)
345 || ((current_language->la_language == language_m2)
346 && (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
79a45b7d 347 && (options->format == 0 || options->format == 's'))
72019c9c
GM
348 {
349 /* If requested, look for the first null char and only print
350 elements up to it. */
79a45b7d 351 if (options->stop_print_at_null)
72019c9c
GM
352 {
353 unsigned int temp_len;
354
025bb325 355 /* Look for a NULL char. */
72019c9c
GM
356 for (temp_len = 0;
357 (valaddr + embedded_offset)[temp_len]
79a45b7d 358 && temp_len < len && temp_len < options->print_max;
72019c9c
GM
359 temp_len++);
360 len = temp_len;
361 }
362
6c7a06a3 363 LA_PRINT_STRING (stream, TYPE_TARGET_TYPE (type),
be759fcf
PM
364 valaddr + embedded_offset, len, NULL,
365 0, options);
72019c9c
GM
366 i = len;
367 }
368 else
369 {
370 fprintf_filtered (stream, "{");
490f124f 371 val_print_array_elements (type, valaddr, embedded_offset,
025bb325
MS
372 address, stream,
373 recurse, original_value,
0e03807e 374 options, 0);
72019c9c
GM
375 fprintf_filtered (stream, "}");
376 }
377 break;
378 }
379 /* Array of unspecified length: treat like pointer to first elt. */
79a45b7d 380 print_unpacked_pointer (type, address, address, options, stream);
72019c9c
GM
381 break;
382
383 case TYPE_CODE_PTR:
384 if (TYPE_CONST (type))
385 print_variable_at_address (type, valaddr + embedded_offset,
79a45b7d
TT
386 stream, recurse, options);
387 else if (options->format && options->format != 's')
ab2188aa
PA
388 val_print_scalar_formatted (type, valaddr, embedded_offset,
389 original_value, options, 0, stream);
72019c9c
GM
390 else
391 {
392 addr = unpack_pointer (type, valaddr + embedded_offset);
79a45b7d 393 print_unpacked_pointer (type, addr, address, options, stream);
72019c9c
GM
394 }
395 break;
396
72019c9c
GM
397 case TYPE_CODE_REF:
398 elttype = check_typedef (TYPE_TARGET_TYPE (type));
79a45b7d 399 if (options->addressprint)
72019c9c
GM
400 {
401 CORE_ADDR addr
402 = extract_typed_address (valaddr + embedded_offset, type);
b8d56208 403
72019c9c 404 fprintf_filtered (stream, "@");
5af949e3 405 fputs_filtered (paddress (gdbarch, addr), stream);
79a45b7d 406 if (options->deref_ref)
72019c9c
GM
407 fputs_filtered (": ", stream);
408 }
409 /* De-reference the reference. */
79a45b7d 410 if (options->deref_ref)
72019c9c
GM
411 {
412 if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
413 {
414 struct value *deref_val =
415 value_at
416 (TYPE_TARGET_TYPE (type),
d8631d21 417 unpack_pointer (type, valaddr + embedded_offset));
b8d56208 418
79a45b7d
TT
419 common_val_print (deref_val, stream, recurse, options,
420 current_language);
72019c9c
GM
421 }
422 else
423 fputs_filtered ("???", stream);
424 }
425 break;
426
427 case TYPE_CODE_UNION:
79a45b7d 428 if (recurse && !options->unionprint)
72019c9c
GM
429 {
430 fprintf_filtered (stream, "{...}");
431 break;
432 }
433 /* Fall through. */
434 case TYPE_CODE_STRUCT:
435 if (m2_is_long_set (type))
436 m2_print_long_set (type, valaddr, embedded_offset, address,
79a45b7d 437 stream);
844781a1
GM
438 else if (m2_is_unbounded_array (type))
439 m2_print_unbounded_array (type, valaddr, embedded_offset,
79a45b7d 440 address, stream, recurse, options);
72019c9c
GM
441 else
442 cp_print_value_fields (type, type, valaddr, embedded_offset,
0e03807e
TT
443 address, stream, recurse, original_value,
444 options, NULL, 0);
72019c9c
GM
445 break;
446
447 case TYPE_CODE_ENUM:
79a45b7d 448 if (options->format)
72019c9c 449 {
ab2188aa
PA
450 val_print_scalar_formatted (type, valaddr, embedded_offset,
451 original_value, options, 0, stream);
72019c9c
GM
452 break;
453 }
454 len = TYPE_NFIELDS (type);
455 val = unpack_long (type, valaddr + embedded_offset);
456 for (i = 0; i < len; i++)
457 {
458 QUIT;
459 if (val == TYPE_FIELD_BITPOS (type, i))
460 {
461 break;
462 }
463 }
464 if (i < len)
465 {
466 fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
467 }
468 else
469 {
470 print_longest (stream, 'd', 0, val);
471 }
472 break;
473
474 case TYPE_CODE_FUNC:
79a45b7d 475 if (options->format)
72019c9c 476 {
ab2188aa
PA
477 val_print_scalar_formatted (type, valaddr, embedded_offset,
478 original_value, options, 0, stream);
72019c9c
GM
479 break;
480 }
481 /* FIXME, we should consider, at least for ANSI C language, eliminating
482 the distinction made between FUNCs and POINTERs to FUNCs. */
483 fprintf_filtered (stream, "{");
484 type_print (type, "", stream, -1);
485 fprintf_filtered (stream, "} ");
486 /* Try to print what function it points to, and its address. */
5af949e3 487 print_address_demangle (gdbarch, address, stream, demangle);
72019c9c
GM
488 break;
489
490 case TYPE_CODE_BOOL:
79a45b7d
TT
491 if (options->format || options->output_format)
492 {
493 struct value_print_options opts = *options;
b8d56208 494
79a45b7d
TT
495 opts.format = (options->format ? options->format
496 : options->output_format);
ab2188aa
PA
497 val_print_scalar_formatted (type, valaddr, embedded_offset,
498 original_value, &opts, 0, stream);
79a45b7d 499 }
72019c9c
GM
500 else
501 {
502 val = unpack_long (type, valaddr + embedded_offset);
503 if (val == 0)
504 fputs_filtered ("FALSE", stream);
505 else if (val == 1)
506 fputs_filtered ("TRUE", stream);
507 else
508 fprintf_filtered (stream, "%ld)", (long int) val);
509 }
510 break;
511
512 case TYPE_CODE_RANGE:
513 if (TYPE_LENGTH (type) == TYPE_LENGTH (TYPE_TARGET_TYPE (type)))
514 {
515 m2_val_print (TYPE_TARGET_TYPE (type), valaddr, embedded_offset,
0e03807e 516 address, stream, recurse, original_value, options);
72019c9c
GM
517 break;
518 }
519 /* FIXME: create_range_type does not set the unsigned bit in a
520 range type (I think it probably should copy it from the target
521 type), so we won't print values which are too large to
522 fit in a signed integer correctly. */
523 /* FIXME: Doesn't handle ranges of enums correctly. (Can't just
524 print with the target type, though, because the size of our type
525 and the target type might differ). */
526 /* FALLTHROUGH */
527
528 case TYPE_CODE_INT:
79a45b7d
TT
529 if (options->format || options->output_format)
530 {
531 struct value_print_options opts = *options;
b8d56208 532
79a45b7d
TT
533 opts.format = (options->format ? options->format
534 : options->output_format);
ab2188aa
PA
535 val_print_scalar_formatted (type, valaddr, embedded_offset,
536 original_value, &opts, 0, stream);
79a45b7d 537 }
72019c9c
GM
538 else
539 val_print_type_code_int (type, valaddr + embedded_offset, stream);
540 break;
541
542 case TYPE_CODE_CHAR:
79a45b7d
TT
543 if (options->format || options->output_format)
544 {
545 struct value_print_options opts = *options;
b8d56208 546
79a45b7d
TT
547 opts.format = (options->format ? options->format
548 : options->output_format);
ab2188aa
PA
549 val_print_scalar_formatted (type, valaddr, embedded_offset,
550 original_value, &opts, 0, stream);
79a45b7d 551 }
72019c9c
GM
552 else
553 {
554 val = unpack_long (type, valaddr + embedded_offset);
555 if (TYPE_UNSIGNED (type))
556 fprintf_filtered (stream, "%u", (unsigned int) val);
557 else
558 fprintf_filtered (stream, "%d", (int) val);
559 fputs_filtered (" ", stream);
6c7a06a3 560 LA_PRINT_CHAR ((unsigned char) val, type, stream);
72019c9c
GM
561 }
562 break;
563
564 case TYPE_CODE_FLT:
79a45b7d 565 if (options->format)
ab2188aa
PA
566 val_print_scalar_formatted (type, valaddr, embedded_offset,
567 original_value, options, 0, stream);
72019c9c
GM
568 else
569 print_floating (valaddr + embedded_offset, type, stream);
570 break;
571
572 case TYPE_CODE_METHOD:
573 break;
574
575 case TYPE_CODE_BITSTRING:
576 case TYPE_CODE_SET:
577 elttype = TYPE_INDEX_TYPE (type);
578 CHECK_TYPEDEF (elttype);
579 if (TYPE_STUB (elttype))
580 {
581 fprintf_filtered (stream, _("<incomplete type>"));
582 gdb_flush (stream);
583 break;
584 }
585 else
586 {
587 struct type *range = elttype;
588 LONGEST low_bound, high_bound;
589 int i;
590 int is_bitstring = TYPE_CODE (type) == TYPE_CODE_BITSTRING;
591 int need_comma = 0;
592
593 if (is_bitstring)
594 fputs_filtered ("B'", stream);
595 else
596 fputs_filtered ("{", stream);
597
598 i = get_discrete_bounds (range, &low_bound, &high_bound);
599 maybe_bad_bstring:
600 if (i < 0)
601 {
602 fputs_filtered (_("<error value>"), stream);
603 goto done;
604 }
605
606 for (i = low_bound; i <= high_bound; i++)
607 {
608 int element = value_bit_index (type, valaddr + embedded_offset,
609 i);
b8d56208 610
72019c9c
GM
611 if (element < 0)
612 {
613 i = element;
614 goto maybe_bad_bstring;
615 }
616 if (is_bitstring)
617 fprintf_filtered (stream, "%d", element);
618 else if (element)
619 {
620 if (need_comma)
621 fputs_filtered (", ", stream);
622 print_type_scalar (range, i, stream);
623 need_comma = 1;
624
625 if (i + 1 <= high_bound
626 && value_bit_index (type, valaddr + embedded_offset,
627 ++i))
628 {
629 int j = i;
b8d56208 630
72019c9c
GM
631 fputs_filtered ("..", stream);
632 while (i + 1 <= high_bound
633 && value_bit_index (type,
634 valaddr + embedded_offset,
635 ++i))
636 j = i;
637 print_type_scalar (range, j, stream);
638 }
639 }
640 }
641 done:
642 if (is_bitstring)
643 fputs_filtered ("'", stream);
644 else
645 fputs_filtered ("}", stream);
646 }
647 break;
648
649 case TYPE_CODE_VOID:
650 fprintf_filtered (stream, "void");
651 break;
652
653 case TYPE_CODE_ERROR:
b00fdb78 654 fprintf_filtered (stream, "%s", TYPE_ERROR_NAME (type));
72019c9c
GM
655 break;
656
657 case TYPE_CODE_UNDEF:
658 /* This happens (without TYPE_FLAG_STUB set) on systems which don't use
659 dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
660 and no complete type for struct foo in that file. */
661 fprintf_filtered (stream, _("<incomplete type>"));
662 break;
663
664 default:
665 error (_("Invalid m2 type code %d in symbol table."), TYPE_CODE (type));
666 }
667 gdb_flush (stream);
668 return (0);
c906108c 669}
This page took 1.341109 seconds and 4 git commands to generate.