Update copyright years
[deliverable/binutils-gdb.git] / binutils / rdcoff.c
1 /* stabs.c -- Parse COFF debugging information
2 Copyright (C) 1996-2014 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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA
20 02110-1301, USA. */
21
22 /* This file contains code which parses COFF debugging information. */
23
24 #include "sysdep.h"
25 #include "bfd.h"
26 #include "coff/internal.h"
27 #include "libiberty.h"
28 #include "bucomm.h"
29 #include "debug.h"
30 #include "budbg.h"
31
32 /* FIXME: We should not need this BFD internal file. We need it for
33 the N_BTMASK, etc., values. */
34 #include "libcoff.h"
35
36 /* These macros extract the right mask and shifts for this BFD. They
37 assume that there is a local variable named ABFD. This is so that
38 macros like ISFCN and DECREF, from coff/internal.h, will work
39 without modification. */
40 #define N_BTMASK (coff_data (abfd)->local_n_btmask)
41 #define N_BTSHFT (coff_data (abfd)->local_n_btshft)
42 #define N_TMASK (coff_data (abfd)->local_n_tmask)
43 #define N_TSHIFT (coff_data (abfd)->local_n_tshift)
44
45 /* This structure is used to hold the symbols, as well as the current
46 location within the symbols. */
47
48 struct coff_symbols
49 {
50 /* The symbols. */
51 asymbol **syms;
52 /* The number of symbols. */
53 long symcount;
54 /* The index of the current symbol. */
55 long symno;
56 /* The index of the current symbol in the COFF symbol table (where
57 each auxent counts as a symbol). */
58 long coff_symno;
59 };
60
61 /* The largest basic type we are prepared to handle. */
62
63 #define T_MAX (T_LNGDBL)
64
65 /* This structure is used to hold slots. */
66
67 struct coff_slots
68 {
69 /* Next set of slots. */
70 struct coff_slots *next;
71 /* Slots. */
72 #define COFF_SLOTS (16)
73 debug_type slots[COFF_SLOTS];
74 };
75
76 /* This structure is used to map symbol indices to types. */
77
78 struct coff_types
79 {
80 /* Slots. */
81 struct coff_slots *slots;
82 /* Basic types. */
83 debug_type basic[T_MAX + 1];
84 };
85
86 static debug_type *coff_get_slot (struct coff_types *, int);
87 static debug_type parse_coff_type
88 (bfd *, struct coff_symbols *, struct coff_types *, long, int,
89 union internal_auxent *, bfd_boolean, void *);
90 static debug_type parse_coff_base_type
91 (bfd *, struct coff_symbols *, struct coff_types *, long, int,
92 union internal_auxent *, void *);
93 static debug_type parse_coff_struct_type
94 (bfd *, struct coff_symbols *, struct coff_types *, int,
95 union internal_auxent *, void *);
96 static debug_type parse_coff_enum_type
97 (bfd *, struct coff_symbols *, struct coff_types *,
98 union internal_auxent *, void *);
99 static bfd_boolean parse_coff_symbol
100 (bfd *, struct coff_types *, asymbol *, long, struct internal_syment *,
101 void *, debug_type, bfd_boolean);
102 static bfd_boolean external_coff_symbol_p (int sym_class);
103 \f
104 /* Return the slot for a type. */
105
106 static debug_type *
107 coff_get_slot (struct coff_types *types, int indx)
108 {
109 struct coff_slots **pps;
110
111 pps = &types->slots;
112
113 while (indx >= COFF_SLOTS)
114 {
115 if (*pps == NULL)
116 {
117 *pps = (struct coff_slots *) xmalloc (sizeof **pps);
118 memset (*pps, 0, sizeof **pps);
119 }
120 pps = &(*pps)->next;
121 indx -= COFF_SLOTS;
122 }
123
124 if (*pps == NULL)
125 {
126 *pps = (struct coff_slots *) xmalloc (sizeof **pps);
127 memset (*pps, 0, sizeof **pps);
128 }
129
130 return (*pps)->slots + indx;
131 }
132
133 /* Parse a COFF type code in NTYPE. */
134
135 static debug_type
136 parse_coff_type (bfd *abfd, struct coff_symbols *symbols,
137 struct coff_types *types, long coff_symno, int ntype,
138 union internal_auxent *pauxent, bfd_boolean useaux,
139 void *dhandle)
140 {
141 debug_type type;
142
143 if ((ntype & ~N_BTMASK) != 0)
144 {
145 int newtype;
146
147 newtype = DECREF (ntype);
148
149 if (ISPTR (ntype))
150 {
151 type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
152 pauxent, useaux, dhandle);
153 type = debug_make_pointer_type (dhandle, type);
154 }
155 else if (ISFCN (ntype))
156 {
157 type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
158 pauxent, useaux, dhandle);
159 type = debug_make_function_type (dhandle, type, (debug_type *) NULL,
160 FALSE);
161 }
162 else if (ISARY (ntype))
163 {
164 int n;
165
166 if (pauxent == NULL)
167 n = 0;
168 else
169 {
170 unsigned short *dim;
171 int i;
172
173 /* FIXME: If pauxent->x_sym.x_tagndx.l == 0, gdb sets
174 the c_naux field of the syment to 0. */
175
176 /* Move the dimensions down, so that the next array
177 picks up the next one. */
178 dim = pauxent->x_sym.x_fcnary.x_ary.x_dimen;
179 n = dim[0];
180 for (i = 0; *dim != 0 && i < DIMNUM - 1; i++, dim++)
181 *dim = *(dim + 1);
182 *dim = 0;
183 }
184
185 type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
186 pauxent, FALSE, dhandle);
187 type = debug_make_array_type (dhandle, type,
188 parse_coff_base_type (abfd, symbols,
189 types,
190 coff_symno,
191 T_INT,
192 NULL, dhandle),
193 0, n - 1, FALSE);
194 }
195 else
196 {
197 non_fatal (_("parse_coff_type: Bad type code 0x%x"), ntype);
198 return DEBUG_TYPE_NULL;
199 }
200
201 return type;
202 }
203
204 if (pauxent != NULL && pauxent->x_sym.x_tagndx.l > 0)
205 {
206 debug_type *slot;
207
208 /* This is a reference to an existing type. FIXME: gdb checks
209 that the class is not C_STRTAG, nor C_UNTAG, nor C_ENTAG. */
210 slot = coff_get_slot (types, pauxent->x_sym.x_tagndx.l);
211 if (*slot != DEBUG_TYPE_NULL)
212 return *slot;
213 else
214 return debug_make_indirect_type (dhandle, slot, (const char *) NULL);
215 }
216
217 /* If the aux entry has already been used for something, useaux will
218 have been set to false, indicating that parse_coff_base_type
219 should not use it. We need to do it this way, rather than simply
220 passing pauxent as NULL, because we need to be able handle
221 multiple array dimensions while still discarding pauxent after
222 having handled all of them. */
223 if (! useaux)
224 pauxent = NULL;
225
226 return parse_coff_base_type (abfd, symbols, types, coff_symno, ntype,
227 pauxent, dhandle);
228 }
229
230 /* Parse a basic COFF type in NTYPE. */
231
232 static debug_type
233 parse_coff_base_type (bfd *abfd, struct coff_symbols *symbols,
234 struct coff_types *types, long coff_symno, int ntype,
235 union internal_auxent *pauxent, void *dhandle)
236 {
237 debug_type ret;
238 bfd_boolean set_basic;
239 const char *name;
240 debug_type *slot;
241
242 if (ntype >= 0
243 && ntype <= T_MAX
244 && types->basic[ntype] != DEBUG_TYPE_NULL)
245 return types->basic[ntype];
246
247 set_basic = TRUE;
248 name = NULL;
249
250 switch (ntype)
251 {
252 default:
253 ret = debug_make_void_type (dhandle);
254 break;
255
256 case T_NULL:
257 case T_VOID:
258 ret = debug_make_void_type (dhandle);
259 name = "void";
260 break;
261
262 case T_CHAR:
263 ret = debug_make_int_type (dhandle, 1, FALSE);
264 name = "char";
265 break;
266
267 case T_SHORT:
268 ret = debug_make_int_type (dhandle, 2, FALSE);
269 name = "short";
270 break;
271
272 case T_INT:
273 /* FIXME: Perhaps the size should depend upon the architecture. */
274 ret = debug_make_int_type (dhandle, 4, FALSE);
275 name = "int";
276 break;
277
278 case T_LONG:
279 ret = debug_make_int_type (dhandle, 4, FALSE);
280 name = "long";
281 break;
282
283 case T_FLOAT:
284 ret = debug_make_float_type (dhandle, 4);
285 name = "float";
286 break;
287
288 case T_DOUBLE:
289 ret = debug_make_float_type (dhandle, 8);
290 name = "double";
291 break;
292
293 case T_LNGDBL:
294 ret = debug_make_float_type (dhandle, 12);
295 name = "long double";
296 break;
297
298 case T_UCHAR:
299 ret = debug_make_int_type (dhandle, 1, TRUE);
300 name = "unsigned char";
301 break;
302
303 case T_USHORT:
304 ret = debug_make_int_type (dhandle, 2, TRUE);
305 name = "unsigned short";
306 break;
307
308 case T_UINT:
309 ret = debug_make_int_type (dhandle, 4, TRUE);
310 name = "unsigned int";
311 break;
312
313 case T_ULONG:
314 ret = debug_make_int_type (dhandle, 4, TRUE);
315 name = "unsigned long";
316 break;
317
318 case T_STRUCT:
319 if (pauxent == NULL)
320 ret = debug_make_struct_type (dhandle, TRUE, 0,
321 (debug_field *) NULL);
322 else
323 ret = parse_coff_struct_type (abfd, symbols, types, ntype, pauxent,
324 dhandle);
325
326 slot = coff_get_slot (types, coff_symno);
327 *slot = ret;
328
329 set_basic = FALSE;
330 break;
331
332 case T_UNION:
333 if (pauxent == NULL)
334 ret = debug_make_struct_type (dhandle, FALSE, 0, (debug_field *) NULL);
335 else
336 ret = parse_coff_struct_type (abfd, symbols, types, ntype, pauxent,
337 dhandle);
338
339 slot = coff_get_slot (types, coff_symno);
340 *slot = ret;
341
342 set_basic = FALSE;
343 break;
344
345 case T_ENUM:
346 if (pauxent == NULL)
347 ret = debug_make_enum_type (dhandle, (const char **) NULL,
348 (bfd_signed_vma *) NULL);
349 else
350 ret = parse_coff_enum_type (abfd, symbols, types, pauxent, dhandle);
351
352 slot = coff_get_slot (types, coff_symno);
353 *slot = ret;
354
355 set_basic = FALSE;
356 break;
357 }
358
359 if (name != NULL)
360 ret = debug_name_type (dhandle, name, ret);
361
362 if (set_basic
363 && ntype >= 0
364 && ntype <= T_MAX)
365 types->basic[ntype] = ret;
366
367 return ret;
368 }
369
370 /* Parse a struct type. */
371
372 static debug_type
373 parse_coff_struct_type (bfd *abfd, struct coff_symbols *symbols,
374 struct coff_types *types, int ntype,
375 union internal_auxent *pauxent, void *dhandle)
376 {
377 long symend;
378 int alloc;
379 debug_field *fields;
380 int count;
381 bfd_boolean done;
382
383 symend = pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l;
384
385 alloc = 10;
386 fields = (debug_field *) xmalloc (alloc * sizeof *fields);
387 count = 0;
388
389 done = FALSE;
390 while (! done
391 && symbols->coff_symno < symend
392 && symbols->symno < symbols->symcount)
393 {
394 asymbol *sym;
395 long this_coff_symno;
396 struct internal_syment syment;
397 union internal_auxent auxent;
398 union internal_auxent *psubaux;
399 bfd_vma bitpos = 0, bitsize = 0;
400
401 sym = symbols->syms[symbols->symno];
402
403 if (! bfd_coff_get_syment (abfd, sym, &syment))
404 {
405 non_fatal (_("bfd_coff_get_syment failed: %s"),
406 bfd_errmsg (bfd_get_error ()));
407 return DEBUG_TYPE_NULL;
408 }
409
410 this_coff_symno = symbols->coff_symno;
411
412 ++symbols->symno;
413 symbols->coff_symno += 1 + syment.n_numaux;
414
415 if (syment.n_numaux == 0)
416 psubaux = NULL;
417 else
418 {
419 if (! bfd_coff_get_auxent (abfd, sym, 0, &auxent))
420 {
421 non_fatal (_("bfd_coff_get_auxent failed: %s"),
422 bfd_errmsg (bfd_get_error ()));
423 return DEBUG_TYPE_NULL;
424 }
425 psubaux = &auxent;
426 }
427
428 switch (syment.n_sclass)
429 {
430 case C_MOS:
431 case C_MOU:
432 bitpos = 8 * bfd_asymbol_value (sym);
433 bitsize = 0;
434 break;
435
436 case C_FIELD:
437 bitpos = bfd_asymbol_value (sym);
438 bitsize = auxent.x_sym.x_misc.x_lnsz.x_size;
439 break;
440
441 case C_EOS:
442 done = TRUE;
443 break;
444 }
445
446 if (! done)
447 {
448 debug_type ftype;
449 debug_field f;
450
451 ftype = parse_coff_type (abfd, symbols, types, this_coff_symno,
452 syment.n_type, psubaux, TRUE, dhandle);
453 f = debug_make_field (dhandle, bfd_asymbol_name (sym), ftype,
454 bitpos, bitsize, DEBUG_VISIBILITY_PUBLIC);
455 if (f == DEBUG_FIELD_NULL)
456 return DEBUG_TYPE_NULL;
457
458 if (count + 1 >= alloc)
459 {
460 alloc += 10;
461 fields = ((debug_field *)
462 xrealloc (fields, alloc * sizeof *fields));
463 }
464
465 fields[count] = f;
466 ++count;
467 }
468 }
469
470 fields[count] = DEBUG_FIELD_NULL;
471
472 return debug_make_struct_type (dhandle, ntype == T_STRUCT,
473 pauxent->x_sym.x_misc.x_lnsz.x_size,
474 fields);
475 }
476
477 /* Parse an enum type. */
478
479 static debug_type
480 parse_coff_enum_type (bfd *abfd, struct coff_symbols *symbols,
481 struct coff_types *types ATTRIBUTE_UNUSED,
482 union internal_auxent *pauxent, void *dhandle)
483 {
484 long symend;
485 int alloc;
486 const char **names;
487 bfd_signed_vma *vals;
488 int count;
489 bfd_boolean done;
490
491 symend = pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l;
492
493 alloc = 10;
494 names = (const char **) xmalloc (alloc * sizeof *names);
495 vals = (bfd_signed_vma *) xmalloc (alloc * sizeof *vals);
496 count = 0;
497
498 done = FALSE;
499 while (! done
500 && symbols->coff_symno < symend
501 && symbols->symno < symbols->symcount)
502 {
503 asymbol *sym;
504 struct internal_syment syment;
505
506 sym = symbols->syms[symbols->symno];
507
508 if (! bfd_coff_get_syment (abfd, sym, &syment))
509 {
510 non_fatal (_("bfd_coff_get_syment failed: %s"),
511 bfd_errmsg (bfd_get_error ()));
512 return DEBUG_TYPE_NULL;
513 }
514
515 ++symbols->symno;
516 symbols->coff_symno += 1 + syment.n_numaux;
517
518 switch (syment.n_sclass)
519 {
520 case C_MOE:
521 if (count + 1 >= alloc)
522 {
523 alloc += 10;
524 names = ((const char **)
525 xrealloc (names, alloc * sizeof *names));
526 vals = ((bfd_signed_vma *)
527 xrealloc (vals, alloc * sizeof *vals));
528 }
529
530 names[count] = bfd_asymbol_name (sym);
531 vals[count] = bfd_asymbol_value (sym);
532 ++count;
533 break;
534
535 case C_EOS:
536 done = TRUE;
537 break;
538 }
539 }
540
541 names[count] = NULL;
542
543 return debug_make_enum_type (dhandle, names, vals);
544 }
545
546 /* Handle a single COFF symbol. */
547
548 static bfd_boolean
549 parse_coff_symbol (bfd *abfd ATTRIBUTE_UNUSED, struct coff_types *types,
550 asymbol *sym, long coff_symno,
551 struct internal_syment *psyment, void *dhandle,
552 debug_type type, bfd_boolean within_function)
553 {
554 switch (psyment->n_sclass)
555 {
556 case C_NULL:
557 break;
558
559 case C_AUTO:
560 if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
561 DEBUG_LOCAL, bfd_asymbol_value (sym)))
562 return FALSE;
563 break;
564
565 case C_WEAKEXT:
566 case C_EXT:
567 if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
568 DEBUG_GLOBAL, bfd_asymbol_value (sym)))
569 return FALSE;
570 break;
571
572 case C_STAT:
573 if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
574 (within_function
575 ? DEBUG_LOCAL_STATIC
576 : DEBUG_STATIC),
577 bfd_asymbol_value (sym)))
578 return FALSE;
579 break;
580
581 case C_REG:
582 /* FIXME: We may need to convert the register number. */
583 if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
584 DEBUG_REGISTER, bfd_asymbol_value (sym)))
585 return FALSE;
586 break;
587
588 case C_LABEL:
589 break;
590
591 case C_ARG:
592 if (! debug_record_parameter (dhandle, bfd_asymbol_name (sym), type,
593 DEBUG_PARM_STACK, bfd_asymbol_value (sym)))
594 return FALSE;
595 break;
596
597 case C_REGPARM:
598 /* FIXME: We may need to convert the register number. */
599 if (! debug_record_parameter (dhandle, bfd_asymbol_name (sym), type,
600 DEBUG_PARM_REG, bfd_asymbol_value (sym)))
601 return FALSE;
602 break;
603
604 case C_TPDEF:
605 type = debug_name_type (dhandle, bfd_asymbol_name (sym), type);
606 if (type == DEBUG_TYPE_NULL)
607 return FALSE;
608 break;
609
610 case C_STRTAG:
611 case C_UNTAG:
612 case C_ENTAG:
613 {
614 debug_type *slot;
615
616 type = debug_tag_type (dhandle, bfd_asymbol_name (sym), type);
617 if (type == DEBUG_TYPE_NULL)
618 return FALSE;
619
620 /* Store the named type into the slot, so that references get
621 the name. */
622 slot = coff_get_slot (types, coff_symno);
623 *slot = type;
624 }
625 break;
626
627 default:
628 break;
629 }
630
631 return TRUE;
632 }
633
634 /* Determine if a symbol has external visibility. */
635
636 static bfd_boolean
637 external_coff_symbol_p (int sym_class)
638 {
639 switch (sym_class)
640 {
641 case C_EXT:
642 case C_WEAKEXT:
643 return TRUE;
644 default:
645 break;
646 }
647 return FALSE;
648 }
649
650 /* This is the main routine. It looks through all the symbols and
651 handles them. */
652
653 bfd_boolean
654 parse_coff (bfd *abfd, asymbol **syms, long symcount, void *dhandle)
655 {
656 struct coff_symbols symbols;
657 struct coff_types types;
658 int i;
659 long next_c_file;
660 const char *fnname;
661 int fnclass;
662 int fntype;
663 bfd_vma fnend;
664 alent *linenos;
665 bfd_boolean within_function;
666 long this_coff_symno;
667
668 symbols.syms = syms;
669 symbols.symcount = symcount;
670 symbols.symno = 0;
671 symbols.coff_symno = 0;
672
673 types.slots = NULL;
674 for (i = 0; i <= T_MAX; i++)
675 types.basic[i] = DEBUG_TYPE_NULL;
676
677 next_c_file = -1;
678 fnname = NULL;
679 fnclass = 0;
680 fntype = 0;
681 fnend = 0;
682 linenos = NULL;
683 within_function = FALSE;
684
685 while (symbols.symno < symcount)
686 {
687 asymbol *sym;
688 const char *name;
689 struct internal_syment syment;
690 union internal_auxent auxent;
691 union internal_auxent *paux;
692 debug_type type;
693
694 sym = syms[symbols.symno];
695
696 if (! bfd_coff_get_syment (abfd, sym, &syment))
697 {
698 non_fatal (_("bfd_coff_get_syment failed: %s"),
699 bfd_errmsg (bfd_get_error ()));
700 return FALSE;
701 }
702
703 name = bfd_asymbol_name (sym);
704
705 this_coff_symno = symbols.coff_symno;
706
707 ++symbols.symno;
708 symbols.coff_symno += 1 + syment.n_numaux;
709
710 /* We only worry about the first auxent, because that is the
711 only one which is relevant for debugging information. */
712 if (syment.n_numaux == 0)
713 paux = NULL;
714 else
715 {
716 if (! bfd_coff_get_auxent (abfd, sym, 0, &auxent))
717 {
718 non_fatal (_("bfd_coff_get_auxent failed: %s"),
719 bfd_errmsg (bfd_get_error ()));
720 return FALSE;
721 }
722 paux = &auxent;
723 }
724
725 if (this_coff_symno == next_c_file && syment.n_sclass != C_FILE)
726 {
727 /* The last C_FILE symbol points to the first external
728 symbol. */
729 if (! debug_set_filename (dhandle, "*globals*"))
730 return FALSE;
731 }
732
733 switch (syment.n_sclass)
734 {
735 case C_EFCN:
736 case C_EXTDEF:
737 case C_ULABEL:
738 case C_USTATIC:
739 case C_LINE:
740 case C_ALIAS:
741 case C_HIDDEN:
742 /* Just ignore these classes. */
743 break;
744
745 case C_FILE:
746 next_c_file = syment.n_value;
747 if (! debug_set_filename (dhandle, name))
748 return FALSE;
749 break;
750
751 case C_STAT:
752 /* Ignore static symbols with a type of T_NULL. These
753 represent section entries. */
754 if (syment.n_type == T_NULL)
755 break;
756 /* Fall through. */
757 case C_WEAKEXT:
758 case C_EXT:
759 if (ISFCN (syment.n_type))
760 {
761 fnname = name;
762 fnclass = syment.n_sclass;
763 fntype = syment.n_type;
764 if (syment.n_numaux > 0)
765 fnend = bfd_asymbol_value (sym) + auxent.x_sym.x_misc.x_fsize;
766 else
767 fnend = 0;
768 linenos = BFD_SEND (abfd, _get_lineno, (abfd, sym));
769 break;
770 }
771 type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
772 syment.n_type, paux, TRUE, dhandle);
773 if (type == DEBUG_TYPE_NULL)
774 return FALSE;
775 if (! parse_coff_symbol (abfd, &types, sym, this_coff_symno, &syment,
776 dhandle, type, within_function))
777 return FALSE;
778 break;
779
780 case C_FCN:
781 if (strcmp (name, ".bf") == 0)
782 {
783 if (fnname == NULL)
784 {
785 non_fatal (_("%ld: .bf without preceding function"),
786 this_coff_symno);
787 return FALSE;
788 }
789
790 type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
791 DECREF (fntype), paux, FALSE, dhandle);
792 if (type == DEBUG_TYPE_NULL)
793 return FALSE;
794
795 if (! debug_record_function (dhandle, fnname, type,
796 external_coff_symbol_p (fnclass),
797 bfd_asymbol_value (sym)))
798 return FALSE;
799
800 if (linenos != NULL)
801 {
802 int base;
803 bfd_vma addr;
804
805 if (syment.n_numaux == 0)
806 base = 0;
807 else
808 base = auxent.x_sym.x_misc.x_lnsz.x_lnno - 1;
809
810 addr = bfd_get_section_vma (abfd, bfd_get_section (sym));
811
812 ++linenos;
813
814 while (linenos->line_number != 0)
815 {
816 if (! debug_record_line (dhandle,
817 linenos->line_number + base,
818 linenos->u.offset + addr))
819 return FALSE;
820 ++linenos;
821 }
822 }
823
824 fnname = NULL;
825 linenos = NULL;
826 fnclass = 0;
827 fntype = 0;
828
829 within_function = TRUE;
830 }
831 else if (strcmp (name, ".ef") == 0)
832 {
833 if (! within_function)
834 {
835 non_fatal (_("%ld: unexpected .ef\n"), this_coff_symno);
836 return FALSE;
837 }
838
839 if (bfd_asymbol_value (sym) > fnend)
840 fnend = bfd_asymbol_value (sym);
841 if (! debug_end_function (dhandle, fnend))
842 return FALSE;
843
844 fnend = 0;
845 within_function = FALSE;
846 }
847 break;
848
849 case C_BLOCK:
850 if (strcmp (name, ".bb") == 0)
851 {
852 if (! debug_start_block (dhandle, bfd_asymbol_value (sym)))
853 return FALSE;
854 }
855 else if (strcmp (name, ".eb") == 0)
856 {
857 if (! debug_end_block (dhandle, bfd_asymbol_value (sym)))
858 return FALSE;
859 }
860 break;
861
862 default:
863 type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
864 syment.n_type, paux, TRUE, dhandle);
865 if (type == DEBUG_TYPE_NULL)
866 return FALSE;
867 if (! parse_coff_symbol (abfd, &types, sym, this_coff_symno, &syment,
868 dhandle, type, within_function))
869 return FALSE;
870 break;
871 }
872 }
873
874 return TRUE;
875 }
This page took 0.048366 seconds and 5 git commands to generate.