* stabs.c (parse_stab_type): Add new typename parameter. Change
[deliverable/binutils-gdb.git] / binutils / stabs.c
1 /* stabs.c -- Parse stabs debugging information
2 Copyright (C) 1995, 1996 Free Software Foundation, Inc.
3 Written by Ian Lance Taylor <ian@cygnus.com>.
4
5 This file is part of GNU Binutils.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
21
22 /* This file contains code which parses stabs debugging information.
23 The organization of this code is based on the gdb stabs reading
24 code. The job it does is somewhat different, because it is not
25 trying to identify the correct address for anything. */
26
27 #include <stdio.h>
28 #include <ctype.h>
29
30 #include "bfd.h"
31 #include "bucomm.h"
32 #include "libiberty.h"
33 #include "debug.h"
34 #include "budbg.h"
35
36 /* Meaningless definition needs by aout64.h. FIXME. */
37 #define BYTES_IN_WORD 4
38
39 #include "aout/aout64.h"
40 #include "aout/stab_gnu.h"
41
42 /* The number of predefined XCOFF types. */
43
44 #define XCOFF_TYPE_COUNT 34
45
46 /* This structure is used as a handle so that the stab parsing doesn't
47 need to use any static variables. */
48
49 struct stab_handle
50 {
51 /* True if this is stabs in sections. */
52 boolean sections;
53 /* The type of the last stab symbol, so that we can detect N_SO
54 pairs. */
55 int last_type;
56 /* The value of the start of the file, so that we can handle file
57 relative N_LBRAC and N_RBRAC symbols. */
58 bfd_vma file_start_offset;
59 /* The offset of the start of the function, so that we can handle
60 function relative N_LBRAC and N_RBRAC symbols. */
61 bfd_vma function_start_offset;
62 /* The version number of gcc which compiled the current compilation
63 unit, 0 if not compiled by gcc. */
64 int gcc_compiled;
65 /* Whether an N_OPT symbol was seen that was not generated by gcc,
66 so that we can detect the SunPRO compiler. */
67 boolean n_opt_found;
68 /* The main file name. */
69 char *main_filename;
70 /* A stack of N_BINCL files. */
71 struct bincl_file *bincl_stack;
72 /* Whether we are inside a function or not. */
73 boolean within_function;
74 /* The depth of block nesting. */
75 int block_depth;
76 /* List of pending variable definitions. */
77 struct stab_pending_var *pending;
78 /* Number of files for which we have types. */
79 unsigned int files;
80 /* Lists of types per file. */
81 struct stab_types **file_types;
82 /* Predefined XCOFF types. */
83 debug_type xcoff_types[XCOFF_TYPE_COUNT];
84 /* Undefined tags. */
85 struct stab_tag *tags;
86 };
87
88 /* A list of these structures is used to hold pending variable
89 definitions seen before the N_LBRAC of a block. */
90
91 struct stab_pending_var
92 {
93 /* Next pending variable definition. */
94 struct stab_pending_var *next;
95 /* Name. */
96 const char *name;
97 /* Type. */
98 debug_type type;
99 /* Kind. */
100 enum debug_var_kind kind;
101 /* Value. */
102 bfd_vma val;
103 };
104
105 /* A list of these structures is used to hold the types for a single
106 file. */
107
108 struct stab_types
109 {
110 /* Next set of slots for this file. */
111 struct stab_types *next;
112 /* Types indexed by type number. */
113 #define STAB_TYPES_SLOTS (16)
114 debug_type types[STAB_TYPES_SLOTS];
115 };
116
117 /* We keep a list of undefined tags that we encounter, so that we can
118 fill them in if the tag is later defined. */
119
120 struct stab_tag
121 {
122 /* Next undefined tag. */
123 struct stab_tag *next;
124 /* Tag name. */
125 const char *name;
126 /* Type kind. */
127 enum debug_type_kind kind;
128 /* Slot to hold real type when we discover it. If we don't, we fill
129 in an undefined tag type. */
130 debug_type slot;
131 /* Indirect type we have created to point at slot. */
132 debug_type type;
133 };
134
135 static char *savestring PARAMS ((const char *, int));
136 static bfd_vma parse_number PARAMS ((const char **, boolean *));
137 static void bad_stab PARAMS ((const char *));
138 static void warn_stab PARAMS ((const char *, const char *));
139 static boolean parse_stab_string
140 PARAMS ((PTR, struct stab_handle *, int, int, bfd_vma, const char *));
141 static debug_type parse_stab_type
142 PARAMS ((PTR, struct stab_handle *, const char *, const char **,
143 debug_type **));
144 static boolean parse_stab_type_number
145 PARAMS ((const char **, int *));
146 static debug_type parse_stab_range_type
147 PARAMS ((PTR, struct stab_handle *, const char *, const char **,
148 const int *));
149 static debug_type parse_stab_sun_builtin_type PARAMS ((PTR, const char **));
150 static debug_type parse_stab_sun_floating_type
151 PARAMS ((PTR, const char **));
152 static debug_type parse_stab_enum_type PARAMS ((PTR, const char **));
153 static debug_type parse_stab_struct_type
154 PARAMS ((PTR, struct stab_handle *, const char **, boolean, const int *));
155 static boolean parse_stab_baseclasses
156 PARAMS ((PTR, struct stab_handle *, const char **, debug_baseclass **));
157 static boolean parse_stab_struct_fields
158 PARAMS ((PTR, struct stab_handle *, const char **, debug_field **,
159 boolean *));
160 static boolean parse_stab_cpp_abbrev
161 PARAMS ((PTR, struct stab_handle *, const char **, debug_field *));
162 static boolean parse_stab_one_struct_field
163 PARAMS ((PTR, struct stab_handle *, const char **, const char *,
164 debug_field *, boolean *));
165 static boolean parse_stab_members
166 PARAMS ((PTR, struct stab_handle *, const char **, debug_method **));
167 static boolean parse_stab_tilde_field
168 PARAMS ((PTR, struct stab_handle *, const char **, const int *,
169 debug_type *, boolean *));
170 static debug_type parse_stab_array_type
171 PARAMS ((PTR, struct stab_handle *, const char **, boolean));
172 static void push_bincl PARAMS ((struct stab_handle *, const char *));
173 static const char *pop_bincl PARAMS ((struct stab_handle *));
174 static boolean stab_record_variable
175 PARAMS ((PTR, struct stab_handle *, const char *, debug_type,
176 enum debug_var_kind, bfd_vma));
177 static boolean stab_emit_pending_vars PARAMS ((PTR, struct stab_handle *));
178 static debug_type *stab_find_slot
179 PARAMS ((struct stab_handle *, const int *));
180 static debug_type stab_find_type
181 PARAMS ((PTR, struct stab_handle *, const int *));
182 static boolean stab_record_type
183 PARAMS ((PTR, struct stab_handle *, const int *, debug_type));
184 static debug_type stab_xcoff_builtin_type
185 PARAMS ((PTR, struct stab_handle *, int));
186
187 /* Save a string in memory. */
188
189 static char *
190 savestring (start, len)
191 const char *start;
192 int len;
193 {
194 char *ret;
195
196 ret = (char *) xmalloc (len + 1);
197 memcpy (ret, start, len);
198 ret[len] = '\0';
199 return ret;
200 }
201
202 /* Read a number from a string. */
203
204 static bfd_vma
205 parse_number (pp, poverflow)
206 const char **pp;
207 boolean *poverflow;
208 {
209 unsigned long ul;
210 const char *orig;
211
212 if (poverflow != NULL)
213 *poverflow = false;
214
215 orig = *pp;
216
217 errno = 0;
218 ul = strtoul (*pp, (char **) pp, 0);
219 if (ul + 1 != 0 || errno == 0)
220 return (bfd_vma) ul;
221
222 /* Note that even though strtoul overflowed, it should have set *pp
223 to the end of the number, which is where we want it. */
224
225 if (sizeof (bfd_vma) > sizeof (unsigned long))
226 {
227 const char *p;
228 boolean neg;
229 int base;
230 bfd_vma over, lastdig;
231 boolean overflow;
232 bfd_vma v;
233
234 /* Our own version of strtoul, for a bfd_vma. */
235
236 p = orig;
237
238 neg = false;
239 if (*p == '+')
240 ++p;
241 else if (*p == '-')
242 {
243 neg = true;
244 ++p;
245 }
246
247 base = 10;
248 if (*p == '0')
249 {
250 if (p[1] == 'x' || p[1] == 'X')
251 {
252 base = 16;
253 p += 2;
254 }
255 else
256 {
257 base = 8;
258 ++p;
259 }
260 }
261
262 over = ((bfd_vma) (bfd_signed_vma) -1) / (bfd_vma) base;
263 lastdig = ((bfd_vma) (bfd_signed_vma) -1) % (bfd_vma) base;
264
265 overflow = false;
266 v = 0;
267 while (1)
268 {
269 int d;
270
271 d = *p++;
272 if (isdigit ((unsigned char) d))
273 d -= '0';
274 else if (isupper ((unsigned char) d))
275 d -= 'A';
276 else if (islower ((unsigned char) d))
277 d -= 'a';
278 else
279 break;
280
281 if (d >= base)
282 break;
283
284 if (v > over || (v == over && (bfd_vma) d > lastdig))
285 {
286 overflow = true;
287 break;
288 }
289 }
290
291 if (! overflow)
292 {
293 if (neg)
294 v = - v;
295 return v;
296 }
297 }
298
299 /* If we get here, the number is too large to represent in a
300 bfd_vma. */
301
302 if (poverflow != NULL)
303 *poverflow = true;
304 else
305 warn_stab (orig, "numeric overflow");
306
307 return 0;
308 }
309
310 /* Give an error for a bad stab string. */
311
312 static void
313 bad_stab (p)
314 const char *p;
315 {
316 fprintf (stderr, "Bad stab: %s\n", p);
317 }
318
319 /* Warn about something in a stab string. */
320
321 static void
322 warn_stab (p, err)
323 const char *p;
324 const char *err;
325 {
326 fprintf (stderr, "Warning: %s: %s\n", err, p);
327 }
328
329 /* Create a handle to parse stabs symbols with. */
330
331 /*ARGSUSED*/
332 PTR
333 start_stab (dhandle, sections)
334 PTR dhandle;
335 boolean sections;
336 {
337 struct stab_handle *ret;
338
339 ret = (struct stab_handle *) xmalloc (sizeof *ret);
340 memset (ret, 0, sizeof *ret);
341 ret->sections = sections;
342 ret->files = 1;
343 ret->file_types = (struct stab_types **) xmalloc (sizeof *ret->file_types);
344 ret->file_types[0] = NULL;
345 return (PTR) ret;
346 }
347
348 /* When we have processed all the stabs information, we need to go
349 through and fill in all the undefined tags. */
350
351 boolean
352 finish_stab (dhandle, handle)
353 PTR dhandle;
354 PTR handle;
355 {
356 struct stab_handle *info = (struct stab_handle *) handle;
357 struct stab_tag *st;
358
359 if (info->within_function)
360 {
361 if (! debug_end_function (dhandle, (bfd_vma) -1))
362 return false;
363 info->within_function = false;
364 }
365
366 for (st = info->tags; st != NULL; st = st->next)
367 {
368 st->slot = debug_make_undefined_tagged_type (dhandle, st->name,
369 st->kind);
370 if (st->slot == DEBUG_TYPE_NULL)
371 return false;
372 }
373
374 return true;
375 }
376
377 /* Handle a single stabs symbol. */
378
379 boolean
380 parse_stab (dhandle, handle, type, desc, value, string)
381 PTR dhandle;
382 PTR handle;
383 int type;
384 int desc;
385 bfd_vma value;
386 const char *string;
387 {
388 struct stab_handle *info = (struct stab_handle *) handle;
389
390 switch (type)
391 {
392 case N_FN:
393 case N_FN_SEQ:
394 break;
395
396 case N_LBRAC:
397 /* Ignore extra outermost context from SunPRO cc and acc. */
398 if (info->n_opt_found && desc == 1)
399 break;
400
401 if (! info->within_function)
402 {
403 fprintf (stderr, "N_LBRAC not within function\n");
404 return false;
405 }
406
407 /* Start an inner lexical block. */
408 if (! debug_start_block (dhandle,
409 (value
410 + info->file_start_offset
411 + info->function_start_offset)))
412 return false;
413
414 /* Emit any pending variable definitions. */
415 if (! stab_emit_pending_vars (dhandle, info))
416 return false;
417
418 ++info->block_depth;
419 break;
420
421 case N_RBRAC:
422 /* Ignore extra outermost context from SunPRO cc and acc. */
423 if (info->n_opt_found && desc == 1)
424 break;
425
426 /* We shouldn't have any pending variable definitions here, but,
427 if we do, we probably need to emit them before closing the
428 block. */
429 if (! stab_emit_pending_vars (dhandle, info))
430 return false;
431
432 /* End an inner lexical block. */
433 if (! debug_end_block (dhandle,
434 (value
435 + info->file_start_offset
436 + info->function_start_offset)))
437 return false;
438
439 --info->block_depth;
440 if (info->block_depth == 0)
441 {
442 info->within_function = false;
443 if (! debug_end_function (dhandle,
444 (value
445 + info->file_start_offset
446 + info->function_start_offset)))
447 return false;
448 }
449 break;
450
451 case N_SO:
452 /* Start a file. If we get two in a row, the first is the
453 directory name. An empty string is emitted by gcc at the end
454 of a compilation unit. */
455 if (*string == '\0')
456 {
457 if (info->within_function)
458 {
459 if (! debug_end_function (dhandle, (bfd_vma) -1))
460 return false;
461 info->within_function = false;
462 }
463 return true;
464 }
465 info->gcc_compiled = 0;
466 info->n_opt_found = false;
467 if (info->last_type == N_SO)
468 {
469 char *o;
470
471 if (! debug_append_filename (dhandle, string))
472 return false;
473 o = info->main_filename;
474 info->main_filename = concat (o, string, (const char *) NULL);
475 free (o);
476 }
477 else
478 {
479 if (info->within_function)
480 {
481 if (! debug_end_function (dhandle, (bfd_vma) -1))
482 return false;
483 info->within_function = false;
484 }
485 if (! debug_set_filename (dhandle, string))
486 return false;
487 if (info->main_filename != NULL)
488 free (info->main_filename);
489 info->main_filename = xstrdup (string);
490
491 /* Generally, for stabs in the symbol table, the N_LBRAC and
492 N_RBRAC symbols are relative to the N_SO symbol value. */
493 if (! info->sections)
494 info->file_start_offset = value;
495
496 /* We need to reset the mapping from type numbers to types.
497 We can't free the old mapping, because of the use of
498 debug_make_indirect_type. */
499 info->files = 1;
500 info->file_types = ((struct stab_types **)
501 xmalloc (sizeof *info->file_types));
502 info->file_types[0] = NULL;
503 }
504 break;
505
506 case N_SOL:
507 /* Start an include file. */
508 if (! debug_start_source (dhandle, string))
509 return false;
510 break;
511
512 case N_BINCL:
513 /* Start an include file which may be replaced. */
514 push_bincl (info, string);
515 if (! debug_start_source (dhandle, string))
516 return false;
517 break;
518
519 case N_EINCL:
520 /* End an N_BINCL include. */
521 if (! debug_start_source (dhandle, pop_bincl (info)))
522 return false;
523 break;
524
525 case N_EXCL:
526 /* This is a duplicate of a header file named by N_BINCL which
527 was eliminated by the linker. */
528 ++info->files;
529 info->file_types = ((struct stab_types **)
530 xrealloc ((PTR) info->file_types,
531 (info->files
532 * sizeof *info->file_types)));
533 info->file_types[info->files - 1] = NULL;
534 break;
535
536 case N_SLINE:
537 if (! debug_record_line (dhandle, desc,
538 value + info->function_start_offset))
539 return false;
540 break;
541
542 case N_BCOMM:
543 if (! debug_start_common_block (dhandle, string))
544 return false;
545 break;
546
547 case N_ECOMM:
548 if (! debug_end_common_block (dhandle, string))
549 return false;
550 break;
551
552 /* FIXME: gdb checks the string for N_STSYM, N_LCSYM or N_ROSYM
553 symbols, and if it does not start with :S, gdb relocates the
554 value to the start of the section. gcc always seems to use
555 :S, so we don't worry about this. */
556 default:
557 {
558 const char *colon;
559
560 colon = strchr (string, ':');
561 if (colon != NULL
562 && (colon[1] == 'f' || colon[1] == 'F'))
563 {
564 if (info->within_function)
565 {
566 if (! debug_end_function (dhandle, (bfd_vma) -1))
567 return false;
568 }
569 /* For stabs in sections, line numbers and block addresses
570 are offsets from the start of the function. */
571 if (info->sections)
572 info->function_start_offset = value;
573 info->within_function = true;
574 }
575
576 if (! parse_stab_string (dhandle, info, type, desc, value, string))
577 return false;
578 }
579 break;
580
581 case N_OPT:
582 if (string != NULL && strcmp (string, "gcc2_compiled.") == 0)
583 info->gcc_compiled = 2;
584 else if (string != NULL && strcmp (string, "gcc_compiled.") == 0)
585 info->gcc_compiled = 1;
586 else
587 info->n_opt_found = true;
588 break;
589
590 case N_OBJ:
591 case N_ENDM:
592 case N_MAIN:
593 break;
594 }
595
596 info->last_type = type;
597
598 return true;
599 }
600
601 /* Parse the stabs string. */
602
603 static boolean
604 parse_stab_string (dhandle, info, stabtype, desc, value, string)
605 PTR dhandle;
606 struct stab_handle *info;
607 int stabtype;
608 int desc;
609 bfd_vma value;
610 const char *string;
611 {
612 const char *p;
613 char *name;
614 int type;
615 debug_type dtype;
616 boolean synonym;
617 unsigned int lineno;
618 debug_type *slot;
619
620 p = strchr (string, ':');
621 if (p == NULL)
622 return true;
623
624 while (p[1] == ':')
625 {
626 p += 2;
627 p = strchr (p, ':');
628 if (p == NULL)
629 {
630 bad_stab (string);
631 return false;
632 }
633 }
634
635 /* GCC 2.x puts the line number in desc. SunOS apparently puts in
636 the number of bytes occupied by a type or object, which we
637 ignore. */
638 if (info->gcc_compiled >= 2)
639 lineno = desc;
640 else
641 lineno = 0;
642
643 /* FIXME: Sometimes the special C++ names start with '.'. */
644 name = NULL;
645 if (string[0] == '$')
646 {
647 switch (string[1])
648 {
649 case 't':
650 name = "this";
651 break;
652 case 'v':
653 /* Was: name = "vptr"; */
654 break;
655 case 'e':
656 name = "eh_throw";
657 break;
658 case '_':
659 /* This was an anonymous type that was never fixed up. */
660 break;
661 case 'X':
662 /* SunPRO (3.0 at least) static variable encoding. */
663 break;
664 default:
665 warn_stab (string, "unknown C++ encoded name");
666 break;
667 }
668 }
669
670 if (name == NULL)
671 {
672 if (p == string || (string[0] == ' ' && p == string + 1))
673 name = NULL;
674 else
675 name = savestring (string, p - string);
676 }
677
678 ++p;
679 if (isdigit ((unsigned char) *p) || *p == '(' || *p == '-')
680 type = 'l';
681 else
682 type = *p++;
683
684 switch (type)
685 {
686 case 'c':
687 /* c is a special case, not followed by a type-number.
688 SYMBOL:c=iVALUE for an integer constant symbol.
689 SYMBOL:c=rVALUE for a floating constant symbol.
690 SYMBOL:c=eTYPE,INTVALUE for an enum constant symbol.
691 e.g. "b:c=e6,0" for "const b = blob1"
692 (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */
693 if (*p != '=')
694 {
695 bad_stab (string);
696 return false;
697 }
698 ++p;
699 switch (*p++)
700 {
701 case 'r':
702 /* Floating point constant. */
703 if (! debug_record_float_const (dhandle, name, atof (p)))
704 return false;
705 break;
706 case 'i':
707 /* Integer constant. */
708 /* Defining integer constants this way is kind of silly,
709 since 'e' constants allows the compiler to give not only
710 the value, but the type as well. C has at least int,
711 long, unsigned int, and long long as constant types;
712 other languages probably should have at least unsigned as
713 well as signed constants. */
714 if (! debug_record_int_const (dhandle, name, atoi (p)))
715 return false;
716 break;
717 case 'e':
718 /* SYMBOL:c=eTYPE,INTVALUE for a constant symbol whose value
719 can be represented as integral.
720 e.g. "b:c=e6,0" for "const b = blob1"
721 (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */
722 dtype = parse_stab_type (dhandle, info, (const char *) NULL,
723 &p, (debug_type **) NULL);
724 if (dtype == DEBUG_TYPE_NULL)
725 return false;
726 if (*p != ',')
727 {
728 bad_stab (string);
729 return false;
730 }
731 if (! debug_record_typed_const (dhandle, name, dtype, atoi (p)))
732 return false;
733 break;
734 default:
735 bad_stab (string);
736 return false;
737 }
738
739 break;
740
741 case 'C':
742 /* The name of a caught exception. */
743 dtype = parse_stab_type (dhandle, info, (const char *) NULL,
744 &p, (debug_type **) NULL);
745 if (dtype == DEBUG_TYPE_NULL)
746 return false;
747 if (! debug_record_label (dhandle, name, dtype, value))
748 return false;
749 break;
750
751 case 'f':
752 case 'F':
753 /* A function definition. */
754 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p,
755 (debug_type **) NULL);
756 if (dtype == DEBUG_TYPE_NULL)
757 return false;
758 if (! debug_record_function (dhandle, name, dtype, type == 'F', value))
759 return false;
760
761 /* Sun acc puts declared types of arguments here. We don't care
762 about their actual types (FIXME -- we should remember the whole
763 function prototype), but the list may define some new types
764 that we have to remember, so we must scan it now. */
765 while (*p == ';')
766 {
767 ++p;
768 if (parse_stab_type (dhandle, info, (const char *) NULL, &p,
769 (debug_type **) NULL)
770 == DEBUG_TYPE_NULL)
771 return false;
772 }
773
774 break;
775
776 case 'G':
777 /* A global symbol. The value must be extracted from the symbol
778 table. */
779 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p,
780 (debug_type **) NULL);
781 if (dtype == DEBUG_TYPE_NULL)
782 return false;
783 if (! stab_record_variable (dhandle, info, name, dtype, DEBUG_GLOBAL,
784 (bfd_vma) -1))
785 return false;
786 break;
787
788 /* This case is faked by a conditional above, when there is no
789 code letter in the dbx data. Dbx data never actually
790 contains 'l'. */
791 case 'l':
792 case 's':
793 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p,
794 (debug_type **) NULL);
795 if (dtype == DEBUG_TYPE_NULL)
796 return false;
797 if (! stab_record_variable (dhandle, info, name, dtype, DEBUG_LOCAL,
798 value))
799 return false;
800 break;
801
802 case 'p':
803 /* A function parameter. */
804 if (*p != 'F')
805 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p,
806 (debug_type **) NULL);
807 else
808 {
809 /* pF is a two-letter code that means a function parameter in
810 Fortran. The type-number specifies the type of the return
811 value. Translate it into a pointer-to-function type. */
812 ++p;
813 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p,
814 (debug_type **) NULL);
815 if (dtype != DEBUG_TYPE_NULL)
816 dtype = debug_make_pointer_type (dhandle,
817 debug_make_function_type (dhandle,
818 dtype));
819 }
820 if (dtype == DEBUG_TYPE_NULL)
821 return false;
822 if (! debug_record_parameter (dhandle, name, dtype, DEBUG_PARM_STACK,
823 value))
824 return false;
825
826 /* FIXME: At this point gdb considers rearranging the parameter
827 address on a big endian machine if it is smaller than an int.
828 We have no way to do that, since we don't really know much
829 about the target. */
830
831 break;
832
833 case 'P':
834 if (stabtype == N_FUN)
835 {
836 /* Prototype of a function referenced by this file. */
837 while (*p == ';')
838 {
839 ++p;
840 if (parse_stab_type (dhandle, info, (const char *) NULL, &p,
841 (debug_type **) NULL)
842 == DEBUG_TYPE_NULL)
843 return false;
844 }
845 break;
846 }
847 /* Fall through. */
848 case 'R':
849 /* Parameter which is in a register. */
850 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p,
851 (debug_type **) NULL);
852 if (dtype == DEBUG_TYPE_NULL)
853 return false;
854 if (! debug_record_parameter (dhandle, name, dtype, DEBUG_PARM_REG,
855 value))
856 return false;
857 break;
858
859 case 'r':
860 /* Register variable (either global or local). */
861 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p,
862 (debug_type **) NULL);
863 if (dtype == DEBUG_TYPE_NULL)
864 return false;
865 if (! stab_record_variable (dhandle, info, name, dtype, DEBUG_REGISTER,
866 value))
867 return false;
868
869 /* FIXME: At this point gdb checks to combine pairs of 'p' and
870 'r' stabs into a single 'P' stab. */
871
872 break;
873
874 case 'S':
875 /* Static symbol at top level of file */
876 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p,
877 (debug_type **) NULL);
878 if (dtype == DEBUG_TYPE_NULL)
879 return false;
880 if (! stab_record_variable (dhandle, info, name, dtype, DEBUG_STATIC,
881 value))
882 return false;
883 break;
884
885 case 't':
886 /* A typedef. */
887 dtype = parse_stab_type (dhandle, info, name, &p, &slot);
888 if (dtype == DEBUG_TYPE_NULL)
889 return false;
890 if (name == NULL)
891 {
892 /* A nameless type. Nothing to do. */
893 return true;
894 }
895
896 dtype = debug_name_type (dhandle, name, dtype);
897 if (dtype == DEBUG_TYPE_NULL)
898 return false;
899
900 if (slot != NULL)
901 *slot = dtype;
902
903 break;
904
905 case 'T':
906 /* Struct, union, or enum tag. For GNU C++, this can be be followed
907 by 't' which means we are typedef'ing it as well. */
908 if (*p != 't')
909 {
910 synonym = false;
911 /* FIXME: gdb sets synonym to true if the current language
912 is C++. */
913 }
914 else
915 {
916 synonym = true;
917 ++p;
918 }
919
920 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p, &slot);
921 if (dtype == DEBUG_TYPE_NULL)
922 return false;
923 if (name == NULL)
924 return true;
925
926 dtype = debug_tag_type (dhandle, name, dtype);
927 if (dtype == DEBUG_TYPE_NULL)
928 return false;
929 if (slot != NULL)
930 *slot = dtype;
931
932 /* See if we have a cross reference to this tag which we can now
933 fill in. */
934 {
935 register struct stab_tag **pst;
936
937 for (pst = &info->tags; *pst != NULL; pst = &(*pst)->next)
938 {
939 if ((*pst)->name[0] == name[0]
940 && strcmp ((*pst)->name, name) == 0)
941 {
942 (*pst)->slot = dtype;
943 *pst = (*pst)->next;
944 break;
945 }
946 }
947 }
948
949 if (synonym)
950 {
951 dtype = debug_name_type (dhandle, name, dtype);
952 if (dtype == DEBUG_TYPE_NULL)
953 return false;
954
955 if (slot != NULL)
956 *slot = dtype;
957 }
958
959 break;
960
961 case 'V':
962 /* Static symbol of local scope */
963 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p,
964 (debug_type **) NULL);
965 if (dtype == DEBUG_TYPE_NULL)
966 return false;
967 /* FIXME: gdb checks os9k_stabs here. */
968 if (! stab_record_variable (dhandle, info, name, dtype,
969 DEBUG_LOCAL_STATIC, value))
970 return false;
971 break;
972
973 case 'v':
974 /* Reference parameter. */
975 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p,
976 (debug_type **) NULL);
977 if (dtype == DEBUG_TYPE_NULL)
978 return false;
979 if (! debug_record_parameter (dhandle, name, dtype, DEBUG_PARM_REFERENCE,
980 value))
981 return false;
982 break;
983
984 case 'a':
985 /* Reference parameter which is in a register. */
986 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p,
987 (debug_type **) NULL);
988 if (dtype == DEBUG_TYPE_NULL)
989 return false;
990 if (! debug_record_parameter (dhandle, name, dtype, DEBUG_PARM_REF_REG,
991 value))
992 return false;
993 break;
994
995 case 'X':
996 /* This is used by Sun FORTRAN for "function result value".
997 Sun claims ("dbx and dbxtool interfaces", 2nd ed)
998 that Pascal uses it too, but when I tried it Pascal used
999 "x:3" (local symbol) instead. */
1000 dtype = parse_stab_type (dhandle, info, (const char *) NULL, &p,
1001 (debug_type **) NULL);
1002 if (dtype == DEBUG_TYPE_NULL)
1003 return false;
1004 if (! stab_record_variable (dhandle, info, name, dtype, DEBUG_LOCAL,
1005 value))
1006 return false;
1007 break;
1008
1009 default:
1010 bad_stab (string);
1011 return false;
1012 }
1013
1014 /* FIXME: gdb converts structure values to structure pointers in a
1015 couple of cases, depending upon the target. */
1016
1017 return true;
1018 }
1019
1020 /* Parse a stabs type. The typename argument is non-NULL if this is a
1021 typedef. The pp argument points to the stab string, and is
1022 updated. The slotp argument points to a place to store the slot
1023 used if the type is being defined. */
1024
1025 static debug_type
1026 parse_stab_type (dhandle, info, typename, pp, slotp)
1027 PTR dhandle;
1028 struct stab_handle *info;
1029 const char *typename;
1030 const char **pp;
1031 debug_type **slotp;
1032 {
1033 const char *orig;
1034 int typenums[2];
1035 int size;
1036 boolean stringp;
1037 int descriptor;
1038 debug_type dtype;
1039
1040 if (slotp != NULL)
1041 *slotp = NULL;
1042
1043 orig = *pp;
1044
1045 size = -1;
1046 stringp = false;
1047
1048 /* Read type number if present. The type number may be omitted.
1049 for instance in a two-dimensional array declared with type
1050 "ar1;1;10;ar1;1;10;4". */
1051 if (! isdigit ((unsigned char) **pp) && **pp != '(' && **pp != '-')
1052 {
1053 /* 'typenums=' not present, type is anonymous. Read and return
1054 the definition, but don't put it in the type vector. */
1055 typenums[0] = typenums[1] = -1;
1056 }
1057 else
1058 {
1059 if (! parse_stab_type_number (pp, typenums))
1060 return DEBUG_TYPE_NULL;
1061
1062 if (**pp != '=')
1063 {
1064 /* Type is not being defined here. Either it already
1065 exists, or this is a forward reference to it. */
1066 return stab_find_type (dhandle, info, typenums);
1067 }
1068
1069 /* Only set the slot if the type is being defined. This means
1070 that the mapping from type numbers to types will only record
1071 the name of the typedef which defines a type. If we don't do
1072 this, then something like
1073 typedef int foo;
1074 int i;
1075 will record that i is of type foo. Unfortunately, stabs
1076 information is ambiguous about variable types. For this code,
1077 typedef int foo;
1078 int i;
1079 foo j;
1080 the stabs information records both i and j as having the same
1081 type. This could be fixed by patching the compiler. */
1082 if (slotp != NULL && typenums[0] >= 0 && typenums[1] >= 0)
1083 *slotp = stab_find_slot (info, typenums);
1084
1085 /* Type is being defined here. */
1086 /* Skip the '='. */
1087 ++*pp;
1088
1089 while (**pp == '@')
1090 {
1091 const char *p = *pp + 1;
1092 const char *attr;
1093
1094 if (isdigit ((unsigned char) *p) || *p == '(' || *p == '-')
1095 {
1096 /* Member type. */
1097 break;
1098 }
1099
1100 /* Type attributes. */
1101 attr = p;
1102
1103 for (; *p != ';'; ++p)
1104 {
1105 if (*p == '\0')
1106 {
1107 bad_stab (orig);
1108 return DEBUG_TYPE_NULL;
1109 }
1110 }
1111 *pp = p + 1;
1112
1113 switch (*attr)
1114 {
1115 case 's':
1116 size = atoi (attr + 1);
1117 if (size <= 0)
1118 size = -1;
1119 break;
1120
1121 case 'S':
1122 stringp = true;
1123 break;
1124
1125 default:
1126 /* Ignore unrecognized type attributes, so future
1127 compilers can invent new ones. */
1128 break;
1129 }
1130 }
1131 }
1132
1133 descriptor = **pp;
1134 ++*pp;
1135
1136 switch (descriptor)
1137 {
1138 case 'x':
1139 {
1140 enum debug_type_kind code;
1141 const char *q1, *q2, *p;
1142 char *name;
1143 struct stab_tag *st;
1144
1145 /* A cross reference to another type. */
1146
1147 switch (**pp)
1148 {
1149 case 's':
1150 code = DEBUG_KIND_STRUCT;
1151 break;
1152 case 'u':
1153 code = DEBUG_KIND_UNION;
1154 break;
1155 case 'e':
1156 code = DEBUG_KIND_ENUM;
1157 break;
1158 default:
1159 /* Complain and keep going, so compilers can invent new
1160 cross-reference types. */
1161 warn_stab (orig, "unrecognized cross reference type");
1162 code = DEBUG_KIND_STRUCT;
1163 break;
1164 }
1165 ++*pp;
1166
1167 q1 = strchr (*pp, '<');
1168 p = strchr (*pp, ':');
1169 if (p == NULL)
1170 {
1171 bad_stab (orig);
1172 return DEBUG_TYPE_NULL;
1173 }
1174 while (q1 != NULL && p > q1 && p[1] == ':')
1175 {
1176 q2 = strchr (q1, '>');
1177 if (q2 == NULL || q2 < p)
1178 break;
1179 p += 2;
1180 p = strchr (p, ':');
1181 if (p == NULL)
1182 {
1183 bad_stab (orig);
1184 return DEBUG_TYPE_NULL;
1185 }
1186 }
1187
1188 name = savestring (*pp, p - *pp);
1189
1190 *pp = p + 1;
1191
1192 /* We pass DEBUG_KIND_VOID because we want all tags in the
1193 same namespace. This is right for C, and I don't know how
1194 to handle other languages. FIXME. */
1195 dtype = debug_find_tagged_type (dhandle, name, DEBUG_KIND_VOID);
1196 if (dtype != DEBUG_TYPE_NULL)
1197 {
1198 free (name);
1199 if (typenums[0] != -1)
1200 {
1201 if (! stab_record_type (dhandle, info, typenums, dtype))
1202 return DEBUG_TYPE_NULL;
1203 }
1204 return dtype;
1205 }
1206
1207 /* We need to allocate an entry on the undefined tag list. */
1208 for (st = info->tags; st != NULL; st = st->next)
1209 {
1210 if (st->name[0] == name[0]
1211 && strcmp (st->name, name) == 0)
1212 break;
1213 }
1214 if (st == NULL)
1215 {
1216 st = (struct stab_tag *) xmalloc (sizeof *st);
1217 memset (st, 0, sizeof *st);
1218
1219 st->next = info->tags;
1220 st->name = name;
1221 st->kind = code;
1222 st->slot = DEBUG_TYPE_NULL;
1223 st->type = debug_make_indirect_type (dhandle, &st->slot, name);
1224 info->tags = st;
1225 }
1226
1227 dtype = st->type;
1228 if (typenums[0] != -1)
1229 {
1230 if (! stab_record_type (dhandle, info, typenums, dtype))
1231 return DEBUG_TYPE_NULL;
1232 }
1233 return dtype;
1234 }
1235 break;
1236
1237 case '-':
1238 case '0':
1239 case '1':
1240 case '2':
1241 case '3':
1242 case '4':
1243 case '5':
1244 case '6':
1245 case '7':
1246 case '8':
1247 case '9':
1248 case '(':
1249 {
1250 const char *hold;
1251 int xtypenums[2];
1252
1253 /* This type is defined as another type. */
1254
1255 (*pp)--;
1256 hold = *pp;
1257
1258 /* Peek ahead at the number to detect void. */
1259 if (! parse_stab_type_number (pp, xtypenums))
1260 return DEBUG_TYPE_NULL;
1261
1262 if (typenums[0] == xtypenums[0] && typenums[1] == xtypenums[1])
1263 {
1264 /* This type is being defined as itself, which means that
1265 it is void. */
1266 dtype = debug_make_void_type (dhandle);
1267 }
1268 else
1269 {
1270 *pp = hold;
1271
1272 /* Go back to the number and have parse_stab_type get it.
1273 This means that we can deal with something like
1274 t(1,2)=(3,4)=... which the Lucid compiler uses. */
1275 dtype = parse_stab_type (dhandle, info, (const char *) NULL,
1276 pp, (debug_type **) NULL);
1277 if (dtype == DEBUG_TYPE_NULL)
1278 return DEBUG_TYPE_NULL;
1279 }
1280
1281 if (typenums[0] != -1)
1282 {
1283 if (! stab_record_type (dhandle, info, typenums, dtype))
1284 return DEBUG_TYPE_NULL;
1285 }
1286
1287 break;
1288 }
1289
1290 case '*':
1291 dtype = debug_make_pointer_type (dhandle,
1292 parse_stab_type (dhandle, info,
1293 (const char *) NULL,
1294 pp,
1295 (debug_type **) NULL));
1296 break;
1297
1298 case '&':
1299 /* Reference to another type. */
1300 dtype = (debug_make_reference_type
1301 (dhandle,
1302 parse_stab_type (dhandle, info, (const char *) NULL, pp,
1303 (debug_type **) NULL)));
1304 break;
1305
1306 case 'f':
1307 /* Function returning another type. */
1308 /* FIXME: gdb checks os9k_stabs here. */
1309 dtype = (debug_make_function_type
1310 (dhandle,
1311 parse_stab_type (dhandle, info, (const char *) NULL, pp,
1312 (debug_type **) NULL)));
1313 break;
1314
1315 case 'k':
1316 /* Const qualifier on some type (Sun). */
1317 /* FIXME: gdb accepts 'c' here if os9k_stabs. */
1318 dtype = debug_make_const_type (dhandle,
1319 parse_stab_type (dhandle, info,
1320 (const char *) NULL,
1321 pp,
1322 (debug_type **) NULL));
1323 break;
1324
1325 case 'B':
1326 /* Volatile qual on some type (Sun). */
1327 /* FIXME: gdb accepts 'i' here if os9k_stabs. */
1328 dtype = (debug_make_volatile_type
1329 (dhandle,
1330 parse_stab_type (dhandle, info, (const char *) NULL, pp,
1331 (debug_type **) NULL)));
1332 break;
1333
1334 case '@':
1335 /* Offset (class & variable) type. This is used for a pointer
1336 relative to an object. */
1337 {
1338 debug_type domain;
1339 debug_type memtype;
1340
1341 /* Member type. */
1342
1343 domain = parse_stab_type (dhandle, info, (const char *) NULL, pp,
1344 (debug_type **) NULL);
1345 if (domain == DEBUG_TYPE_NULL)
1346 return DEBUG_TYPE_NULL;
1347
1348 if (**pp != ',')
1349 {
1350 bad_stab (orig);
1351 return DEBUG_TYPE_NULL;
1352 }
1353 ++*pp;
1354
1355 memtype = parse_stab_type (dhandle, info, (const char *) NULL, pp,
1356 (debug_type **) NULL);
1357 if (memtype == DEBUG_TYPE_NULL)
1358 return DEBUG_TYPE_NULL;
1359
1360 dtype = debug_make_offset_type (dhandle, domain, memtype);
1361 }
1362 break;
1363
1364 case '#':
1365 /* Method (class & fn) type. */
1366 if (**pp == '#')
1367 {
1368 debug_type return_type;
1369
1370 ++*pp;
1371 return_type = parse_stab_type (dhandle, info, (const char *) NULL,
1372 pp, (debug_type **) NULL);
1373 if (return_type == DEBUG_TYPE_NULL)
1374 return DEBUG_TYPE_NULL;
1375 if (**pp != ';')
1376 {
1377 bad_stab (orig);
1378 return DEBUG_TYPE_NULL;
1379 }
1380 ++*pp;
1381 dtype = debug_make_method_type (dhandle, return_type,
1382 DEBUG_TYPE_NULL, NULL);
1383 }
1384 else
1385 {
1386 debug_type domain;
1387 debug_type return_type;
1388 debug_type *args;
1389 unsigned int n;
1390 unsigned int alloc;
1391
1392 domain = parse_stab_type (dhandle, info, (const char *) NULL,
1393 pp, (debug_type **) NULL);
1394 if (domain == DEBUG_TYPE_NULL)
1395 return DEBUG_TYPE_NULL;
1396
1397 if (**pp != ',')
1398 {
1399 bad_stab (orig);
1400 return DEBUG_TYPE_NULL;
1401 }
1402 ++*pp;
1403
1404 return_type = parse_stab_type (dhandle, info, (const char *) NULL,
1405 pp, (debug_type **) NULL);
1406 if (return_type == DEBUG_TYPE_NULL)
1407 return DEBUG_TYPE_NULL;
1408
1409 alloc = 10;
1410 args = (debug_type *) xmalloc (alloc * sizeof *args);
1411 n = 0;
1412 while (**pp != ';')
1413 {
1414 if (**pp != ',')
1415 {
1416 bad_stab (orig);
1417 return DEBUG_TYPE_NULL;
1418 }
1419 ++*pp;
1420
1421 if (n + 1 >= alloc)
1422 {
1423 alloc += 10;
1424 args = ((debug_type *)
1425 xrealloc ((PTR) args, alloc * sizeof *args));
1426 }
1427
1428 args[n] = parse_stab_type (dhandle, info, (const char *) NULL,
1429 pp, (debug_type **) NULL);
1430 if (args[n] == DEBUG_TYPE_NULL)
1431 return DEBUG_TYPE_NULL;
1432 ++n;
1433 }
1434 ++*pp;
1435
1436 args[n] = DEBUG_TYPE_NULL;
1437
1438 dtype = debug_make_method_type (dhandle, return_type, domain, args);
1439 }
1440 break;
1441
1442 case 'r':
1443 /* Range type. */
1444 dtype = parse_stab_range_type (dhandle, info, typename, pp, typenums);
1445 break;
1446
1447 case 'b':
1448 /* FIXME: gdb checks os9k_stabs here. */
1449 /* Sun ACC builtin int type. */
1450 dtype = parse_stab_sun_builtin_type (dhandle, pp);
1451 break;
1452
1453 case 'R':
1454 /* Sun ACC builtin float type. */
1455 dtype = parse_stab_sun_floating_type (dhandle, pp);
1456 break;
1457
1458 case 'e':
1459 /* Enumeration type. */
1460 dtype = parse_stab_enum_type (dhandle, pp);
1461 break;
1462
1463 case 's':
1464 case 'u':
1465 /* Struct or union type. */
1466 dtype = parse_stab_struct_type (dhandle, info, pp,
1467 descriptor == 's', typenums);
1468 break;
1469
1470 case 'a':
1471 /* Array type. */
1472 if (**pp != 'r')
1473 {
1474 bad_stab (orig);
1475 return DEBUG_TYPE_NULL;
1476 }
1477 ++*pp;
1478
1479 dtype = parse_stab_array_type (dhandle, info, pp, stringp);
1480 break;
1481
1482 case 'S':
1483 dtype = debug_make_set_type (dhandle,
1484 parse_stab_type (dhandle, info,
1485 (const char *) NULL,
1486 pp,
1487 (debug_type **) NULL),
1488 stringp);
1489 break;
1490
1491 default:
1492 bad_stab (orig);
1493 return DEBUG_TYPE_NULL;
1494 }
1495
1496 if (dtype == DEBUG_TYPE_NULL)
1497 return DEBUG_TYPE_NULL;
1498
1499 if (typenums[0] != -1)
1500 {
1501 if (! stab_record_type (dhandle, info, typenums, dtype))
1502 return DEBUG_TYPE_NULL;
1503 }
1504
1505 if (size != -1)
1506 {
1507 if (! debug_record_type_size (dhandle, dtype, (unsigned int) size))
1508 return false;
1509 }
1510
1511 return dtype;
1512 }
1513
1514 /* Read a number by which a type is referred to in dbx data, or
1515 perhaps read a pair (FILENUM, TYPENUM) in parentheses. Just a
1516 single number N is equivalent to (0,N). Return the two numbers by
1517 storing them in the vector TYPENUMS. */
1518
1519 static boolean
1520 parse_stab_type_number (pp, typenums)
1521 const char **pp;
1522 int *typenums;
1523 {
1524 const char *orig;
1525
1526 orig = *pp;
1527
1528 if (**pp != '(')
1529 {
1530 typenums[0] = 0;
1531 typenums[1] = (int) parse_number (pp, (boolean *) NULL);
1532 }
1533 else
1534 {
1535 ++*pp;
1536 typenums[0] = (int) parse_number (pp, (boolean *) NULL);
1537 if (**pp != ',')
1538 {
1539 bad_stab (orig);
1540 return false;
1541 }
1542 ++*pp;
1543 typenums[1] = (int) parse_number (pp, (boolean *) NULL);
1544 if (**pp != ')')
1545 {
1546 bad_stab (orig);
1547 return false;
1548 }
1549 ++*pp;
1550 }
1551
1552 return true;
1553 }
1554
1555 /* Parse a range type. */
1556
1557 static debug_type
1558 parse_stab_range_type (dhandle, info, typename, pp, typenums)
1559 PTR dhandle;
1560 struct stab_handle *info;
1561 const char *typename;
1562 const char **pp;
1563 const int *typenums;
1564 {
1565 const char *orig;
1566 int rangenums[2];
1567 boolean self_subrange;
1568 debug_type index_type;
1569 const char *s2, *s3;
1570 bfd_signed_vma n2, n3;
1571 boolean ov2, ov3;
1572
1573 orig = *pp;
1574
1575 index_type = DEBUG_TYPE_NULL;
1576
1577 /* First comes a type we are a subrange of.
1578 In C it is usually 0, 1 or the type being defined. */
1579 if (! parse_stab_type_number (pp, rangenums))
1580 return DEBUG_TYPE_NULL;
1581
1582 self_subrange = (rangenums[0] == typenums[0]
1583 && rangenums[1] == typenums[1]);
1584
1585 if (**pp == '=')
1586 {
1587 *pp = orig;
1588 index_type = parse_stab_type (dhandle, info, (const char *) NULL,
1589 pp, (debug_type **) NULL);
1590 if (index_type == DEBUG_TYPE_NULL)
1591 return DEBUG_TYPE_NULL;
1592 }
1593
1594 if (**pp == ';')
1595 ++*pp;
1596
1597 /* The remaining two operands are usually lower and upper bounds of
1598 the range. But in some special cases they mean something else. */
1599 s2 = *pp;
1600 n2 = parse_number (pp, &ov2);
1601 if (**pp != ';')
1602 {
1603 bad_stab (orig);
1604 return DEBUG_TYPE_NULL;
1605 }
1606 ++*pp;
1607
1608 s3 = *pp;
1609 n3 = parse_number (pp, &ov3);
1610 if (**pp != ';')
1611 {
1612 bad_stab (orig);
1613 return DEBUG_TYPE_NULL;
1614 }
1615 ++*pp;
1616
1617 if (ov2 || ov3)
1618 {
1619 /* gcc will emit range stabs for long long types. Handle this
1620 as a special case. FIXME: This needs to be more general. */
1621 #define LLLOW "01000000000000000000000;"
1622 #define LLHIGH "0777777777777777777777;"
1623 #define ULLHIGH "01777777777777777777777;"
1624 if (index_type == DEBUG_TYPE_NULL)
1625 {
1626 if (strncmp (s2, LLLOW, sizeof LLLOW - 1) == 0
1627 && strncmp (s3, LLHIGH, sizeof LLHIGH - 1) == 0)
1628 return debug_make_int_type (dhandle, 8, false);
1629 if (! ov2
1630 && n2 == 0
1631 && strncmp (s3, ULLHIGH, sizeof ULLHIGH - 1) == 0)
1632 return debug_make_int_type (dhandle, 8, true);
1633 }
1634
1635 warn_stab (orig, "numeric overflow");
1636 }
1637
1638 if (index_type == DEBUG_TYPE_NULL)
1639 {
1640 /* A type defined as a subrange of itself, with both bounds 0,
1641 is void. */
1642 if (self_subrange && n2 == 0 && n3 == 0)
1643 return debug_make_void_type (dhandle);
1644
1645 /* If n3 is zero and n2 is positive, this is a floating point
1646 type, and n2 is the number of bytes. */
1647 if (n3 == 0 && n2 > 0)
1648 return debug_make_float_type (dhandle, n2);
1649
1650 /* If the upper bound is -1, this is an unsigned int. */
1651 if (n2 == 0 && n3 == -1)
1652 {
1653 /* When gcc is used with -gstabs, but not -gstabs+, it will emit
1654 long long int:t6=r1;0;-1;
1655 long long unsigned int:t7=r1;0;-1;
1656 We hack here to handle this reasonably. */
1657 if (typename != NULL)
1658 {
1659 if (strcmp (typename, "long long int") == 0)
1660 return debug_make_int_type (dhandle, 8, false);
1661 else if (strcmp (typename, "long long unsigned int") == 0)
1662 return debug_make_int_type (dhandle, 8, true);
1663 }
1664 /* FIXME: The size here really depends upon the target. */
1665 return debug_make_int_type (dhandle, 4, true);
1666 }
1667
1668 /* A range of 0 to 127 is char. */
1669 if (self_subrange && n2 == 0 && n3 == 127)
1670 return debug_make_int_type (dhandle, 1, false);
1671
1672 /* FIXME: gdb checks for the language CHILL here. */
1673
1674 if (n2 == 0)
1675 {
1676 if (n3 < 0)
1677 return debug_make_int_type (dhandle, - n3, true);
1678 else if (n3 == 0xff)
1679 return debug_make_int_type (dhandle, 1, true);
1680 else if (n3 == 0xffff)
1681 return debug_make_int_type (dhandle, 2, true);
1682 /* -1 is used for the upper bound of (4 byte) "unsigned int"
1683 and "unsigned long", and we already checked for that, so
1684 don't need to test for it here. */
1685 }
1686 else if (n3 == 0
1687 && n2 < 0
1688 && (self_subrange || n2 == -8))
1689 return debug_make_int_type (dhandle, - n2, true);
1690 else if (n2 == - n3 - 1)
1691 {
1692 if (n3 == 0x7f)
1693 return debug_make_int_type (dhandle, 1, false);
1694 else if (n3 == 0x7fff)
1695 return debug_make_int_type (dhandle, 2, false);
1696 else if (n3 == 0x7fffffff)
1697 return debug_make_int_type (dhandle, 4, false);
1698 }
1699 }
1700
1701 /* At this point I don't have the faintest idea how to deal with a
1702 self_subrange type; I'm going to assume that this is used as an
1703 idiom, and that all of them are special cases. So . . . */
1704 if (self_subrange)
1705 {
1706 bad_stab (orig);
1707 return DEBUG_TYPE_NULL;
1708 }
1709
1710 index_type = stab_find_type (dhandle, info, rangenums);
1711 if (index_type == DEBUG_TYPE_NULL)
1712 {
1713 /* Does this actually ever happen? Is that why we are worrying
1714 about dealing with it rather than just calling error_type? */
1715 warn_stab (orig, "missing index type");
1716 index_type = debug_make_int_type (dhandle, 4, false);
1717 }
1718
1719 return debug_make_range_type (dhandle, index_type, n2, n3);
1720 }
1721
1722 /* Sun's ACC uses a somewhat saner method for specifying the builtin
1723 typedefs in every file (for int, long, etc):
1724
1725 type = b <signed> <width>; <offset>; <nbits>
1726 signed = u or s. Possible c in addition to u or s (for char?).
1727 offset = offset from high order bit to start bit of type.
1728 width is # bytes in object of this type, nbits is # bits in type.
1729
1730 The width/offset stuff appears to be for small objects stored in
1731 larger ones (e.g. `shorts' in `int' registers). We ignore it for now,
1732 FIXME. */
1733
1734 static debug_type
1735 parse_stab_sun_builtin_type (dhandle, pp)
1736 PTR dhandle;
1737 const char **pp;
1738 {
1739 const char *orig;
1740 boolean unsignedp;
1741 bfd_vma bits;
1742
1743 orig = *pp;
1744
1745 switch (**pp)
1746 {
1747 case 's':
1748 unsignedp = false;
1749 break;
1750 case 'u':
1751 unsignedp = true;
1752 break;
1753 default:
1754 bad_stab (orig);
1755 return DEBUG_TYPE_NULL;
1756 }
1757 ++*pp;
1758
1759 /* For some odd reason, all forms of char put a c here. This is strange
1760 because no other type has this honor. We can safely ignore this because
1761 we actually determine 'char'acterness by the number of bits specified in
1762 the descriptor. */
1763 if (**pp == 'c')
1764 ++*pp;
1765
1766 /* The first number appears to be the number of bytes occupied
1767 by this type, except that unsigned short is 4 instead of 2.
1768 Since this information is redundant with the third number,
1769 we will ignore it. */
1770 (void) parse_number (pp, (boolean *) NULL);
1771 if (**pp != ';')
1772 {
1773 bad_stab (orig);
1774 return DEBUG_TYPE_NULL;
1775 }
1776 ++*pp;
1777
1778 /* The second number is always 0, so ignore it too. */
1779 (void) parse_number (pp, (boolean *) NULL);
1780 if (**pp != ';')
1781 {
1782 bad_stab (orig);
1783 return DEBUG_TYPE_NULL;
1784 }
1785 ++*pp;
1786
1787 /* The third number is the number of bits for this type. */
1788 bits = parse_number (pp, (boolean *) NULL);
1789
1790 /* The type *should* end with a semicolon. If it are embedded
1791 in a larger type the semicolon may be the only way to know where
1792 the type ends. If this type is at the end of the stabstring we
1793 can deal with the omitted semicolon (but we don't have to like
1794 it). Don't bother to complain(), Sun's compiler omits the semicolon
1795 for "void". */
1796 if (**pp == ';')
1797 ++*pp;
1798
1799 if (bits == 0)
1800 return debug_make_void_type (dhandle);
1801
1802 return debug_make_int_type (dhandle, bits / 8, unsignedp);
1803 }
1804
1805 /* Parse a builtin floating type generated by the Sun compiler. */
1806
1807 static debug_type
1808 parse_stab_sun_floating_type (dhandle, pp)
1809 PTR dhandle;
1810 const char **pp;
1811 {
1812 const char *orig;
1813 bfd_vma details;
1814 bfd_vma bytes;
1815
1816 orig = *pp;
1817
1818 /* The first number has more details about the type, for example
1819 FN_COMPLEX. */
1820 details = parse_number (pp, (boolean *) NULL);
1821 if (**pp != ';')
1822 {
1823 bad_stab (orig);
1824 return DEBUG_TYPE_NULL;
1825 }
1826
1827 /* The second number is the number of bytes occupied by this type */
1828 bytes = parse_number (pp, (boolean *) NULL);
1829 if (**pp != ';')
1830 {
1831 bad_stab (orig);
1832 return DEBUG_TYPE_NULL;
1833 }
1834
1835 if (details == NF_COMPLEX
1836 || details == NF_COMPLEX16
1837 || details == NF_COMPLEX32)
1838 return debug_make_complex_type (dhandle, bytes);
1839
1840 return debug_make_float_type (dhandle, bytes);
1841 }
1842
1843 /* Handle an enum type. */
1844
1845 static debug_type
1846 parse_stab_enum_type (dhandle, pp)
1847 PTR dhandle;
1848 const char **pp;
1849 {
1850 const char *orig;
1851 const char **names;
1852 bfd_signed_vma *values;
1853 unsigned int n;
1854 unsigned int alloc;
1855
1856 orig = *pp;
1857
1858 /* FIXME: gdb checks os9k_stabs here. */
1859
1860 /* The aix4 compiler emits an extra field before the enum members;
1861 my guess is it's a type of some sort. Just ignore it. */
1862 if (**pp == '-')
1863 {
1864 while (**pp != ':')
1865 ++*pp;
1866 ++*pp;
1867 }
1868
1869 /* Read the value-names and their values.
1870 The input syntax is NAME:VALUE,NAME:VALUE, and so on.
1871 A semicolon or comma instead of a NAME means the end. */
1872 alloc = 10;
1873 names = (const char **) xmalloc (alloc * sizeof *names);
1874 values = (bfd_signed_vma *) xmalloc (alloc * sizeof *values);
1875 n = 0;
1876 while (**pp != '\0' && **pp != ';' && **pp != ',')
1877 {
1878 const char *p;
1879 char *name;
1880 bfd_signed_vma val;
1881
1882 p = *pp;
1883 while (*p != ':')
1884 ++p;
1885
1886 name = savestring (*pp, p - *pp);
1887
1888 *pp = p + 1;
1889 val = (bfd_signed_vma) parse_number (pp, (boolean *) NULL);
1890 if (**pp != ',')
1891 {
1892 bad_stab (orig);
1893 return DEBUG_TYPE_NULL;
1894 }
1895 ++*pp;
1896
1897 if (n + 1 >= alloc)
1898 {
1899 alloc += 10;
1900 names = ((const char **)
1901 xrealloc ((PTR) names, alloc * sizeof *names));
1902 values = ((bfd_signed_vma *)
1903 xrealloc ((PTR) values, alloc * sizeof *values));
1904 }
1905
1906 names[n] = name;
1907 values[n] = val;
1908 ++n;
1909 }
1910
1911 names[n] = NULL;
1912 values[n] = 0;
1913
1914 if (**pp == ';')
1915 ++*pp;
1916
1917 return debug_make_enum_type (dhandle, names, values);
1918 }
1919
1920 /* Read the description of a structure (or union type) and return an object
1921 describing the type.
1922
1923 PP points to a character pointer that points to the next unconsumed token
1924 in the the stabs string. For example, given stabs "A:T4=s4a:1,0,32;;",
1925 *PP will point to "4a:1,0,32;;". */
1926
1927 static debug_type
1928 parse_stab_struct_type (dhandle, info, pp, structp, typenums)
1929 PTR dhandle;
1930 struct stab_handle *info;
1931 const char **pp;
1932 boolean structp;
1933 const int *typenums;
1934 {
1935 const char *orig;
1936 bfd_vma size;
1937 debug_baseclass *baseclasses;
1938 debug_field *fields;
1939 boolean statics;
1940 debug_method *methods;
1941 debug_type vptrbase;
1942 boolean ownvptr;
1943
1944 orig = *pp;
1945
1946 /* Get the size. */
1947 size = parse_number (pp, (boolean *) NULL);
1948
1949 /* Get the other information. */
1950 if (! parse_stab_baseclasses (dhandle, info, pp, &baseclasses)
1951 || ! parse_stab_struct_fields (dhandle, info, pp, &fields, &statics)
1952 || ! parse_stab_members (dhandle, info, pp, &methods)
1953 || ! parse_stab_tilde_field (dhandle, info, pp, typenums, &vptrbase,
1954 &ownvptr))
1955 return DEBUG_TYPE_NULL;
1956
1957 if (! statics
1958 && baseclasses == NULL
1959 && methods == NULL
1960 && vptrbase == DEBUG_TYPE_NULL
1961 && ! ownvptr)
1962 return debug_make_struct_type (dhandle, structp, size, fields);
1963
1964 return debug_make_object_type (dhandle, structp, size, fields, baseclasses,
1965 methods, vptrbase, ownvptr);
1966 }
1967
1968 /* The stabs for C++ derived classes contain baseclass information which
1969 is marked by a '!' character after the total size. This function is
1970 called when we encounter the baseclass marker, and slurps up all the
1971 baseclass information.
1972
1973 Immediately following the '!' marker is the number of base classes that
1974 the class is derived from, followed by information for each base class.
1975 For each base class, there are two visibility specifiers, a bit offset
1976 to the base class information within the derived class, a reference to
1977 the type for the base class, and a terminating semicolon.
1978
1979 A typical example, with two base classes, would be "!2,020,19;0264,21;".
1980 ^^ ^ ^ ^ ^ ^ ^
1981 Baseclass information marker __________________|| | | | | | |
1982 Number of baseclasses __________________________| | | | | | |
1983 Visibility specifiers (2) ________________________| | | | | |
1984 Offset in bits from start of class _________________| | | | |
1985 Type number for base class ___________________________| | | |
1986 Visibility specifiers (2) _______________________________| | |
1987 Offset in bits from start of class ________________________| |
1988 Type number of base class ____________________________________|
1989
1990 Return true for success, false for failure. */
1991
1992 static boolean
1993 parse_stab_baseclasses (dhandle, info, pp, retp)
1994 PTR dhandle;
1995 struct stab_handle *info;
1996 const char **pp;
1997 debug_baseclass **retp;
1998 {
1999 const char *orig;
2000 unsigned int c, i;
2001 debug_baseclass *classes;
2002
2003 *retp = NULL;
2004
2005 orig = *pp;
2006
2007 if (**pp != '!')
2008 {
2009 /* No base classes. */
2010 return true;
2011 }
2012 ++*pp;
2013
2014 c = (unsigned int) parse_number (pp, (boolean *) NULL);
2015
2016 if (**pp != ',')
2017 {
2018 bad_stab (orig);
2019 return false;
2020 }
2021 ++*pp;
2022
2023 classes = (debug_baseclass *) xmalloc ((c + 1) * sizeof (**retp));
2024
2025 for (i = 0; i < c; i++)
2026 {
2027 boolean virtual;
2028 enum debug_visibility visibility;
2029 bfd_vma bitpos;
2030 debug_type type;
2031
2032 switch (**pp)
2033 {
2034 case '0':
2035 virtual = false;
2036 break;
2037 case '1':
2038 virtual = true;
2039 break;
2040 default:
2041 warn_stab (orig, "unknown virtual character for baseclass");
2042 virtual = false;
2043 break;
2044 }
2045 ++*pp;
2046
2047 switch (**pp)
2048 {
2049 case '0':
2050 visibility = DEBUG_VISIBILITY_PRIVATE;
2051 break;
2052 case '1':
2053 visibility = DEBUG_VISIBILITY_PROTECTED;
2054 break;
2055 case '2':
2056 visibility = DEBUG_VISIBILITY_PUBLIC;
2057 break;
2058 default:
2059 warn_stab (orig, "unknown visibility character for baseclass");
2060 visibility = DEBUG_VISIBILITY_PUBLIC;
2061 break;
2062 }
2063 ++*pp;
2064
2065 /* The remaining value is the bit offset of the portion of the
2066 object corresponding to this baseclass. Always zero in the
2067 absence of multiple inheritance. */
2068 bitpos = parse_number (pp, (boolean *) NULL);
2069 if (**pp != ',')
2070 {
2071 bad_stab (orig);
2072 return false;
2073 }
2074 ++*pp;
2075
2076 type = parse_stab_type (dhandle, info, (const char *) NULL, pp,
2077 (debug_type **) NULL);
2078 if (type == DEBUG_TYPE_NULL)
2079 return false;
2080
2081 classes[i] = debug_make_baseclass (dhandle, type, bitpos, virtual,
2082 visibility);
2083 if (classes[i] == DEBUG_BASECLASS_NULL)
2084 return false;
2085
2086 if (**pp != ';')
2087 return false;
2088 ++*pp;
2089 }
2090
2091 classes[i] = DEBUG_BASECLASS_NULL;
2092
2093 *retp = classes;
2094
2095 return true;
2096 }
2097
2098 /* Read struct or class data fields. They have the form:
2099
2100 NAME : [VISIBILITY] TYPENUM , BITPOS , BITSIZE ;
2101
2102 At the end, we see a semicolon instead of a field.
2103
2104 In C++, this may wind up being NAME:?TYPENUM:PHYSNAME; for
2105 a static field.
2106
2107 The optional VISIBILITY is one of:
2108
2109 '/0' (VISIBILITY_PRIVATE)
2110 '/1' (VISIBILITY_PROTECTED)
2111 '/2' (VISIBILITY_PUBLIC)
2112 '/9' (VISIBILITY_IGNORE)
2113
2114 or nothing, for C style fields with public visibility.
2115
2116 Returns 1 for success, 0 for failure. */
2117
2118 static boolean
2119 parse_stab_struct_fields (dhandle, info, pp, retp, staticsp)
2120 PTR dhandle;
2121 struct stab_handle *info;
2122 const char **pp;
2123 debug_field **retp;
2124 boolean *staticsp;
2125 {
2126 const char *orig;
2127 const char *p;
2128 debug_field *fields;
2129 unsigned int c;
2130 unsigned int alloc;
2131
2132 *retp = NULL;
2133 *staticsp = false;
2134
2135 orig = *pp;
2136
2137 c = 0;
2138 alloc = 10;
2139 fields = (debug_field *) xmalloc (alloc * sizeof *fields);
2140 while (**pp != ';')
2141 {
2142 /* FIXME: gdb checks os9k_stabs here. */
2143
2144 p = *pp;
2145
2146 /* Add 1 to c to leave room for NULL pointer at end. */
2147 if (c + 1 >= alloc)
2148 {
2149 alloc += 10;
2150 fields = ((debug_field *)
2151 xrealloc ((PTR) fields, alloc * sizeof *fields));
2152 }
2153
2154 /* If it starts with CPLUS_MARKER it is a special abbreviation,
2155 unless the CPLUS_MARKER is followed by an underscore, in
2156 which case it is just the name of an anonymous type, which we
2157 should handle like any other type name. We accept either '$'
2158 or '.', because a field name can never contain one of these
2159 characters except as a CPLUS_MARKER. */
2160
2161 if ((*p == '$' || *p == '.') && p[1] != '_')
2162 {
2163 ++*pp;
2164 if (! parse_stab_cpp_abbrev (dhandle, info, pp, fields + c))
2165 return false;
2166 ++c;
2167 continue;
2168 }
2169
2170 /* Look for the ':' that separates the field name from the field
2171 values. Data members are delimited by a single ':', while member
2172 functions are delimited by a pair of ':'s. When we hit the member
2173 functions (if any), terminate scan loop and return. */
2174
2175 p = strchr (p, ':');
2176 if (p == NULL)
2177 {
2178 bad_stab (orig);
2179 return false;
2180 }
2181
2182 if (p[1] == ':')
2183 break;
2184
2185 if (! parse_stab_one_struct_field (dhandle, info, pp, p, fields + c,
2186 staticsp))
2187 return false;
2188
2189 ++c;
2190 }
2191
2192 fields[c] = DEBUG_FIELD_NULL;
2193
2194 *retp = fields;
2195
2196 return true;
2197 }
2198
2199 /* Special GNU C++ name. */
2200
2201 static boolean
2202 parse_stab_cpp_abbrev (dhandle, info, pp, retp)
2203 PTR dhandle;
2204 struct stab_handle *info;
2205 const char **pp;
2206 debug_field *retp;
2207 {
2208 const char *orig;
2209 int cpp_abbrev;
2210 debug_type context;
2211 const char *name;
2212 const char *typename;
2213 debug_type type;
2214 bfd_vma bitpos;
2215
2216 *retp = DEBUG_FIELD_NULL;
2217
2218 orig = *pp;
2219
2220 if (**pp != 'v')
2221 {
2222 bad_stab (*pp);
2223 return false;
2224 }
2225 ++*pp;
2226
2227 cpp_abbrev = **pp;
2228 ++*pp;
2229
2230 /* At this point, *pp points to something like "22:23=*22...", where
2231 the type number before the ':' is the "context" and everything
2232 after is a regular type definition. Lookup the type, find it's
2233 name, and construct the field name. */
2234
2235 context = parse_stab_type (dhandle, info, (const char *) NULL, pp,
2236 (debug_type **) NULL);
2237 if (context == DEBUG_TYPE_NULL)
2238 return false;
2239
2240 switch (cpp_abbrev)
2241 {
2242 case 'f':
2243 /* $vf -- a virtual function table pointer. */
2244 name = "_vptr$";
2245 break;
2246 case 'b':
2247 /* $vb -- a virtual bsomethingorother */
2248 typename = debug_get_type_name (dhandle, context);
2249 if (typename == NULL)
2250 {
2251 warn_stab (orig, "unnamed $vb type");
2252 typename = "FOO";
2253 }
2254 name = concat ("_vb$", typename, (const char *) NULL);
2255 break;
2256 default:
2257 warn_stab (orig, "unrecognized C++ abbreviation");
2258 name = "INVALID_CPLUSPLUS_ABBREV";
2259 break;
2260 }
2261
2262 if (**pp != ':')
2263 {
2264 bad_stab (orig);
2265 return false;
2266 }
2267 ++*pp;
2268
2269 type = parse_stab_type (dhandle, info, (const char *) NULL, pp,
2270 (debug_type **) NULL);
2271 if (**pp != ',')
2272 {
2273 bad_stab (orig);
2274 return false;
2275 }
2276 ++*pp;
2277
2278 bitpos = parse_number (pp, (boolean *) NULL);
2279 if (**pp != ';')
2280 {
2281 bad_stab (orig);
2282 return false;
2283 }
2284 ++*pp;
2285
2286 *retp = debug_make_field (dhandle, name, type, bitpos, 0,
2287 DEBUG_VISIBILITY_PRIVATE);
2288 if (*retp == DEBUG_FIELD_NULL)
2289 return false;
2290
2291 return true;
2292 }
2293
2294 /* Parse a single field in a struct or union. */
2295
2296 static boolean
2297 parse_stab_one_struct_field (dhandle, info, pp, p, retp, staticsp)
2298 PTR dhandle;
2299 struct stab_handle *info;
2300 const char **pp;
2301 const char *p;
2302 debug_field *retp;
2303 boolean *staticsp;
2304 {
2305 const char *orig;
2306 char *name;
2307 enum debug_visibility visibility;
2308 debug_type type;
2309 bfd_vma bitpos;
2310 bfd_vma bitsize;
2311
2312 orig = *pp;
2313
2314 /* FIXME: gdb checks ARM_DEMANGLING here. */
2315
2316 name = savestring (*pp, p - *pp);
2317
2318 *pp = p + 1;
2319
2320 if (**pp != '/')
2321 visibility = DEBUG_VISIBILITY_PUBLIC;
2322 else
2323 {
2324 ++*pp;
2325 switch (**pp)
2326 {
2327 case '0':
2328 visibility = DEBUG_VISIBILITY_PRIVATE;
2329 break;
2330 case '1':
2331 visibility = DEBUG_VISIBILITY_PROTECTED;
2332 break;
2333 case '2':
2334 visibility = DEBUG_VISIBILITY_PUBLIC;
2335 break;
2336 default:
2337 warn_stab (orig, "unknown visibility character for field");
2338 visibility = DEBUG_VISIBILITY_PUBLIC;
2339 break;
2340 }
2341 ++*pp;
2342 }
2343
2344 type = parse_stab_type (dhandle, info, (const char *) NULL, pp,
2345 (debug_type **) NULL);
2346 if (type == DEBUG_TYPE_NULL)
2347 return false;
2348
2349 if (**pp == ':')
2350 {
2351 char *varname;
2352
2353 /* This is a static class member. */
2354 ++*pp;
2355 p = strchr (*pp, ';');
2356 if (p == NULL)
2357 {
2358 bad_stab (orig);
2359 return false;
2360 }
2361
2362 varname = savestring (*pp, p - *pp);
2363
2364 *pp = p + 1;
2365
2366 *retp = debug_make_static_member (dhandle, name, type, varname,
2367 visibility);
2368 *staticsp = true;
2369
2370 return true;
2371 }
2372
2373 if (**pp != ',')
2374 {
2375 bad_stab (orig);
2376 return false;
2377 }
2378 ++*pp;
2379
2380 bitpos = parse_number (pp, (boolean *) NULL);
2381 if (**pp != ',')
2382 {
2383 bad_stab (orig);
2384 return false;
2385 }
2386 ++*pp;
2387
2388 bitsize = parse_number (pp, (boolean *) NULL);
2389 if (**pp != ';')
2390 {
2391 bad_stab (orig);
2392 return false;
2393 }
2394 ++*pp;
2395
2396 if (bitpos == 0 && bitsize == 0)
2397 {
2398 /* This can happen in two cases: (1) at least for gcc 2.4.5 or
2399 so, it is a field which has been optimized out. The correct
2400 stab for this case is to use VISIBILITY_IGNORE, but that is a
2401 recent invention. (2) It is a 0-size array. For example
2402 union { int num; char str[0]; } foo. Printing "<no value>"
2403 for str in "p foo" is OK, since foo.str (and thus foo.str[3])
2404 will continue to work, and a 0-size array as a whole doesn't
2405 have any contents to print.
2406
2407 I suspect this probably could also happen with gcc -gstabs
2408 (not -gstabs+) for static fields, and perhaps other C++
2409 extensions. Hopefully few people use -gstabs with gdb, since
2410 it is intended for dbx compatibility. */
2411 visibility = DEBUG_VISIBILITY_IGNORE;
2412 }
2413
2414 /* FIXME: gdb does some stuff here to mark fields as unpacked. */
2415
2416 *retp = debug_make_field (dhandle, name, type, bitpos, bitsize, visibility);
2417
2418 return true;
2419 }
2420
2421 /* Read member function stabs info for C++ classes. The form of each member
2422 function data is:
2423
2424 NAME :: TYPENUM[=type definition] ARGS : PHYSNAME ;
2425
2426 An example with two member functions is:
2427
2428 afunc1::20=##15;:i;2A.;afunc2::20:i;2A.;
2429
2430 For the case of overloaded operators, the format is op$::*.funcs, where
2431 $ is the CPLUS_MARKER (usually '$'), `*' holds the place for an operator
2432 name (such as `+=') and `.' marks the end of the operator name. */
2433
2434 static boolean
2435 parse_stab_members (dhandle, info, pp, retp)
2436 PTR dhandle;
2437 struct stab_handle *info;
2438 const char **pp;
2439 debug_method **retp;
2440 {
2441 const char *orig;
2442 debug_method *methods;
2443 unsigned int c;
2444 unsigned int alloc;
2445
2446 *retp = NULL;
2447
2448 orig = *pp;
2449
2450 alloc = 0;
2451 methods = NULL;
2452 c = 0;
2453
2454 while (**pp != ';')
2455 {
2456 const char *p;
2457 char *name;
2458 debug_method_variant *variants;
2459 unsigned int cvars;
2460 unsigned int allocvars;
2461 debug_type look_ahead_type;
2462
2463 p = strchr (*pp, ':');
2464 if (p == NULL || p[1] != ':')
2465 break;
2466
2467 /* FIXME: Some systems use something other than '$' here. */
2468 if ((*pp)[0] != 'o' || (*pp)[1] != 'p' || (*pp)[2] != '$')
2469 {
2470 name = savestring (*pp, p - *pp);
2471 *pp = p + 2;
2472 }
2473 else
2474 {
2475 /* This is a completely wierd case. In order to stuff in the
2476 names that might contain colons (the usual name delimiter),
2477 Mike Tiemann defined a different name format which is
2478 signalled if the identifier is "op$". In that case, the
2479 format is "op$::XXXX." where XXXX is the name. This is
2480 used for names like "+" or "=". YUUUUUUUK! FIXME! */
2481 *pp = p + 2;
2482 for (p = *pp; *p != '.' && *p != '\0'; p++)
2483 ;
2484 if (*p != '.')
2485 {
2486 bad_stab (orig);
2487 return false;
2488 }
2489 name = savestring (*pp, p - *pp);
2490 *pp = p + 1;
2491 }
2492
2493 allocvars = 10;
2494 variants = ((debug_method_variant *)
2495 xmalloc (allocvars * sizeof *variants));
2496 cvars = 0;
2497
2498 look_ahead_type = DEBUG_TYPE_NULL;
2499
2500 do
2501 {
2502 debug_type type;
2503 char *argtypes;
2504 enum debug_visibility visibility;
2505 boolean constp, volatilep, staticp;
2506 bfd_vma voffset;
2507 debug_type context;
2508
2509 if (look_ahead_type != DEBUG_TYPE_NULL)
2510 {
2511 /* g++ version 1 kludge */
2512 type = look_ahead_type;
2513 look_ahead_type = DEBUG_TYPE_NULL;
2514 }
2515 else
2516 {
2517 type = parse_stab_type (dhandle, info, (const char *) NULL, pp,
2518 (debug_type **) NULL);
2519 if (type == DEBUG_TYPE_NULL)
2520 return false;
2521 if (**pp != ':')
2522 {
2523 bad_stab (orig);
2524 return false;
2525 }
2526 }
2527
2528 ++*pp;
2529 p = strchr (*pp, ';');
2530 if (p == NULL)
2531 {
2532 bad_stab (orig);
2533 return false;
2534 }
2535
2536 /* FIXME: gdb sets is_stub here. */
2537
2538 argtypes = savestring (*pp, p - *pp);
2539 *pp = p + 1;
2540
2541 switch (**pp)
2542 {
2543 case '0':
2544 visibility = DEBUG_VISIBILITY_PRIVATE;
2545 break;
2546 case '1':
2547 visibility = DEBUG_VISIBILITY_PROTECTED;
2548 break;
2549 default:
2550 visibility = DEBUG_VISIBILITY_PUBLIC;
2551 break;
2552 }
2553 ++*pp;
2554
2555 constp = false;
2556 volatilep = false;
2557 switch (**pp)
2558 {
2559 case 'A':
2560 /* Normal function. */
2561 ++*pp;
2562 break;
2563 case 'B':
2564 /* const member function. */
2565 constp = true;
2566 ++*pp;
2567 break;
2568 case 'C':
2569 /* volatile member function. */
2570 volatilep = true;
2571 ++*pp;
2572 break;
2573 case 'D':
2574 /* const volatile member function. */
2575 constp = true;
2576 volatilep = true;
2577 ++*pp;
2578 break;
2579 case '*':
2580 case '?':
2581 case '.':
2582 /* File compiled with g++ version 1; no information. */
2583 break;
2584 default:
2585 warn_stab (orig, "const/volatile indicator missing");
2586 break;
2587 }
2588
2589 staticp = false;
2590 switch (**pp)
2591 {
2592 case '*':
2593 /* virtual member function, followed by index. The sign
2594 bit is set to distinguish pointers-to-methods from
2595 virtual function indicies. Since the array is in
2596 words, the quantity must be shifted left by 1 on 16
2597 bit machine, and by 2 on 32 bit machine, forcing the
2598 sign bit out, and usable as a valid index into the
2599 array. Remove the sign bit here. */
2600 ++*pp;
2601 voffset = parse_number (pp, (boolean *) NULL);
2602 if (**pp != ';')
2603 {
2604 bad_stab (orig);
2605 return false;
2606 }
2607 ++*pp;
2608 voffset &= 0x7fffffff;
2609 voffset += 2;
2610
2611 if (**pp == ';' || *pp == '\0')
2612 {
2613 /* Must be g++ version 1. */
2614 context = DEBUG_TYPE_NULL;
2615 }
2616 else
2617 {
2618 /* Figure out from whence this virtual function
2619 came. It may belong to virtual function table of
2620 one of its baseclasses. */
2621 look_ahead_type = parse_stab_type (dhandle, info,
2622 (const char *) NULL,
2623 pp,
2624 (debug_type **) NULL);
2625 if (**pp == ':')
2626 {
2627 /* g++ version 1 overloaded methods. */
2628 }
2629 else
2630 {
2631 context = look_ahead_type;
2632 look_ahead_type = DEBUG_TYPE_NULL;
2633 if (**pp != ';')
2634 {
2635 bad_stab (orig);
2636 return false;
2637 }
2638 ++*pp;
2639 }
2640 }
2641 break;
2642
2643 case '?':
2644 /* static member function. */
2645 ++*pp;
2646 staticp = true;
2647 voffset = 0;
2648 /* FIXME: gdb sets is_stub here. */
2649 context = DEBUG_TYPE_NULL;
2650 break;
2651
2652 default:
2653 warn_stab (orig, "member function type missing");
2654 voffset = 0;
2655 context = DEBUG_TYPE_NULL;
2656 break;
2657
2658 case '.':
2659 ++*pp;
2660 voffset = 0;
2661 context = DEBUG_TYPE_NULL;
2662 break;
2663 }
2664
2665 if (cvars + 1 >= allocvars)
2666 {
2667 allocvars += 10;
2668 variants = ((debug_method_variant *)
2669 xrealloc ((PTR) variants,
2670 allocvars * sizeof *variants));
2671 }
2672
2673 if (! staticp)
2674 variants[cvars] = debug_make_method_variant (dhandle, argtypes,
2675 type, visibility,
2676 constp, volatilep,
2677 voffset, context);
2678 else
2679 variants[cvars] = debug_make_static_method_variant (dhandle,
2680 argtypes,
2681 type,
2682 visibility,
2683 constp,
2684 volatilep);
2685 if (variants[cvars] == DEBUG_METHOD_VARIANT_NULL)
2686 return false;
2687
2688 ++cvars;
2689 }
2690 while (**pp != ';' && **pp != '\0');
2691
2692 variants[cvars] = DEBUG_METHOD_VARIANT_NULL;
2693
2694 if (**pp != '\0')
2695 ++*pp;
2696
2697 if (c + 1 >= alloc)
2698 {
2699 alloc += 10;
2700 methods = ((debug_method *)
2701 xrealloc ((PTR) methods, alloc * sizeof *methods));
2702 }
2703
2704 methods[c] = debug_make_method (dhandle, name, variants);
2705
2706 ++c;
2707 }
2708
2709 if (methods != NULL)
2710 methods[c] = DEBUG_METHOD_NULL;
2711
2712 *retp = methods;
2713
2714 return true;
2715 }
2716
2717 /* The tail end of stabs for C++ classes that contain a virtual function
2718 pointer contains a tilde, a %, and a type number.
2719 The type number refers to the base class (possibly this class itself) which
2720 contains the vtable pointer for the current class.
2721
2722 This function is called when we have parsed all the method declarations,
2723 so we can look for the vptr base class info. */
2724
2725 static boolean
2726 parse_stab_tilde_field (dhandle, info, pp, typenums, retvptrbase, retownvptr)
2727 PTR dhandle;
2728 struct stab_handle *info;
2729 const char **pp;
2730 const int *typenums;
2731 debug_type *retvptrbase;
2732 boolean *retownvptr;
2733 {
2734 const char *orig;
2735 const char *hold;
2736 int vtypenums[2];
2737
2738 *retvptrbase = DEBUG_TYPE_NULL;
2739 *retownvptr = false;
2740
2741 orig = *pp;
2742
2743 /* If we are positioned at a ';', then skip it. */
2744 if (**pp == ';')
2745 ++*pp;
2746
2747 if (**pp != '~')
2748 return true;
2749
2750 ++*pp;
2751
2752 if (**pp == '=' || **pp == '+' || **pp == '-')
2753 {
2754 /* Obsolete flags that used to indicate the presence of
2755 constructors and/or destructors. */
2756 ++*pp;
2757 }
2758
2759 if (**pp != '%')
2760 return true;
2761
2762 ++*pp;
2763
2764 hold = *pp;
2765
2766 /* The next number is the type number of the base class (possibly
2767 our own class) which supplies the vtable for this class. */
2768 if (! parse_stab_type_number (pp, vtypenums))
2769 return false;
2770
2771 if (vtypenums[0] == typenums[0]
2772 && vtypenums[1] == typenums[1])
2773 *retownvptr = true;
2774 else
2775 {
2776 debug_type vtype;
2777 const char *p;
2778
2779 *pp = hold;
2780
2781 vtype = parse_stab_type (dhandle, info, (const char *) NULL, pp,
2782 (debug_type **) NULL);
2783 for (p = *pp; *p != ';' && *p != '\0'; p++)
2784 ;
2785 if (*p != ';')
2786 {
2787 bad_stab (orig);
2788 return false;
2789 }
2790
2791 *retvptrbase = vtype;
2792
2793 *pp = p + 1;
2794 }
2795
2796 return true;
2797 }
2798
2799 /* Read a definition of an array type. */
2800
2801 static debug_type
2802 parse_stab_array_type (dhandle, info, pp, stringp)
2803 PTR dhandle;
2804 struct stab_handle *info;
2805 const char **pp;
2806 boolean stringp;
2807 {
2808 const char *orig;
2809 debug_type index_type;
2810 boolean adjustable;
2811 bfd_signed_vma lower, upper;
2812 debug_type element_type;
2813
2814 /* Format of an array type:
2815 "ar<index type>;lower;upper;<array_contents_type>".
2816 OS9000: "arlower,upper;<array_contents_type>".
2817
2818 Fortran adjustable arrays use Adigits or Tdigits for lower or upper;
2819 for these, produce a type like float[][]. */
2820
2821 orig = *pp;
2822
2823 /* FIXME: gdb checks os9k_stabs here. */
2824
2825 index_type = parse_stab_type (dhandle, info, (const char *) NULL, pp,
2826 (debug_type **) NULL);
2827 if (**pp != ';')
2828 {
2829 bad_stab (orig);
2830 return DEBUG_TYPE_NULL;
2831 }
2832 ++*pp;
2833
2834 adjustable = false;
2835
2836 if (! isdigit ((unsigned char) **pp) && **pp != '-')
2837 {
2838 ++*pp;
2839 adjustable = true;
2840 }
2841
2842 lower = (bfd_signed_vma) parse_number (pp, (boolean *) NULL);
2843 if (**pp != ';')
2844 {
2845 bad_stab (orig);
2846 return false;
2847 }
2848 ++*pp;
2849
2850 if (! isdigit ((unsigned char) **pp) && **pp != '-')
2851 {
2852 ++*pp;
2853 adjustable = true;
2854 }
2855
2856 upper = (bfd_signed_vma) parse_number (pp, (boolean *) NULL);
2857 if (**pp != ';')
2858 {
2859 bad_stab (orig);
2860 return false;
2861 }
2862 ++*pp;
2863
2864 element_type = parse_stab_type (dhandle, info, (const char *) NULL, pp,
2865 (debug_type **) NULL);
2866 if (element_type == DEBUG_TYPE_NULL)
2867 return false;
2868
2869 if (adjustable)
2870 {
2871 lower = 0;
2872 upper = -1;
2873 }
2874
2875 return debug_make_array_type (dhandle, element_type, index_type, lower,
2876 upper, stringp);
2877 }
2878
2879 /* Keep a stack of N_BINCL include files. */
2880
2881 struct bincl_file
2882 {
2883 struct bincl_file *next;
2884 const char *name;
2885 };
2886
2887 /* Start a new N_BINCL file, pushing it onto the stack. */
2888
2889 static void
2890 push_bincl (info, name)
2891 struct stab_handle *info;
2892 const char *name;
2893 {
2894 struct bincl_file *n;
2895
2896 n = (struct bincl_file *) xmalloc (sizeof *n);
2897 n->next = info->bincl_stack;
2898 n->name = name;
2899 info->bincl_stack = n;
2900
2901 ++info->files;
2902 info->file_types = ((struct stab_types **)
2903 xrealloc ((PTR) info->file_types,
2904 (info->files
2905 * sizeof *info->file_types)));
2906 info->file_types[info->files - 1] = NULL;
2907 }
2908
2909 /* Finish an N_BINCL file, at an N_EINCL, popping the name off the
2910 stack. */
2911
2912 static const char *
2913 pop_bincl (info)
2914 struct stab_handle *info;
2915 {
2916 struct bincl_file *o;
2917
2918 o = info->bincl_stack;
2919 if (o == NULL)
2920 return info->main_filename;
2921 info->bincl_stack = o->next;
2922 free (o);
2923 if (info->bincl_stack == NULL)
2924 return info->main_filename;
2925 return info->bincl_stack->name;
2926 }
2927
2928 /* Handle a variable definition. gcc emits variable definitions for a
2929 block before the N_LBRAC, so we must hold onto them until we see
2930 it. The SunPRO compiler emits variable definitions after the
2931 N_LBRAC, so we can call debug_record_variable immediately. */
2932
2933 static boolean
2934 stab_record_variable (dhandle, info, name, type, kind, val)
2935 PTR dhandle;
2936 struct stab_handle *info;
2937 const char *name;
2938 debug_type type;
2939 enum debug_var_kind kind;
2940 bfd_vma val;
2941 {
2942 struct stab_pending_var *v;
2943
2944 if (! info->within_function
2945 || (info->gcc_compiled == 0 && info->n_opt_found))
2946 return debug_record_variable (dhandle, name, type, kind, val);
2947
2948 v = (struct stab_pending_var *) xmalloc (sizeof *v);
2949 memset (v, 0, sizeof *v);
2950
2951 v->next = info->pending;
2952 v->name = name;
2953 v->type = type;
2954 v->kind = kind;
2955 v->val = val;
2956 info->pending = v;
2957
2958 return true;
2959 }
2960
2961 /* Emit pending variable definitions. This is called after we see the
2962 N_LBRAC that starts the block. */
2963
2964 static boolean
2965 stab_emit_pending_vars (dhandle, info)
2966 PTR dhandle;
2967 struct stab_handle *info;
2968 {
2969 struct stab_pending_var *v;
2970
2971 v = info->pending;
2972 while (v != NULL)
2973 {
2974 struct stab_pending_var *next;
2975
2976 if (! debug_record_variable (dhandle, v->name, v->type, v->kind, v->val))
2977 return false;
2978
2979 next = v->next;
2980 free (v);
2981 v = next;
2982 }
2983
2984 info->pending = NULL;
2985
2986 return true;
2987 }
2988
2989 /* Find the slot for a type in the database. */
2990
2991 static debug_type *
2992 stab_find_slot (info, typenums)
2993 struct stab_handle *info;
2994 const int *typenums;
2995 {
2996 int filenum;
2997 int index;
2998 struct stab_types **ps;
2999
3000 filenum = typenums[0];
3001 index = typenums[1];
3002
3003 if (filenum < 0 || (unsigned int) filenum >= info->files)
3004 {
3005 fprintf (stderr, "Type file number %d out of range\n", filenum);
3006 return NULL;
3007 }
3008 if (index < 0)
3009 {
3010 fprintf (stderr, "Type index number %d out of range\n", index);
3011 return NULL;
3012 }
3013
3014 ps = info->file_types + filenum;
3015
3016 while (index >= STAB_TYPES_SLOTS)
3017 {
3018 if (*ps == NULL)
3019 {
3020 *ps = (struct stab_types *) xmalloc (sizeof **ps);
3021 memset (*ps, 0, sizeof **ps);
3022 }
3023 ps = &(*ps)->next;
3024 index -= STAB_TYPES_SLOTS;
3025 }
3026 if (*ps == NULL)
3027 {
3028 *ps = (struct stab_types *) xmalloc (sizeof **ps);
3029 memset (*ps, 0, sizeof **ps);
3030 }
3031
3032 return (*ps)->types + index;
3033 }
3034
3035 /* Find a type given a type number. If the type has not been
3036 allocated yet, create an indirect type. */
3037
3038 static debug_type
3039 stab_find_type (dhandle, info, typenums)
3040 PTR dhandle;
3041 struct stab_handle *info;
3042 const int *typenums;
3043 {
3044 debug_type *slot;
3045
3046 if (typenums[0] == 0 && typenums[1] < 0)
3047 {
3048 /* A negative type number indicates an XCOFF builtin type. */
3049 return stab_xcoff_builtin_type (dhandle, info, typenums[1]);
3050 }
3051
3052 slot = stab_find_slot (info, typenums);
3053 if (slot == NULL)
3054 return DEBUG_TYPE_NULL;
3055
3056 if (*slot == DEBUG_TYPE_NULL)
3057 return debug_make_indirect_type (dhandle, slot, (const char *) NULL);
3058
3059 return *slot;
3060 }
3061
3062 /* Record that a given type number refers to a given type. */
3063
3064 static boolean
3065 stab_record_type (dhandle, info, typenums, type)
3066 PTR dhandle;
3067 struct stab_handle *info;
3068 const int *typenums;
3069 debug_type type;
3070 {
3071 debug_type *slot;
3072
3073 slot = stab_find_slot (info, typenums);
3074 if (slot == NULL)
3075 return false;
3076
3077 /* gdb appears to ignore type redefinitions, so we do as well. */
3078
3079 *slot = type;
3080
3081 return true;
3082 }
3083
3084 /* Return an XCOFF builtin type. */
3085
3086 static debug_type
3087 stab_xcoff_builtin_type (dhandle, info, typenum)
3088 PTR dhandle;
3089 struct stab_handle *info;
3090 int typenum;
3091 {
3092 debug_type rettype;
3093 const char *name;
3094
3095 if (typenum >= 0 || typenum < -XCOFF_TYPE_COUNT)
3096 {
3097 fprintf (stderr, "Unrecognized XCOFF type %d\n", typenum);
3098 return DEBUG_TYPE_NULL;
3099 }
3100 if (info->xcoff_types[-typenum] != NULL)
3101 return info->xcoff_types[-typenum];
3102
3103 switch (-typenum)
3104 {
3105 case 1:
3106 /* The size of this and all the other types are fixed, defined
3107 by the debugging format. */
3108 name = "int";
3109 rettype = debug_make_int_type (dhandle, 4, false);
3110 break;
3111 case 2:
3112 name = "char";
3113 rettype = debug_make_int_type (dhandle, 1, false);
3114 break;
3115 case 3:
3116 name = "short";
3117 rettype = debug_make_int_type (dhandle, 2, false);
3118 break;
3119 case 4:
3120 name = "long";
3121 rettype = debug_make_int_type (dhandle, 4, false);
3122 break;
3123 case 5:
3124 name = "unsigned char";
3125 rettype = debug_make_int_type (dhandle, 1, true);
3126 break;
3127 case 6:
3128 name = "signed char";
3129 rettype = debug_make_int_type (dhandle, 1, false);
3130 break;
3131 case 7:
3132 name = "unsigned short";
3133 rettype = debug_make_int_type (dhandle, 2, true);
3134 break;
3135 case 8:
3136 name = "unsigned int";
3137 rettype = debug_make_int_type (dhandle, 4, true);
3138 break;
3139 case 9:
3140 name = "unsigned";
3141 rettype = debug_make_int_type (dhandle, 4, true);
3142 case 10:
3143 name = "unsigned long";
3144 rettype = debug_make_int_type (dhandle, 4, true);
3145 break;
3146 case 11:
3147 name = "void";
3148 rettype = debug_make_void_type (dhandle);
3149 break;
3150 case 12:
3151 /* IEEE single precision (32 bit). */
3152 name = "float";
3153 rettype = debug_make_float_type (dhandle, 4);
3154 break;
3155 case 13:
3156 /* IEEE double precision (64 bit). */
3157 name = "double";
3158 rettype = debug_make_float_type (dhandle, 8);
3159 break;
3160 case 14:
3161 /* This is an IEEE double on the RS/6000, and different machines
3162 with different sizes for "long double" should use different
3163 negative type numbers. See stabs.texinfo. */
3164 name = "long double";
3165 rettype = debug_make_float_type (dhandle, 8);
3166 break;
3167 case 15:
3168 name = "integer";
3169 rettype = debug_make_int_type (dhandle, 4, false);
3170 break;
3171 case 16:
3172 name = "boolean";
3173 rettype = debug_make_bool_type (dhandle, 4);
3174 break;
3175 case 17:
3176 name = "short real";
3177 rettype = debug_make_float_type (dhandle, 4);
3178 break;
3179 case 18:
3180 name = "real";
3181 rettype = debug_make_float_type (dhandle, 8);
3182 break;
3183 case 19:
3184 /* FIXME */
3185 name = "stringptr";
3186 rettype = NULL;
3187 break;
3188 case 20:
3189 /* FIXME */
3190 name = "character";
3191 rettype = debug_make_int_type (dhandle, 1, true);
3192 break;
3193 case 21:
3194 name = "logical*1";
3195 rettype = debug_make_bool_type (dhandle, 1);
3196 break;
3197 case 22:
3198 name = "logical*2";
3199 rettype = debug_make_bool_type (dhandle, 2);
3200 break;
3201 case 23:
3202 name = "logical*4";
3203 rettype = debug_make_bool_type (dhandle, 4);
3204 break;
3205 case 24:
3206 name = "logical";
3207 rettype = debug_make_bool_type (dhandle, 4);
3208 break;
3209 case 25:
3210 /* Complex type consisting of two IEEE single precision values. */
3211 name = "complex";
3212 rettype = debug_make_complex_type (dhandle, 8);
3213 break;
3214 case 26:
3215 /* Complex type consisting of two IEEE double precision values. */
3216 name = "double complex";
3217 rettype = debug_make_complex_type (dhandle, 16);
3218 break;
3219 case 27:
3220 name = "integer*1";
3221 rettype = debug_make_int_type (dhandle, 1, false);
3222 break;
3223 case 28:
3224 name = "integer*2";
3225 rettype = debug_make_int_type (dhandle, 2, false);
3226 break;
3227 case 29:
3228 name = "integer*4";
3229 rettype = debug_make_int_type (dhandle, 4, false);
3230 break;
3231 case 30:
3232 /* FIXME */
3233 name = "wchar";
3234 rettype = debug_make_int_type (dhandle, 2, false);
3235 break;
3236 case 31:
3237 name = "long long";
3238 rettype = debug_make_int_type (dhandle, 8, false);
3239 break;
3240 case 32:
3241 name = "unsigned long long";
3242 rettype = debug_make_int_type (dhandle, 8, true);
3243 break;
3244 case 33:
3245 name = "logical*8";
3246 rettype = debug_make_bool_type (dhandle, 8);
3247 break;
3248 case 34:
3249 name = "integer*8";
3250 rettype = debug_make_int_type (dhandle, 8, false);
3251 break;
3252 default:
3253 abort ();
3254 }
3255
3256 rettype = debug_name_type (dhandle, name, rettype);
3257
3258 info->xcoff_types[-typenum] = rettype;
3259
3260 return rettype;
3261 }
This page took 0.193285 seconds and 5 git commands to generate.