merge from gcc
[binutils.git] / binutils / rdcoff.c
blobcca9b0e64be07a79aba35a771faa8f3461a7544c
1 /* stabs.c -- Parse COFF debugging information
2 Copyright 1996, 2000, 2002 Free Software Foundation, Inc.
3 Written by Ian Lance Taylor <ian@cygnus.com>.
5 This file is part of GNU Binutils.
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.
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.
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. */
22 /* This file contains code which parses COFF debugging information. */
24 #include "bfd.h"
25 #include "coff/internal.h"
26 #include "bucomm.h"
27 #include "libiberty.h"
28 #include "debug.h"
29 #include "budbg.h"
31 /* FIXME: We should not need this BFD internal file. We need it for
32 the N_BTMASK, etc., values. */
33 #include "libcoff.h"
35 /* These macros extract the right mask and shifts for this BFD. They
36 assume that there is a local variable named ABFD. This is so that
37 macros like ISFCN and DECREF, from coff/internal.h, will work
38 without modification. */
39 #define N_BTMASK (coff_data (abfd)->local_n_btmask)
40 #define N_BTSHFT (coff_data (abfd)->local_n_btshft)
41 #define N_TMASK (coff_data (abfd)->local_n_tmask)
42 #define N_TSHIFT (coff_data (abfd)->local_n_tshift)
44 /* This structure is used to hold the symbols, as well as the current
45 location within the symbols. */
47 struct coff_symbols
49 /* The symbols. */
50 asymbol **syms;
51 /* The number of symbols. */
52 long symcount;
53 /* The index of the current symbol. */
54 long symno;
55 /* The index of the current symbol in the COFF symbol table (where
56 each auxent counts as a symbol). */
57 long coff_symno;
60 /* The largest basic type we are prepared to handle. */
62 #define T_MAX (T_LNGDBL)
64 /* This structure is used to hold slots. */
66 struct coff_slots
68 /* Next set of slots. */
69 struct coff_slots *next;
70 /* Slots. */
71 #define COFF_SLOTS (16)
72 debug_type slots[COFF_SLOTS];
75 /* This structure is used to map symbol indices to types. */
77 struct coff_types
79 /* Slots. */
80 struct coff_slots *slots;
81 /* Basic types. */
82 debug_type basic[T_MAX + 1];
85 static debug_type *coff_get_slot
86 PARAMS ((struct coff_types *, int));
87 static debug_type parse_coff_type
88 PARAMS ((bfd *, struct coff_symbols *, struct coff_types *, long, int,
89 union internal_auxent *, bfd_boolean, PTR));
90 static debug_type parse_coff_base_type
91 PARAMS ((bfd *, struct coff_symbols *, struct coff_types *, long, int,
92 union internal_auxent *, PTR));
93 static debug_type parse_coff_struct_type
94 PARAMS ((bfd *, struct coff_symbols *, struct coff_types *, int,
95 union internal_auxent *, PTR));
96 static debug_type parse_coff_enum_type
97 PARAMS ((bfd *, struct coff_symbols *, struct coff_types *,
98 union internal_auxent *, PTR));
99 static bfd_boolean parse_coff_symbol
100 PARAMS ((bfd *, struct coff_types *, asymbol *, long,
101 struct internal_syment *, PTR, debug_type, bfd_boolean));
102 static bfd_boolean external_coff_symbol_p
103 PARAMS ((int sym_class));
105 /* Return the slot for a type. */
107 static debug_type *
108 coff_get_slot (types, indx)
109 struct coff_types *types;
110 int indx;
112 struct coff_slots **pps;
114 pps = &types->slots;
116 while (indx >= COFF_SLOTS)
118 if (*pps == NULL)
120 *pps = (struct coff_slots *) xmalloc (sizeof **pps);
121 memset (*pps, 0, sizeof **pps);
123 pps = &(*pps)->next;
124 indx -= COFF_SLOTS;
127 if (*pps == NULL)
129 *pps = (struct coff_slots *) xmalloc (sizeof **pps);
130 memset (*pps, 0, sizeof **pps);
133 return (*pps)->slots + indx;
136 /* Parse a COFF type code in NTYPE. */
138 static debug_type
139 parse_coff_type (abfd, symbols, types, coff_symno, ntype, pauxent, useaux,
140 dhandle)
141 bfd *abfd;
142 struct coff_symbols *symbols;
143 struct coff_types *types;
144 long coff_symno;
145 int ntype;
146 union internal_auxent *pauxent;
147 bfd_boolean useaux;
148 PTR dhandle;
150 debug_type type;
152 if ((ntype & ~N_BTMASK) != 0)
154 int newtype;
156 newtype = DECREF (ntype);
158 if (ISPTR (ntype))
160 type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
161 pauxent, useaux, dhandle);
162 type = debug_make_pointer_type (dhandle, type);
164 else if (ISFCN (ntype))
166 type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
167 pauxent, useaux, dhandle);
168 type = debug_make_function_type (dhandle, type, (debug_type *) NULL,
169 FALSE);
171 else if (ISARY (ntype))
173 int n;
175 if (pauxent == NULL)
176 n = 0;
177 else
179 unsigned short *dim;
180 int i;
182 /* FIXME: If pauxent->x_sym.x_tagndx.l == 0, gdb sets
183 the c_naux field of the syment to 0. */
185 /* Move the dimensions down, so that the next array
186 picks up the next one. */
187 dim = pauxent->x_sym.x_fcnary.x_ary.x_dimen;
188 n = dim[0];
189 for (i = 0; *dim != 0 && i < DIMNUM - 1; i++, dim++)
190 *dim = *(dim + 1);
191 *dim = 0;
194 type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
195 pauxent, FALSE, dhandle);
196 type = debug_make_array_type (dhandle, type,
197 parse_coff_base_type (abfd, symbols,
198 types,
199 coff_symno,
200 T_INT,
201 NULL, dhandle),
202 0, n - 1, FALSE);
204 else
206 non_fatal (_("parse_coff_type: Bad type code 0x%x"), ntype);
207 return DEBUG_TYPE_NULL;
210 return type;
213 if (pauxent != NULL && pauxent->x_sym.x_tagndx.l > 0)
215 debug_type *slot;
217 /* This is a reference to an existing type. FIXME: gdb checks
218 that the class is not C_STRTAG, nor C_UNTAG, nor C_ENTAG. */
219 slot = coff_get_slot (types, pauxent->x_sym.x_tagndx.l);
220 if (*slot != DEBUG_TYPE_NULL)
221 return *slot;
222 else
223 return debug_make_indirect_type (dhandle, slot, (const char *) NULL);
226 /* If the aux entry has already been used for something, useaux will
227 have been set to false, indicating that parse_coff_base_type
228 should not use it. We need to do it this way, rather than simply
229 passing pauxent as NULL, because we need to be able handle
230 multiple array dimensions while still discarding pauxent after
231 having handled all of them. */
232 if (! useaux)
233 pauxent = NULL;
235 return parse_coff_base_type (abfd, symbols, types, coff_symno, ntype,
236 pauxent, dhandle);
239 /* Parse a basic COFF type in NTYPE. */
241 static debug_type
242 parse_coff_base_type (abfd, symbols, types, coff_symno, ntype, pauxent,
243 dhandle)
244 bfd *abfd;
245 struct coff_symbols *symbols;
246 struct coff_types *types;
247 long coff_symno;
248 int ntype;
249 union internal_auxent *pauxent;
250 PTR dhandle;
252 debug_type ret;
253 bfd_boolean set_basic;
254 const char *name;
255 debug_type *slot;
257 if (ntype >= 0
258 && ntype <= T_MAX
259 && types->basic[ntype] != DEBUG_TYPE_NULL)
260 return types->basic[ntype];
262 set_basic = TRUE;
263 name = NULL;
265 switch (ntype)
267 default:
268 ret = debug_make_void_type (dhandle);
269 break;
271 case T_NULL:
272 case T_VOID:
273 ret = debug_make_void_type (dhandle);
274 name = "void";
275 break;
277 case T_CHAR:
278 ret = debug_make_int_type (dhandle, 1, FALSE);
279 name = "char";
280 break;
282 case T_SHORT:
283 ret = debug_make_int_type (dhandle, 2, FALSE);
284 name = "short";
285 break;
287 case T_INT:
288 /* FIXME: Perhaps the size should depend upon the architecture. */
289 ret = debug_make_int_type (dhandle, 4, FALSE);
290 name = "int";
291 break;
293 case T_LONG:
294 ret = debug_make_int_type (dhandle, 4, FALSE);
295 name = "long";
296 break;
298 case T_FLOAT:
299 ret = debug_make_float_type (dhandle, 4);
300 name = "float";
301 break;
303 case T_DOUBLE:
304 ret = debug_make_float_type (dhandle, 8);
305 name = "double";
306 break;
308 case T_LNGDBL:
309 ret = debug_make_float_type (dhandle, 12);
310 name = "long double";
311 break;
313 case T_UCHAR:
314 ret = debug_make_int_type (dhandle, 1, TRUE);
315 name = "unsigned char";
316 break;
318 case T_USHORT:
319 ret = debug_make_int_type (dhandle, 2, TRUE);
320 name = "unsigned short";
321 break;
323 case T_UINT:
324 ret = debug_make_int_type (dhandle, 4, TRUE);
325 name = "unsigned int";
326 break;
328 case T_ULONG:
329 ret = debug_make_int_type (dhandle, 4, TRUE);
330 name = "unsigned long";
331 break;
333 case T_STRUCT:
334 if (pauxent == NULL)
335 ret = debug_make_struct_type (dhandle, TRUE, 0,
336 (debug_field *) NULL);
337 else
338 ret = parse_coff_struct_type (abfd, symbols, types, ntype, pauxent,
339 dhandle);
341 slot = coff_get_slot (types, coff_symno);
342 *slot = ret;
344 set_basic = FALSE;
345 break;
347 case T_UNION:
348 if (pauxent == NULL)
349 ret = debug_make_struct_type (dhandle, FALSE, 0, (debug_field *) NULL);
350 else
351 ret = parse_coff_struct_type (abfd, symbols, types, ntype, pauxent,
352 dhandle);
354 slot = coff_get_slot (types, coff_symno);
355 *slot = ret;
357 set_basic = FALSE;
358 break;
360 case T_ENUM:
361 if (pauxent == NULL)
362 ret = debug_make_enum_type (dhandle, (const char **) NULL,
363 (bfd_signed_vma *) NULL);
364 else
365 ret = parse_coff_enum_type (abfd, symbols, types, pauxent, dhandle);
367 slot = coff_get_slot (types, coff_symno);
368 *slot = ret;
370 set_basic = FALSE;
371 break;
374 if (name != NULL)
375 ret = debug_name_type (dhandle, name, ret);
377 if (set_basic
378 && ntype >= 0
379 && ntype <= T_MAX)
380 types->basic[ntype] = ret;
382 return ret;
385 /* Parse a struct type. */
387 static debug_type
388 parse_coff_struct_type (abfd, symbols, types, ntype, pauxent, dhandle)
389 bfd *abfd;
390 struct coff_symbols *symbols;
391 struct coff_types *types;
392 int ntype;
393 union internal_auxent *pauxent;
394 PTR dhandle;
396 long symend;
397 int alloc;
398 debug_field *fields;
399 int count;
400 bfd_boolean done;
402 symend = pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l;
404 alloc = 10;
405 fields = (debug_field *) xmalloc (alloc * sizeof *fields);
406 count = 0;
408 done = FALSE;
409 while (! done
410 && symbols->coff_symno < symend
411 && symbols->symno < symbols->symcount)
413 asymbol *sym;
414 long this_coff_symno;
415 struct internal_syment syment;
416 union internal_auxent auxent;
417 union internal_auxent *psubaux;
418 bfd_vma bitpos = 0, bitsize = 0;
420 sym = symbols->syms[symbols->symno];
422 if (! bfd_coff_get_syment (abfd, sym, &syment))
424 non_fatal (_("bfd_coff_get_syment failed: %s"),
425 bfd_errmsg (bfd_get_error ()));
426 return DEBUG_TYPE_NULL;
429 this_coff_symno = symbols->coff_symno;
431 ++symbols->symno;
432 symbols->coff_symno += 1 + syment.n_numaux;
434 if (syment.n_numaux == 0)
435 psubaux = NULL;
436 else
438 if (! bfd_coff_get_auxent (abfd, sym, 0, &auxent))
440 non_fatal (_("bfd_coff_get_auxent failed: %s"),
441 bfd_errmsg (bfd_get_error ()));
442 return DEBUG_TYPE_NULL;
444 psubaux = &auxent;
447 switch (syment.n_sclass)
449 case C_MOS:
450 case C_MOU:
451 bitpos = 8 * bfd_asymbol_value (sym);
452 bitsize = 0;
453 break;
455 case C_FIELD:
456 bitpos = bfd_asymbol_value (sym);
457 bitsize = auxent.x_sym.x_misc.x_lnsz.x_size;
458 break;
460 case C_EOS:
461 done = TRUE;
462 break;
465 if (! done)
467 debug_type ftype;
468 debug_field f;
470 ftype = parse_coff_type (abfd, symbols, types, this_coff_symno,
471 syment.n_type, psubaux, TRUE, dhandle);
472 f = debug_make_field (dhandle, bfd_asymbol_name (sym), ftype,
473 bitpos, bitsize, DEBUG_VISIBILITY_PUBLIC);
474 if (f == DEBUG_FIELD_NULL)
475 return DEBUG_TYPE_NULL;
477 if (count + 1 >= alloc)
479 alloc += 10;
480 fields = ((debug_field *)
481 xrealloc (fields, alloc * sizeof *fields));
484 fields[count] = f;
485 ++count;
489 fields[count] = DEBUG_FIELD_NULL;
491 return debug_make_struct_type (dhandle, ntype == T_STRUCT,
492 pauxent->x_sym.x_misc.x_lnsz.x_size,
493 fields);
496 /* Parse an enum type. */
498 static debug_type
499 parse_coff_enum_type (abfd, symbols, types, pauxent, dhandle)
500 bfd *abfd;
501 struct coff_symbols *symbols;
502 struct coff_types *types ATTRIBUTE_UNUSED;
503 union internal_auxent *pauxent;
504 PTR dhandle;
506 long symend;
507 int alloc;
508 const char **names;
509 bfd_signed_vma *vals;
510 int count;
511 bfd_boolean done;
513 symend = pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l;
515 alloc = 10;
516 names = (const char **) xmalloc (alloc * sizeof *names);
517 vals = (bfd_signed_vma *) xmalloc (alloc * sizeof *vals);
518 count = 0;
520 done = FALSE;
521 while (! done
522 && symbols->coff_symno < symend
523 && symbols->symno < symbols->symcount)
525 asymbol *sym;
526 struct internal_syment syment;
528 sym = symbols->syms[symbols->symno];
530 if (! bfd_coff_get_syment (abfd, sym, &syment))
532 non_fatal (_("bfd_coff_get_syment failed: %s"),
533 bfd_errmsg (bfd_get_error ()));
534 return DEBUG_TYPE_NULL;
537 ++symbols->symno;
538 symbols->coff_symno += 1 + syment.n_numaux;
540 switch (syment.n_sclass)
542 case C_MOE:
543 if (count + 1 >= alloc)
545 alloc += 10;
546 names = ((const char **)
547 xrealloc (names, alloc * sizeof *names));
548 vals = ((bfd_signed_vma *)
549 xrealloc (vals, alloc * sizeof *vals));
552 names[count] = bfd_asymbol_name (sym);
553 vals[count] = bfd_asymbol_value (sym);
554 ++count;
555 break;
557 case C_EOS:
558 done = TRUE;
559 break;
563 names[count] = NULL;
565 return debug_make_enum_type (dhandle, names, vals);
568 /* Handle a single COFF symbol. */
570 static bfd_boolean
571 parse_coff_symbol (abfd, types, sym, coff_symno, psyment, dhandle, type,
572 within_function)
573 bfd *abfd ATTRIBUTE_UNUSED;
574 struct coff_types *types;
575 asymbol *sym;
576 long coff_symno;
577 struct internal_syment *psyment;
578 PTR dhandle;
579 debug_type type;
580 bfd_boolean within_function;
582 switch (psyment->n_sclass)
584 case C_NULL:
585 break;
587 case C_AUTO:
588 if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
589 DEBUG_LOCAL, bfd_asymbol_value (sym)))
590 return FALSE;
591 break;
593 case C_WEAKEXT:
594 case C_EXT:
595 if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
596 DEBUG_GLOBAL, bfd_asymbol_value (sym)))
597 return FALSE;
598 break;
600 case C_STAT:
601 if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
602 (within_function
603 ? DEBUG_LOCAL_STATIC
604 : DEBUG_STATIC),
605 bfd_asymbol_value (sym)))
606 return FALSE;
607 break;
609 case C_REG:
610 /* FIXME: We may need to convert the register number. */
611 if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
612 DEBUG_REGISTER, bfd_asymbol_value (sym)))
613 return FALSE;
614 break;
616 case C_LABEL:
617 break;
619 case C_ARG:
620 if (! debug_record_parameter (dhandle, bfd_asymbol_name (sym), type,
621 DEBUG_PARM_STACK, bfd_asymbol_value (sym)))
622 return FALSE;
623 break;
625 case C_REGPARM:
626 /* FIXME: We may need to convert the register number. */
627 if (! debug_record_parameter (dhandle, bfd_asymbol_name (sym), type,
628 DEBUG_PARM_REG, bfd_asymbol_value (sym)))
629 return FALSE;
630 break;
632 case C_TPDEF:
633 type = debug_name_type (dhandle, bfd_asymbol_name (sym), type);
634 if (type == DEBUG_TYPE_NULL)
635 return FALSE;
636 break;
638 case C_STRTAG:
639 case C_UNTAG:
640 case C_ENTAG:
642 debug_type *slot;
644 type = debug_tag_type (dhandle, bfd_asymbol_name (sym), type);
645 if (type == DEBUG_TYPE_NULL)
646 return FALSE;
648 /* Store the named type into the slot, so that references get
649 the name. */
650 slot = coff_get_slot (types, coff_symno);
651 *slot = type;
653 break;
655 default:
656 break;
659 return TRUE;
662 /* Determine if a symbol has external visibility. */
664 static bfd_boolean
665 external_coff_symbol_p (sym_class)
666 int sym_class;
668 switch (sym_class)
670 case C_EXT:
671 case C_WEAKEXT:
672 return TRUE;
673 default:
674 break;
676 return FALSE;
679 /* This is the main routine. It looks through all the symbols and
680 handles them. */
682 bfd_boolean
683 parse_coff (abfd, syms, symcount, dhandle)
684 bfd *abfd;
685 asymbol **syms;
686 long symcount;
687 PTR dhandle;
689 struct coff_symbols symbols;
690 struct coff_types types;
691 int i;
692 long next_c_file;
693 const char *fnname;
694 int fnclass;
695 int fntype;
696 bfd_vma fnend;
697 alent *linenos;
698 bfd_boolean within_function;
699 long this_coff_symno;
701 symbols.syms = syms;
702 symbols.symcount = symcount;
703 symbols.symno = 0;
704 symbols.coff_symno = 0;
706 types.slots = NULL;
707 for (i = 0; i <= T_MAX; i++)
708 types.basic[i] = DEBUG_TYPE_NULL;
710 next_c_file = -1;
711 fnname = NULL;
712 fnclass = 0;
713 fntype = 0;
714 fnend = 0;
715 linenos = NULL;
716 within_function = FALSE;
718 while (symbols.symno < symcount)
720 asymbol *sym;
721 const char *name;
722 struct internal_syment syment;
723 union internal_auxent auxent;
724 union internal_auxent *paux;
725 debug_type type;
727 sym = syms[symbols.symno];
729 if (! bfd_coff_get_syment (abfd, sym, &syment))
731 non_fatal (_("bfd_coff_get_syment failed: %s"),
732 bfd_errmsg (bfd_get_error ()));
733 return FALSE;
736 name = bfd_asymbol_name (sym);
738 this_coff_symno = symbols.coff_symno;
740 ++symbols.symno;
741 symbols.coff_symno += 1 + syment.n_numaux;
743 /* We only worry about the first auxent, because that is the
744 only one which is relevant for debugging information. */
745 if (syment.n_numaux == 0)
746 paux = NULL;
747 else
749 if (! bfd_coff_get_auxent (abfd, sym, 0, &auxent))
751 non_fatal (_("bfd_coff_get_auxent failed: %s"),
752 bfd_errmsg (bfd_get_error ()));
753 return FALSE;
755 paux = &auxent;
758 if (this_coff_symno == next_c_file && syment.n_sclass != C_FILE)
760 /* The last C_FILE symbol points to the first external
761 symbol. */
762 if (! debug_set_filename (dhandle, "*globals*"))
763 return FALSE;
766 switch (syment.n_sclass)
768 case C_EFCN:
769 case C_EXTDEF:
770 case C_ULABEL:
771 case C_USTATIC:
772 case C_LINE:
773 case C_ALIAS:
774 case C_HIDDEN:
775 /* Just ignore these classes. */
776 break;
778 case C_FILE:
779 next_c_file = syment.n_value;
780 if (! debug_set_filename (dhandle, name))
781 return FALSE;
782 break;
784 case C_STAT:
785 /* Ignore static symbols with a type of T_NULL. These
786 represent section entries. */
787 if (syment.n_type == T_NULL)
788 break;
789 /* Fall through. */
790 case C_WEAKEXT:
791 case C_EXT:
792 if (ISFCN (syment.n_type))
794 fnname = name;
795 fnclass = syment.n_sclass;
796 fntype = syment.n_type;
797 if (syment.n_numaux > 0)
798 fnend = bfd_asymbol_value (sym) + auxent.x_sym.x_misc.x_fsize;
799 else
800 fnend = 0;
801 linenos = BFD_SEND (abfd, _get_lineno, (abfd, sym));
802 break;
804 type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
805 syment.n_type, paux, TRUE, dhandle);
806 if (type == DEBUG_TYPE_NULL)
807 return FALSE;
808 if (! parse_coff_symbol (abfd, &types, sym, this_coff_symno, &syment,
809 dhandle, type, within_function))
810 return FALSE;
811 break;
813 case C_FCN:
814 if (strcmp (name, ".bf") == 0)
816 if (fnname == NULL)
818 non_fatal (_("%ld: .bf without preceding function"),
819 this_coff_symno);
820 return FALSE;
823 type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
824 DECREF (fntype), paux, FALSE, dhandle);
825 if (type == DEBUG_TYPE_NULL)
826 return FALSE;
828 if (! debug_record_function (dhandle, fnname, type,
829 external_coff_symbol_p (fnclass),
830 bfd_asymbol_value (sym)))
831 return FALSE;
833 if (linenos != NULL)
835 int base;
836 bfd_vma addr;
838 if (syment.n_numaux == 0)
839 base = 0;
840 else
841 base = auxent.x_sym.x_misc.x_lnsz.x_lnno - 1;
843 addr = bfd_get_section_vma (abfd, bfd_get_section (sym));
845 ++linenos;
847 while (linenos->line_number != 0)
849 if (! debug_record_line (dhandle,
850 linenos->line_number + base,
851 linenos->u.offset + addr))
852 return FALSE;
853 ++linenos;
857 fnname = NULL;
858 linenos = NULL;
859 fnclass = 0;
860 fntype = 0;
862 within_function = TRUE;
864 else if (strcmp (name, ".ef") == 0)
866 if (! within_function)
868 non_fatal (_("%ld: unexpected .ef\n"), this_coff_symno);
869 return FALSE;
872 if (bfd_asymbol_value (sym) > fnend)
873 fnend = bfd_asymbol_value (sym);
874 if (! debug_end_function (dhandle, fnend))
875 return FALSE;
877 fnend = 0;
878 within_function = FALSE;
880 break;
882 case C_BLOCK:
883 if (strcmp (name, ".bb") == 0)
885 if (! debug_start_block (dhandle, bfd_asymbol_value (sym)))
886 return FALSE;
888 else if (strcmp (name, ".eb") == 0)
890 if (! debug_end_block (dhandle, bfd_asymbol_value (sym)))
891 return FALSE;
893 break;
895 default:
896 type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
897 syment.n_type, paux, TRUE, dhandle);
898 if (type == DEBUG_TYPE_NULL)
899 return FALSE;
900 if (! parse_coff_symbol (abfd, &types, sym, this_coff_symno, &syment,
901 dhandle, type, within_function))
902 return FALSE;
903 break;
907 return TRUE;