1 /* Read a symbol table in MIPS' format (Third-Eye).
2 Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993 Free Software
4 Contributed by Alessandro Forin (af@cs.cmu.edu) at CMU. Major work
5 by Per Bothner, John Gilmore and Ian Lance Taylor at Cygnus Support.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
23 /* This module provides three functions: mipscoff_symfile_init,
24 which initializes to read a symbol file; mipscoff_new_init, which
25 discards existing cached information when all symbols are being
26 discarded; and mipscoff_symfile_read, which reads a symbol table
29 mipscoff_symfile_read only does the minimum work necessary for letting the
30 user "name" things symbolically; it does not read the entire symtab.
31 Instead, it reads the external and static symbols and puts them in partial
32 symbol tables. When more extensive information is requested of a
33 file, the corresponding partial symbol table is mutated into a full
34 fledged symbol table by going back and reading the symbols
35 for real. mipscoff_psymtab_to_symtab() is called indirectly through
36 a pointer in the psymtab to do this.
38 ECOFF symbol tables are mostly written in the byte order of the
39 target machine. However, one section of the table (the auxiliary
40 symbol information) is written in the host byte order. There is a
41 bit in the other symbol info which describes which host byte order
42 was used. ECOFF thereby takes the trophy from Intel `b.out' for
43 the most brain-dead adaptation of a file format to byte order.
45 This module can read all four of the known byte-order combinations,
46 on any type of host. */
48 #define TM_FILE_OVERRIDE
50 #include "mips/tm-mips.h"
58 #include "stabsread.h"
59 #include "complaints.h"
62 #include <sys/types.h>
67 #include <sys/param.h>
72 #include "gdb-stabs.h"
76 #include "coff/internal.h"
77 #include "coff/mips.h" /* COFF-like aspects of ecoff files */
78 #include "coff/ecoff-ext.h" /* External forms of ecoff sym structures */
80 /* FIXME: coff/internal.h and aout/aout64.h both define N_ABS. We
81 want the definition from aout/aout64.h. */
83 /* FIXME: coff/mips.h and aout/aout64.h both define ZMAGIC. We don't
87 #include "libaout.h" /* Private BFD a.out information. */
88 #include "aout/aout64.h"
89 #include "aout/stab_gnu.h" /* STABS information */
91 /* FIXME: libcoff.h and libaout.h both define a couple of macros. We
94 #undef obj_sym_filepos
96 #include "libcoff.h" /* Private BFD COFF information. */
97 #include "libecoff.h" /* Private BFD ECOFF information. */
99 #include "expression.h"
100 #include "language.h" /* Needed inside partial-stab.h */
102 /* Each partial symbol table entry contains a pointer to private data
103 for the read_symtab() function to use when expanding a partial
104 symbol table entry to a full symbol table entry.
106 For mipsread this structure contains the index of the FDR that this
107 psymtab represents and a pointer to the BFD that the psymtab was
110 #define PST_PRIVATE(p) ((struct symloc *)(p)->read_symtab_private)
111 #define FDR_IDX(p) (PST_PRIVATE(p)->fdr_idx)
112 #define CUR_BFD(p) (PST_PRIVATE(p)->cur_bfd)
118 EXTR
*extern_tab
; /* Pointer to external symbols for this file. */
119 int extern_count
; /* Size of extern_tab. */
120 struct mips_pending
**pending_list
;
123 /* Things we import explicitly from other modules */
125 extern int info_verbose
;
127 /* Various complaints about symbol reading that don't abort the process */
129 struct complaint bad_file_number_complaint
=
130 {"bad file number %d", 0, 0};
132 struct complaint index_complaint
=
133 {"bad aux index at symbol %s", 0, 0};
135 struct complaint aux_index_complaint
=
136 {"bad proc end in aux found from symbol %s", 0, 0};
138 struct complaint block_index_complaint
=
139 {"bad aux index at block symbol %s", 0, 0};
141 struct complaint unknown_ext_complaint
=
142 {"unknown external symbol %s", 0, 0};
144 struct complaint unknown_sym_complaint
=
145 {"unknown local symbol %s", 0, 0};
147 struct complaint unknown_st_complaint
=
148 {"with type %d", 0, 0};
150 struct complaint block_overflow_complaint
=
151 {"block containing %s overfilled", 0, 0};
153 struct complaint basic_type_complaint
=
154 {"cannot map MIPS basic type 0x%x", 0, 0};
156 struct complaint unknown_type_qual_complaint
=
157 {"unknown type qualifier 0x%x", 0, 0};
159 struct complaint array_bitsize_complaint
=
160 {"size of array target type not known, assuming %d bits", 0, 0};
162 struct complaint bad_tag_guess_complaint
=
163 {"guessed tag type of %s incorrectly", 0, 0};
165 struct complaint block_member_complaint
=
166 {"declaration block contains unhandled symbol type %d", 0, 0};
168 struct complaint stEnd_complaint
=
169 {"stEnd with storage class %d not handled", 0, 0};
171 struct complaint unknown_mips_symtype_complaint
=
172 {"unknown symbol type 0x%x", 0, 0};
174 struct complaint stab_unknown_complaint
=
175 {"unknown stabs symbol %s", 0, 0};
177 struct complaint pdr_for_nonsymbol_complaint
=
178 {"PDR for %s, but no symbol", 0, 0};
180 struct complaint pdr_static_symbol_complaint
=
181 {"can't handle PDR for static proc at 0x%x", 0, 0};
183 struct complaint bad_setjmp_pdr_complaint
=
184 {"fixing bad setjmp PDR from libc", 0, 0};
186 /* Macros and extra defs */
188 /* Already-parsed symbols are marked specially */
190 #define stParsed stType
192 /* Puns: hard to find whether -g was used and how */
194 #define MIN_GLEVEL GLEVEL_0
195 #define compare_glevel(a,b) \
196 (((a) == GLEVEL_3) ? ((b) < GLEVEL_3) : \
197 ((b) == GLEVEL_3) ? -1 : (int)((b) - (a)))
199 /* Things that really are local to this module */
201 /* Remember what we deduced to be the source language of this psymtab. */
203 static enum language psymtab_language
= language_unknown
;
209 /* Pointer to current file decriptor record, and its index */
214 /* Index of current symbol */
218 /* Note how much "debuggable" this image is. We would like
219 to see at least one FDR with full symbols */
224 /* When examining .o files, report on undefined symbols */
226 static int n_undef_symbols
, n_undef_labels
, n_undef_vars
, n_undef_procs
;
228 /* Pseudo symbol to use when putting stabs into the symbol table. */
230 static char stabs_symbol
[] = STABS_SYMBOL
;
232 /* Extra builtin types */
234 struct type
*builtin_type_complex
;
235 struct type
*builtin_type_double_complex
;
236 struct type
*builtin_type_fixed_dec
;
237 struct type
*builtin_type_float_dec
;
238 struct type
*builtin_type_string
;
240 /* Forward declarations */
243 read_mips_symtab
PARAMS ((struct objfile
*, struct section_offsets
*));
246 read_the_mips_symtab
PARAMS ((bfd
*));
249 upgrade_type
PARAMS ((struct type
**, int, union aux_ext
*, int));
252 parse_partial_symbols
PARAMS ((struct objfile
*,
253 struct section_offsets
*));
256 cross_ref
PARAMS ((union aux_ext
*, struct type
**, enum type_code
, char **,
260 fixup_sigtramp
PARAMS ((void));
262 static struct symbol
*
263 new_symbol
PARAMS ((char *));
266 new_type
PARAMS ((char *));
268 static struct block
*
269 new_block
PARAMS ((int));
271 static struct symtab
*
272 new_symtab
PARAMS ((char *, int, int, struct objfile
*));
274 static struct linetable
*
275 new_linetable
PARAMS ((int));
277 static struct blockvector
*
278 new_bvect
PARAMS ((int));
281 parse_type
PARAMS ((union aux_ext
*, int *, int));
283 static struct symbol
*
284 mylookup_symbol
PARAMS ((char *, struct block
*, enum namespace,
285 enum address_class
));
287 static struct block
*
288 shrink_block
PARAMS ((struct block
*, struct symtab
*));
291 xzalloc
PARAMS ((unsigned int));
294 sort_blocks
PARAMS ((struct symtab
*));
297 compare_blocks
PARAMS ((const void *, const void *));
299 static struct partial_symtab
*
300 new_psymtab
PARAMS ((char *, struct objfile
*));
303 static struct partial_symtab
*
304 parse_fdr
PARAMS ((int, int, struct objfile
*));
308 psymtab_to_symtab_1
PARAMS ((struct partial_symtab
*, char *));
311 add_block
PARAMS ((struct block
*, struct symtab
*));
314 add_symbol
PARAMS ((struct symbol
*, struct block
*));
317 add_line
PARAMS ((struct linetable
*, int, CORE_ADDR
, int));
319 static struct linetable
*
320 shrink_linetable
PARAMS ((struct linetable
*));
323 mips_next_symbol_text
PARAMS ((void));
325 /* Things we export to other modules */
327 /* Address bounds for the signal trampoline in inferior, if any */
328 /* FIXME: Nothing really seems to use this. Why is it here? */
330 CORE_ADDR sigtramp_address
, sigtramp_end
;
333 mipscoff_new_init (ignore
)
334 struct objfile
*ignore
;
336 stabsread_new_init ();
337 buildsym_new_init ();
341 mipscoff_symfile_init (objfile
)
342 struct objfile
*objfile
;
344 if (objfile
->sym_private
!= NULL
)
346 mfree (objfile
->md
, objfile
->sym_private
);
348 objfile
->sym_private
= NULL
;
352 mipscoff_symfile_read (objfile
, section_offsets
, mainline
)
353 struct objfile
*objfile
;
354 struct section_offsets
*section_offsets
;
357 init_minimal_symbol_collection ();
358 make_cleanup (discard_minimal_symbols
, 0);
360 /* Now that the executable file is positioned at symbol table,
361 process it and define symbols accordingly. */
363 read_mips_symtab (objfile
, section_offsets
);
365 /* Install any minimal symbols that have been collected as the current
366 minimal symbols for this objfile. */
368 install_minimal_symbols (objfile
);
371 /* Perform any local cleanups required when we are done with a particular
372 objfile. I.E, we are in the process of discarding all symbol information
373 for an objfile, freeing up all memory held for it, and unlinking the
374 objfile struct from the global list of known objfiles. */
377 mipscoff_symfile_finish (objfile
)
378 struct objfile
*objfile
;
380 if (objfile
->sym_private
!= NULL
)
382 mfree (objfile
->md
, objfile
->sym_private
);
388 /* Allocate zeroed memory */
394 PTR p
= xmalloc (size
);
400 /* Exported procedure: Builds a symtab from the PST partial one.
401 Restores the environment in effect when PST was created, delegates
402 most of the work to an ancillary procedure, and sorts
403 and reorders the symtab list at the end */
406 mipscoff_psymtab_to_symtab (pst
)
407 struct partial_symtab
*pst
;
415 printf_filtered ("Reading in symbols for %s...", pst
->filename
);
418 /* Get the BFD and list of pending typedefs */
419 cur_bfd
= CUR_BFD (pst
);
421 next_symbol_text_func
= mips_next_symbol_text
;
423 psymtab_to_symtab_1 (pst
, pst
->filename
);
425 /* Match with global symbols. This only needs to be done once,
426 after all of the symtabs and dependencies have been read in. */
427 scan_file_globals (pst
->objfile
);
430 printf_filtered ("done.\n");
433 /* Exported procedure: Is PC in the signal trampoline code */
436 in_sigtramp (pc
, ignore
)
438 char *ignore
; /* function name */
440 if (sigtramp_address
== 0)
442 return (pc
>= sigtramp_address
&& pc
< sigtramp_end
);
445 /* File-level interface functions */
447 /* Read the symtab information from file ABFD into memory. */
450 read_the_mips_symtab (abfd
)
453 if (ecoff_slurp_symbolic_info (abfd
) == false)
454 error ("Error reading symbol table: %s", bfd_errmsg (bfd_error
));
457 /* Find a file descriptor given its index RF relative to a file CF */
467 fdrs
= ecoff_data (cur_bfd
)->fdr
;
469 /* Object files do not have the RFD table, all refs are absolute */
472 ecoff_swap_rfd_in (cur_bfd
,
473 ecoff_data (cur_bfd
)->external_rfd
+ f
->rfdBase
+ rf
,
478 /* Return a safer print NAME for a file descriptor */
485 return "<stripped file>";
488 return ecoff_data (cur_bfd
)->ss
+ f
->issBase
+ f
->rss
;
492 /* Read in and parse the symtab of the file OBJFILE. Symbols from
493 different sections are relocated via the SECTION_OFFSETS. */
496 read_mips_symtab (objfile
, section_offsets
)
497 struct objfile
*objfile
;
498 struct section_offsets
*section_offsets
;
500 cur_bfd
= objfile
->obfd
;
502 read_the_mips_symtab (objfile
->obfd
);
504 parse_partial_symbols (objfile
, section_offsets
);
507 /* Check to make sure file was compiled with -g. If not, warn the
508 user of this limitation. */
509 if (compare_glevel (max_glevel
, GLEVEL_2
) < 0)
511 if (max_gdbinfo
== 0)
512 printf ("\n%s not compiled with -g, debugging support is limited.\n",
514 printf ("You should compile with -g2 or -g3 for best debugging support.\n");
520 /* Local utilities */
522 /* Map of FDR indexes to partial symtabs */
526 struct partial_symtab
*pst
; /* the psymtab proper */
527 int n_globals
; /* exported globals (external symbols) */
528 int globals_offset
; /* cumulative */
532 /* Utility stack, used to nest procedures and blocks properly.
533 It is a doubly linked list, to avoid too many alloc/free.
534 Since we might need it quite a few times it is NOT deallocated
537 static struct parse_stack
539 struct parse_stack
*next
, *prev
;
540 struct symtab
*cur_st
; /* Current symtab. */
541 struct block
*cur_block
; /* Block in it. */
542 int blocktype
; /* What are we parsing. */
543 int maxsyms
; /* Max symbols in this block. */
544 struct type
*cur_type
; /* Type we parse fields for. */
545 int cur_field
; /* Field number in cur_type. */
546 int procadr
; /* Start addres of this procedure */
547 int numargs
; /* Its argument count */
550 *top_stack
; /* Top stack ptr */
553 /* Enter a new lexical context */
558 struct parse_stack
*new;
560 /* Reuse frames if possible */
561 if (top_stack
&& top_stack
->prev
)
562 new = top_stack
->prev
;
564 new = (struct parse_stack
*) xzalloc (sizeof (struct parse_stack
));
565 /* Initialize new frame with previous content */
568 register struct parse_stack
*prev
= new->prev
;
571 top_stack
->prev
= new;
573 new->next
= top_stack
;
578 /* Exit a lexical context */
586 top_stack
= top_stack
->next
;
590 /* Cross-references might be to things we haven't looked at
591 yet, e.g. type references. To avoid too many type
592 duplications we keep a quick fixup table, an array
593 of lists of references indexed by file descriptor */
595 static struct mips_pending
597 struct mips_pending
*next
; /* link */
598 struct sym_ext
*s
; /* the symbol */
599 struct type
*t
; /* its partial type descriptor */
603 /* Check whether we already saw symbol SH in file FH as undefined */
605 static struct mips_pending
*
606 is_pending_symbol (fh
, sh
)
610 int f_idx
= fh
- ecoff_data (cur_bfd
)->fdr
;
611 register struct mips_pending
*p
;
613 /* Linear search is ok, list is typically no more than 10 deep */
614 for (p
= pending_list
[f_idx
]; p
; p
= p
->next
)
620 /* Add a new undef symbol SH of type T */
623 add_pending (fh
, sh
, t
)
628 int f_idx
= fh
- ecoff_data (cur_bfd
)->fdr
;
629 struct mips_pending
*p
= is_pending_symbol (fh
, sh
);
631 /* Make sure we do not make duplicates */
634 p
= (struct mips_pending
*) xmalloc (sizeof (*p
));
637 p
->next
= pending_list
[f_idx
];
638 pending_list
[f_idx
] = p
;
642 /* Throw away undef entries when done with file index F_IDX */
643 /* FIXME -- storage leak. This is never called!!! --gnu */
651 register struct mips_pending
*p
, *q
;
653 for (p
= pending_list
[f_idx
]; p
; p
= q
)
658 pending_list
[f_idx
] = 0;
664 prepend_tag_kind (tag_name
, type_code
)
666 enum type_code type_code
;
675 case TYPE_CODE_STRUCT
:
678 case TYPE_CODE_UNION
:
685 result
= (char *) obstack_alloc (¤t_objfile
->symbol_obstack
,
686 strlen (prefix
) + strlen (tag_name
) + 1);
687 sprintf (result
, "%s%s", prefix
, tag_name
);
692 /* Parsing Routines proper. */
694 /* Parse a single symbol. Mostly just make up a GDB symbol for it.
695 For blocks, procedures and types we open a new lexical context.
696 This is basically just a big switch on the symbol's type. Argument
697 AX is the base pointer of aux symbols for this file (fh->iauxBase).
698 EXT_SH points to the unswapped symbol, which is needed for struct,
699 union, etc., types; it is NULL for an EXTR. BIGEND says whether
700 aux symbols are big-endian or little-endian. Return count of
701 SYMR's handled (normally one).
703 FIXME: This modifies the symbol, but the only way we have to save
704 the modified information is to stuff it back into the BFD data. */
707 parse_symbol (sh
, ax
, ext_sh
, bigend
)
710 struct sym_ext
*ext_sh
;
716 struct mips_pending
*pend
;
720 enum address_class
class;
723 if (ext_sh
== (struct sym_ext
*) NULL
)
724 name
= ecoff_data (cur_bfd
)->ssext
+ sh
->iss
;
726 name
= ecoff_data (cur_bfd
)->ss
+ cur_fdr
->issBase
+ sh
->iss
;
733 case stGlobal
: /* external symbol, goes into global block */
735 b
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack
->cur_st
),
737 s
= new_symbol (name
);
738 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
741 case stStatic
: /* static data, goes into current block. */
743 b
= top_stack
->cur_block
;
744 s
= new_symbol (name
);
745 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
748 case stLocal
: /* local variable, goes into current block */
749 if (sh
->sc
== scRegister
)
751 class = LOC_REGISTER
;
753 sh
->value
+= FP0_REGNUM
- 32;
757 b
= top_stack
->cur_block
;
758 s
= new_symbol (name
);
759 SYMBOL_VALUE (s
) = sh
->value
;
761 data
: /* Common code for symbols describing data */
762 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
763 SYMBOL_CLASS (s
) = class;
766 /* Type could be missing in a number of cases */
767 if (sh
->sc
== scUndefined
|| sh
->sc
== scNil
||
768 sh
->index
== 0xfffff)
769 SYMBOL_TYPE (s
) = builtin_type_int
; /* undefined? */
771 SYMBOL_TYPE (s
) = parse_type (ax
+ sh
->index
, 0, bigend
);
772 /* Value of a data symbol is its memory address */
775 case stParam
: /* arg to procedure, goes into current block */
777 top_stack
->numargs
++;
779 /* Special GNU C++ name. */
780 if (name
[0] == CPLUS_MARKER
&& name
[1] == 't' && name
[2] == 0)
781 name
= "this"; /* FIXME, not alloc'd in obstack */
782 s
= new_symbol (name
);
784 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
785 if (sh
->sc
== scRegister
)
787 SYMBOL_CLASS (s
) = LOC_REGPARM
;
789 sh
->value
+= FP0_REGNUM
- 32;
792 SYMBOL_CLASS (s
) = LOC_ARG
;
793 SYMBOL_VALUE (s
) = sh
->value
;
794 SYMBOL_TYPE (s
) = parse_type (ax
+ sh
->index
, 0, bigend
);
795 add_symbol (s
, top_stack
->cur_block
);
797 /* FIXME: This has not been tested. See dbxread.c */
798 /* Add the type of this parameter to the function/procedure
799 type of this block. */
800 add_param_to_type (&top_stack
->cur_block
->function
->type
, s
);
804 case stLabel
: /* label, goes into current block */
805 s
= new_symbol (name
);
806 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
; /* so that it can be used */
807 SYMBOL_CLASS (s
) = LOC_LABEL
; /* but not misused */
808 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
809 SYMBOL_TYPE (s
) = builtin_type_int
;
810 add_symbol (s
, top_stack
->cur_block
);
813 case stProc
: /* Procedure, usually goes into global block */
814 case stStaticProc
: /* Static procedure, goes into current block */
815 s
= new_symbol (name
);
816 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
817 SYMBOL_CLASS (s
) = LOC_BLOCK
;
818 /* Type of the return value */
819 if (sh
->sc
== scUndefined
|| sh
->sc
== scNil
)
820 t
= builtin_type_int
;
822 t
= parse_type (ax
+ sh
->index
+ 1, 0, bigend
);
823 b
= top_stack
->cur_block
;
824 if (sh
->st
== stProc
)
826 struct blockvector
*bv
= BLOCKVECTOR (top_stack
->cur_st
);
827 /* The next test should normally be true,
828 but provides a hook for nested functions
829 (which we don't want to make global). */
830 if (b
== BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
))
831 b
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
835 /* Make a type for the procedure itself */
837 /* FIXME: This has not been tested yet! See dbxread.c */
838 /* Generate a template for the type of this function. The
839 types of the arguments will be added as we read the symbol
841 bcopy (SYMBOL_TYPE (s
), lookup_function_type (t
), sizeof (struct type
));
843 SYMBOL_TYPE (s
) = lookup_function_type (t
);
846 /* Create and enter a new lexical context */
847 b
= new_block (top_stack
->maxsyms
);
848 SYMBOL_BLOCK_VALUE (s
) = b
;
849 BLOCK_FUNCTION (b
) = s
;
850 BLOCK_START (b
) = BLOCK_END (b
) = sh
->value
;
851 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
852 add_block (b
, top_stack
->cur_st
);
854 /* Not if we only have partial info */
855 if (sh
->sc
== scUndefined
|| sh
->sc
== scNil
)
859 top_stack
->cur_block
= b
;
860 top_stack
->blocktype
= sh
->st
;
861 top_stack
->cur_type
= SYMBOL_TYPE (s
);
862 top_stack
->cur_field
= -1;
863 top_stack
->procadr
= sh
->value
;
864 top_stack
->numargs
= 0;
866 sh
->value
= (long) SYMBOL_TYPE (s
);
869 /* Beginning of code for structure, union, and enum definitions.
870 They all share a common set of local variables, defined here. */
872 enum type_code type_code
;
873 struct sym_ext
*ext_tsym
;
878 case stStruct
: /* Start a block defining a struct type */
879 type_code
= TYPE_CODE_STRUCT
;
880 goto structured_common
;
882 case stUnion
: /* Start a block defining a union type */
883 type_code
= TYPE_CODE_UNION
;
884 goto structured_common
;
886 case stEnum
: /* Start a block defining an enum type */
887 type_code
= TYPE_CODE_ENUM
;
888 goto structured_common
;
890 case stBlock
: /* Either a lexical block, or some type */
891 if (sh
->sc
!= scInfo
)
892 goto case_stBlock_code
; /* Lexical block */
894 type_code
= TYPE_CODE_UNDEF
; /* We have a type. */
896 /* Common code for handling struct, union, enum, and/or as-yet-
897 unknown-type blocks of info about structured data. `type_code'
898 has been set to the proper TYPE_CODE, if we know it. */
901 top_stack
->blocktype
= stBlock
;
903 s
= new_symbol (name
);
904 SYMBOL_NAMESPACE (s
) = STRUCT_NAMESPACE
;
905 SYMBOL_CLASS (s
) = LOC_TYPEDEF
;
906 SYMBOL_VALUE (s
) = 0;
907 add_symbol (s
, top_stack
->cur_block
);
909 /* First count the number of fields and the highest value. */
912 for (ext_tsym
= ext_sh
+ 1; ; ext_tsym
++)
916 ecoff_swap_sym_in (cur_bfd
, ext_tsym
, &tsym
);
918 if (tsym
.st
== stEnd
)
921 if (tsym
.st
== stMember
)
923 if (nfields
== 0 && type_code
== TYPE_CODE_UNDEF
)
924 /* If the type of the member is Nil (or Void),
925 without qualifiers, assume the tag is an
927 if (tsym
.index
== indexNil
)
928 type_code
= TYPE_CODE_ENUM
;
931 ecoff_swap_tir_in (bigend
,
932 &ax
[tsym
.index
].a_ti
,
934 if ((tir
.bt
== btNil
|| tir
.bt
== btVoid
)
936 type_code
= TYPE_CODE_ENUM
;
939 if (tsym
.value
> max_value
)
940 max_value
= tsym
.value
;
942 else if (tsym
.st
== stBlock
943 || tsym
.st
== stUnion
945 || tsym
.st
== stStruct
946 || tsym
.st
== stParsed
)
948 if (tsym
.sc
== scVariant
); /*UNIMPLEMENTED*/
951 /* This is something like a struct within a
952 struct. Skip over the fields of the inner
953 struct. The -1 is because the for loop will
954 increment ext_tsym. */
955 ext_tsym
= (ecoff_data (cur_bfd
)->external_sym
962 complain (&block_member_complaint
, tsym
.st
);
965 /* In an stBlock, there is no way to distinguish structs,
966 unions, and enums at this point. This is a bug in the
967 original design (that has been fixed with the recent
968 addition of the stStruct, stUnion, and stEnum symbol
969 types.) The way you can tell is if/when you see a variable
970 or field of that type. In that case the variable's type
971 (in the AUX table) says if the type is struct, union, or
972 enum, and points back to the stBlock here. So you can
973 patch the tag kind up later - but only if there actually is
974 a variable or field of that type.
976 So until we know for sure, we will guess at this point.
978 If the first member has index==indexNil or a void type,
979 assume we have an enumeration.
980 Otherwise, if there is more than one member, and all
981 the members have offset 0, assume we have a union.
982 Otherwise, assume we have a struct.
984 The heuristic could guess wrong in the case of of an
985 enumeration with no members or a union with one (or zero)
986 members, or when all except the last field of a struct have
987 width zero. These are uncommon and/or illegal situations,
988 and in any case guessing wrong probably doesn't matter
991 But if we later do find out we were wrong, we fixup the tag
992 kind. Members of an enumeration must be handled
993 differently from struct/union fields, and that is harder to
994 patch up, but luckily we shouldn't need to. (If there are
995 any enumeration members, we can tell for sure it's an enum
998 if (type_code
== TYPE_CODE_UNDEF
)
999 if (nfields
> 1 && max_value
== 0)
1000 type_code
= TYPE_CODE_UNION
;
1002 type_code
= TYPE_CODE_STRUCT
;
1004 /* If this type was expected, use its partial definition */
1005 pend
= is_pending_symbol (cur_fdr
, ext_sh
);
1006 if (pend
!= (struct mips_pending
*) NULL
)
1009 t
= new_type (prepend_tag_kind (name
, type_code
));
1011 TYPE_CODE (t
) = type_code
;
1012 TYPE_LENGTH (t
) = sh
->value
;
1013 TYPE_NFIELDS (t
) = nfields
;
1014 TYPE_FIELDS (t
) = f
= ((struct field
*)
1016 nfields
* sizeof (struct field
)));
1018 if (type_code
== TYPE_CODE_ENUM
)
1020 /* This is a non-empty enum. */
1021 for (ext_tsym
= ext_sh
+ 1; ; ext_tsym
++)
1024 struct symbol
*enum_sym
;
1026 ecoff_swap_sym_in (cur_bfd
, ext_tsym
, &tsym
);
1028 if (tsym
.st
!= stMember
)
1031 f
->bitpos
= tsym
.value
;
1033 f
->name
= (ecoff_data (cur_bfd
)->ss
1038 enum_sym
= ((struct symbol
*)
1039 obstack_alloc (¤t_objfile
->symbol_obstack
,
1040 sizeof (struct symbol
)));
1041 memset ((PTR
) enum_sym
, 0, sizeof (struct symbol
));
1042 SYMBOL_NAME (enum_sym
) = f
->name
;
1043 SYMBOL_CLASS (enum_sym
) = LOC_CONST
;
1044 SYMBOL_TYPE (enum_sym
) = t
;
1045 SYMBOL_NAMESPACE (enum_sym
) = VAR_NAMESPACE
;
1046 SYMBOL_VALUE (enum_sym
) = tsym
.value
;
1047 add_symbol (enum_sym
, top_stack
->cur_block
);
1049 /* Skip the stMembers that we've handled. */
1054 SYMBOL_TYPE (s
) = t
;
1055 /* make this the current type */
1056 top_stack
->cur_type
= t
;
1057 top_stack
->cur_field
= 0;
1058 /* Mark that symbol has a type, and say which one */
1059 sh
->value
= (long) t
;
1062 /* End of local variables shared by struct, union, enum, and
1063 block (as yet unknown struct/union/enum) processing. */
1067 /* beginnning of (code) block. Value of symbol
1068 is the displacement from procedure start */
1069 push_parse_stack ();
1070 top_stack
->blocktype
= stBlock
;
1071 b
= new_block (top_stack
->maxsyms
);
1072 BLOCK_START (b
) = sh
->value
+ top_stack
->procadr
;
1073 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
1074 top_stack
->cur_block
= b
;
1075 add_block (b
, top_stack
->cur_st
);
1078 case stEnd
: /* end (of anything) */
1079 if (sh
->sc
== scInfo
)
1081 /* Finished with type */
1082 top_stack
->cur_type
= 0;
1084 else if (sh
->sc
== scText
&&
1085 (top_stack
->blocktype
== stProc
||
1086 top_stack
->blocktype
== stStaticProc
))
1088 /* Finished with procedure */
1089 struct blockvector
*bv
= BLOCKVECTOR (top_stack
->cur_st
);
1090 struct mips_extra_func_info
*e
;
1094 BLOCK_END (top_stack
->cur_block
) += sh
->value
; /* size */
1096 /* Make up special symbol to contain procedure specific info */
1097 s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
1098 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
1099 SYMBOL_CLASS (s
) = LOC_CONST
;
1100 SYMBOL_TYPE (s
) = builtin_type_void
;
1101 e
= ((struct mips_extra_func_info
*)
1102 obstack_alloc (¤t_objfile
->symbol_obstack
,
1103 sizeof (struct mips_extra_func_info
)));
1104 SYMBOL_VALUE (s
) = (int) e
;
1105 e
->numargs
= top_stack
->numargs
;
1106 add_symbol (s
, top_stack
->cur_block
);
1108 /* Reallocate symbols, saving memory */
1109 b
= shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
1111 /* f77 emits proc-level with address bounds==[0,0],
1112 So look for such child blocks, and patch them. */
1113 for (i
= 0; i
< BLOCKVECTOR_NBLOCKS (bv
); i
++)
1115 struct block
*b_bad
= BLOCKVECTOR_BLOCK (bv
, i
);
1116 if (BLOCK_SUPERBLOCK (b_bad
) == b
1117 && BLOCK_START (b_bad
) == top_stack
->procadr
1118 && BLOCK_END (b_bad
) == top_stack
->procadr
)
1120 BLOCK_START (b_bad
) = BLOCK_START (b
);
1121 BLOCK_END (b_bad
) = BLOCK_END (b
);
1125 else if (sh
->sc
== scText
&& top_stack
->blocktype
== stBlock
)
1127 /* End of (code) block. The value of the symbol is the
1128 displacement from the procedure`s start address of the
1129 end of this block. */
1130 BLOCK_END (top_stack
->cur_block
) = sh
->value
+ top_stack
->procadr
;
1131 shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
1133 else if (sh
->sc
== scText
&& top_stack
->blocktype
== stFile
)
1135 /* End of file. Pop parse stack and ignore. Higher
1136 level code deals with this. */
1140 complain (&stEnd_complaint
, sh
->sc
);
1142 pop_parse_stack (); /* restore previous lexical context */
1145 case stMember
: /* member of struct or union */
1146 f
= &TYPE_FIELDS (top_stack
->cur_type
)[top_stack
->cur_field
++];
1148 f
->bitpos
= sh
->value
;
1150 f
->type
= parse_type (ax
+ sh
->index
, &f
->bitsize
, bigend
);
1153 case stTypedef
: /* type definition */
1154 s
= new_symbol (name
);
1155 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
1156 SYMBOL_CLASS (s
) = LOC_TYPEDEF
;
1157 SYMBOL_BLOCK_VALUE (s
) = top_stack
->cur_block
;
1158 add_symbol (s
, top_stack
->cur_block
);
1159 SYMBOL_TYPE (s
) = parse_type (ax
+ sh
->index
, 0, bigend
);
1160 sh
->value
= (long) SYMBOL_TYPE (s
);
1163 case stFile
: /* file name */
1164 push_parse_stack ();
1165 top_stack
->blocktype
= sh
->st
;
1168 /* I`ve never seen these for C */
1170 break; /* register relocation */
1172 break; /* forwarding address */
1174 break; /* constant */
1176 complain (&unknown_mips_symtype_complaint
, sh
->st
);
1185 /* Parse the type information provided in the raw AX entries for
1186 the symbol SH. Return the bitfield size in BS, in case.
1187 We must byte-swap the AX entries before we use them; BIGEND says whether
1188 they are big-endian or little-endian (from fh->fBigendian). */
1190 static struct type
*
1191 parse_type (ax
, bs
, bigend
)
1196 /* Null entries in this map are treated specially */
1197 static struct type
**map_bt
[] =
1199 &builtin_type_void
, /* btNil */
1201 &builtin_type_char
, /* btChar */
1202 &builtin_type_unsigned_char
,/* btUChar */
1203 &builtin_type_short
, /* btShort */
1204 &builtin_type_unsigned_short
, /* btUShort */
1205 &builtin_type_int
, /* btInt */
1206 &builtin_type_unsigned_int
, /* btUInt */
1207 &builtin_type_long
, /* btLong */
1208 &builtin_type_unsigned_long
,/* btULong */
1209 &builtin_type_float
, /* btFloat */
1210 &builtin_type_double
, /* btDouble */
1217 &builtin_type_complex
, /* btComplex */
1218 &builtin_type_double_complex
, /* btDComplex */
1220 &builtin_type_fixed_dec
, /* btFixedDec */
1221 &builtin_type_float_dec
, /* btFloatDec */
1222 &builtin_type_string
, /* btString */
1225 &builtin_type_void
, /* btVoid */
1226 &builtin_type_long_long
, /* btLongLong */
1227 &builtin_type_unsigned_long_long
, /* btULongLong */
1231 struct type
*tp
= 0;
1234 enum type_code type_code
= TYPE_CODE_UNDEF
;
1236 /* Use aux as a type information record, map its basic type. */
1238 ecoff_swap_tir_in (bigend
, &tax
->a_ti
, t
);
1239 if (t
->bt
> (sizeof (map_bt
) / sizeof (*map_bt
)))
1241 complain (&basic_type_complaint
, t
->bt
);
1242 return builtin_type_int
;
1246 tp
= *map_bt
[t
->bt
];
1252 /* Cannot use builtin types -- build our own */
1256 tp
= lookup_pointer_type (builtin_type_void
);
1260 type_code
= TYPE_CODE_STRUCT
;
1264 type_code
= TYPE_CODE_UNION
;
1268 type_code
= TYPE_CODE_ENUM
;
1272 type_code
= TYPE_CODE_RANGE
;
1276 type_code
= TYPE_CODE_SET
;
1281 complain (&basic_type_complaint
, t
->bt
);
1282 return builtin_type_int
;
1286 /* Skip over any further type qualifiers (FIXME). */
1289 /* This is the way it would work if the compiler worked */
1294 ecoff_swap_tir_in (bigend
, &ax
->a_ti
, t1
);
1296 while (t1
->continued
);
1299 /* Move on to next aux */
1304 *bs
= AUX_GET_WIDTH (bigend
, ax
);
1308 /* All these types really point to some (common) MIPS type
1309 definition, and only the type-qualifiers fully identify
1310 them. We'll make the same effort at sharing. */
1311 if (t
->bt
== btIndirect
||
1312 t
->bt
== btStruct
||
1315 t
->bt
== btTypedef
||
1319 char name
[256], *pn
;
1321 /* Try to cross reference this type */
1322 ax
+= cross_ref (ax
, &tp
, type_code
, &pn
, bigend
);
1323 /* reading .o file ? */
1324 if (tp
== (struct type
*) NULL
)
1325 tp
= init_type (type_code
, 0, 0, (char *) NULL
,
1326 (struct objfile
*) NULL
);
1327 /* SOMEONE OUGHT TO FIX DBXREAD TO DROP "STRUCT" */
1328 sprintf (name
, fmt
, pn
);
1330 /* Usually, TYPE_CODE(tp) is already type_code. The main
1331 exception is if we guessed wrong re struct/union/enum. */
1332 if (TYPE_CODE (tp
) != type_code
)
1334 complain (&bad_tag_guess_complaint
, name
);
1335 TYPE_CODE (tp
) = type_code
;
1337 if (TYPE_NAME (tp
) == NULL
|| !STREQ (TYPE_NAME (tp
), name
))
1338 TYPE_NAME (tp
) = obsavestring (name
, strlen (name
),
1339 ¤t_objfile
->type_obstack
);
1342 /* Deal with range types */
1343 if (t
->bt
== btRange
)
1345 TYPE_NFIELDS (tp
) = 2;
1346 TYPE_FIELDS (tp
) = ((struct field
*)
1347 TYPE_ALLOC (tp
, 2 * sizeof (struct field
)));
1348 TYPE_FIELD_NAME (tp
, 0) = obsavestring ("Low", strlen ("Low"),
1349 ¤t_objfile
->type_obstack
);
1350 TYPE_FIELD_BITPOS (tp
, 0) = AUX_GET_DNLOW (bigend
, ax
);
1352 TYPE_FIELD_NAME (tp
, 1) = obsavestring ("High", strlen ("High"),
1353 ¤t_objfile
->type_obstack
);
1354 TYPE_FIELD_BITPOS (tp
, 1) = AUX_GET_DNHIGH (bigend
, ax
);
1358 /* Parse all the type qualifiers now. If there are more
1359 than 6 the game will continue in the next aux */
1361 #define PARSE_TQ(tq) \
1362 if (t->tq != tqNil) ax += upgrade_type(&tp, t->tq, ax, bigend);
1364 again
:PARSE_TQ (tq0
);
1375 ecoff_swap_tir_in (bigend
, &tax
->a_ti
, t
);
1381 /* Make up a complex type from a basic one. Type is passed by
1382 reference in TPP and side-effected as necessary. The type
1383 qualifier TQ says how to handle the aux symbols at AX for
1384 the symbol SX we are currently analyzing. BIGEND says whether
1385 aux symbols are big-endian or little-endian.
1386 Returns the number of aux symbols we parsed. */
1389 upgrade_type (tpp
, tq
, ax
, bigend
)
1398 /* Used in array processing */
1409 t
= lookup_pointer_type (*tpp
);
1414 t
= lookup_function_type (*tpp
);
1421 /* Determine and record the domain type (type of index) */
1422 ecoff_swap_rndx_in (bigend
, &ax
->a_rndx
, &rndx
);
1428 rf
= AUX_GET_ISYM (bigend
, ax
);
1431 fh
= get_rfd (cur_fd
, rf
);
1433 indx
= parse_type ((ecoff_data (cur_bfd
)->external_aux
1436 (int *) NULL
, bigend
);
1438 /* Get the bounds, and create the array type. */
1440 lower
= AUX_GET_DNLOW (bigend
, ax
);
1442 upper
= AUX_GET_DNHIGH (bigend
, ax
);
1444 rf
= AUX_GET_WIDTH (bigend
, ax
); /* bit size of array element */
1446 range
= create_range_type ((struct type
*) NULL
, indx
,
1449 t
= create_array_type ((struct type
*) NULL
, *tpp
, range
);
1451 /* Check whether supplied array element bit size matches
1452 the known size of the element type. If this complaint
1453 ends up not happening, we can remove this code. It's
1454 here because we aren't sure we understand this *&%&$
1456 id
= TYPE_LENGTH (TYPE_TARGET_TYPE (t
)) << 3; /* bitsize */
1459 /* Most likely an undefined type */
1461 TYPE_LENGTH (TYPE_TARGET_TYPE (t
)) = id
>> 3;
1464 complain (&array_bitsize_complaint
, rf
);
1470 /* Volatile -- currently ignored */
1474 /* Const -- currently ignored */
1478 complain (&unknown_type_qual_complaint
, tq
);
1484 /* Parse a procedure descriptor record PR. Note that the procedure is
1485 parsed _after_ the local symbols, now we just insert the extra
1486 information we need into a MIPS_EFI_SYMBOL_NAME symbol that has
1487 already been placed in the procedure's main block. Note also that
1488 images that have been partially stripped (ld -x) have been deprived
1489 of local symbols, and we have to cope with them here. FIRST_OFF is
1490 the offset of the first procedure for this FDR; we adjust the
1491 address by this amount, but I don't know why. */
1494 parse_procedure (pr
, have_stabs
, first_off
)
1497 unsigned long first_off
;
1499 struct symbol
*s
, *i
;
1501 struct mips_extra_func_info
*e
;
1504 /* Simple rule to find files linked "-x" */
1505 if (cur_fdr
->rss
== -1)
1509 /* Static procedure at address pr->adr. Sigh. */
1510 complain (&pdr_static_symbol_complaint
, pr
->adr
);
1518 ecoff_swap_ext_in (cur_bfd
,
1519 ecoff_data (cur_bfd
)->external_ext
+ pr
->isym
,
1521 sh_name
= ecoff_data (cur_bfd
)->ssext
+ she
.asym
.iss
;
1529 ecoff_swap_sym_in (cur_bfd
,
1530 (ecoff_data (cur_bfd
)->external_sym
1534 sh_name
= ecoff_data (cur_bfd
)->ss
+ cur_fdr
->issBase
+ sh
.iss
;
1539 /* We have to save the cur_fdr across the call to lookup_symbol.
1540 If the pdr is for a static function and if a global function with
1541 the same name exists, lookup_symbol will eventually read in the symtab
1542 for the global function and clobber cur_fdr. */
1543 FDR
*save_cur_fdr
= cur_fdr
;
1544 s
= lookup_symbol (sh_name
, NULL
, VAR_NAMESPACE
, 0, NULL
);
1545 cur_fdr
= save_cur_fdr
;
1548 s
= mylookup_symbol (sh_name
, top_stack
->cur_block
,
1549 VAR_NAMESPACE
, LOC_BLOCK
);
1553 b
= SYMBOL_BLOCK_VALUE (s
);
1557 complain (&pdr_for_nonsymbol_complaint
, sh_name
);
1561 /* FIXME -- delete. We can't do symbol allocation now; it's all done. */
1562 s
= new_symbol (sh_name
);
1563 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
1564 SYMBOL_CLASS (s
) = LOC_BLOCK
;
1565 /* Donno its type, hope int is ok */
1566 SYMBOL_TYPE (s
) = lookup_function_type (builtin_type_int
);
1567 add_symbol (s
, top_stack
->cur_block
);
1568 /* Wont have symbols for this one */
1570 SYMBOL_BLOCK_VALUE (s
) = b
;
1571 BLOCK_FUNCTION (b
) = s
;
1572 BLOCK_START (b
) = pr
->adr
;
1573 /* BOUND used to be the end of procedure's text, but the
1574 argument is no longer passed in. */
1575 BLOCK_END (b
) = bound
;
1576 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
1577 add_block (b
, top_stack
->cur_st
);
1581 i
= mylookup_symbol (MIPS_EFI_SYMBOL_NAME
, b
, LABEL_NAMESPACE
, LOC_CONST
);
1585 e
= (struct mips_extra_func_info
*) SYMBOL_VALUE (i
);
1587 e
->pdr
.isym
= (long) s
;
1588 e
->pdr
.adr
+= cur_fdr
->adr
- first_off
;
1590 /* Correct incorrect setjmp procedure descriptor from the library
1591 to make backtrace through setjmp work. */
1592 if (e
->pdr
.pcreg
== 0 && strcmp (sh_name
, "setjmp") == 0)
1594 complain (&bad_setjmp_pdr_complaint
, 0);
1595 e
->pdr
.pcreg
= RA_REGNUM
;
1596 e
->pdr
.regmask
= 0x80000000;
1597 e
->pdr
.regoffset
= -4;
1602 /* Parse the external symbol ES. Just call parse_symbol() after
1603 making sure we know where the aux are for it. For procedures,
1604 parsing of the PDRs has already provided all the needed
1605 information, we only parse them if SKIP_PROCEDURES is false,
1606 and only if this causes no symbol duplication.
1607 BIGEND says whether aux entries are big-endian or little-endian.
1609 This routine clobbers top_stack->cur_block and ->cur_st. */
1612 parse_external (es
, skip_procedures
, bigend
)
1614 int skip_procedures
;
1619 if (es
->ifd
!= ifdNil
)
1622 cur_fdr
= ecoff_data (cur_bfd
)->fdr
+ cur_fd
;
1623 ax
= ecoff_data (cur_bfd
)->external_aux
+ cur_fdr
->iauxBase
;
1627 cur_fdr
= ecoff_data (cur_bfd
)->fdr
;
1631 /* Reading .o files */
1632 if (es
->asym
.sc
== scUndefined
|| es
->asym
.sc
== scNil
)
1635 switch (es
->asym
.st
)
1655 /* FIXME: Turn this into a complaint? */
1657 printf_filtered ("Warning: %s `%s' is undefined (in %s)\n",
1659 ecoff_data (cur_bfd
)->ssext
+ es
->asym
.iss
,
1660 fdr_name (cur_fdr
));
1664 switch (es
->asym
.st
)
1667 /* If we have full symbols we do not need more */
1668 if (skip_procedures
)
1670 if (mylookup_symbol (ecoff_data (cur_bfd
)->ssext
+ es
->asym
.iss
,
1671 top_stack
->cur_block
,
1672 VAR_NAMESPACE
, LOC_BLOCK
))
1677 /* Note that the case of a symbol with indexNil must be handled
1678 anyways by parse_symbol(). */
1679 parse_symbol (&es
->asym
, ax
, (struct sym_ext
*) NULL
, bigend
);
1680 /* Note that parse_symbol changed es->asym. */
1687 /* Parse the line number info for file descriptor FH into
1688 GDB's linetable LT. MIPS' encoding requires a little bit
1689 of magic to get things out. Note also that MIPS' line
1690 numbers can go back and forth, apparently we can live
1691 with that and do not need to reorder our linetables */
1694 parse_lines (fh
, pr
, lt
)
1697 struct linetable
*lt
;
1699 unsigned char *base
;
1701 int delta
, count
, lineno
= 0;
1702 unsigned long first_off
= pr
->adr
;
1704 if (fh
->cbLineOffset
== 0)
1707 base
= ecoff_data (cur_bfd
)->line
+ fh
->cbLineOffset
;
1709 /* Scan by procedure descriptors */
1711 for (j
= 0; j
< fh
->cpd
; j
++, pr
++)
1716 /* No code for this one */
1717 if (pr
->iline
== ilineNil
||
1718 pr
->lnLow
== -1 || pr
->lnHigh
== -1)
1721 /* Aurgh! To know where to stop expanding we must look-ahead. */
1722 for (l
= 1; l
< (fh
->cpd
- j
); l
++)
1723 if (pr
[l
].iline
!= -1)
1725 if (l
== (fh
->cpd
- j
))
1730 /* When procedures are moved around the linenumbers are
1731 attributed to the next procedure up. */
1732 if (pr
->iline
>= halt
)
1735 base
= ecoff_data (cur_bfd
)->line
+ fh
->cbLineOffset
+ pr
->cbLineOffset
;
1736 adr
= fh
->adr
+ pr
->adr
- first_off
;
1737 l
= adr
>> 2; /* in words */
1738 halt
+= (adr
>> 2) - pr
->iline
;
1739 for (lineno
= pr
->lnLow
; l
< halt
;)
1741 count
= *base
& 0x0f;
1742 delta
= *base
++ >> 4;
1747 delta
= (base
[0] << 8) | base
[1];
1748 if (delta
>= 0x8000)
1752 lineno
+= delta
; /* first delta is 0 */
1753 k
= add_line (lt
, lineno
, l
, k
);
1759 /* Master parsing procedure for first-pass reading of file symbols
1760 into a partial_symtab. */
1763 parse_partial_symbols (objfile
, section_offsets
)
1764 struct objfile
*objfile
;
1765 struct section_offsets
*section_offsets
;
1768 HDRR
*hdr
= &ecoff_data (cur_bfd
)->symbolic_header
;
1769 /* Running pointers */
1771 struct ext_ext
*ext_out
;
1772 struct ext_ext
*ext_out_end
;
1774 register EXTR
*ext_in
;
1777 struct partial_symtab
*pst
;
1779 int past_first_source_file
= 0;
1781 /* List of current psymtab's include files */
1782 char **psymtab_include_list
;
1783 int includes_allocated
;
1786 struct pst_map
*fdr_to_pst
;
1787 /* Index within current psymtab dependency list */
1788 struct partial_symtab
**dependency_list
;
1789 int dependencies_used
, dependencies_allocated
;
1790 struct cleanup
*old_chain
;
1793 extern_tab
= (EXTR
*) obstack_alloc (&objfile
->psymbol_obstack
,
1794 sizeof (EXTR
) * hdr
->iextMax
);
1796 includes_allocated
= 30;
1798 psymtab_include_list
= (char **) alloca (includes_allocated
*
1800 next_symbol_text_func
= mips_next_symbol_text
;
1802 dependencies_allocated
= 30;
1803 dependencies_used
= 0;
1805 (struct partial_symtab
**) alloca (dependencies_allocated
*
1806 sizeof (struct partial_symtab
*));
1808 last_source_file
= NULL
;
1813 * Only parse the Local and External symbols, and the Relative FDR.
1814 * Fixup enough of the loader symtab to be able to use it.
1815 * Allocate space only for the file's portions we need to
1820 max_glevel
= MIN_GLEVEL
;
1822 /* Allocate the map FDR -> PST.
1823 Minor hack: -O3 images might claim some global data belongs
1824 to FDR -1. We`ll go along with that */
1825 fdr_to_pst
= (struct pst_map
*) xzalloc ((hdr
->ifdMax
+ 1) * sizeof *fdr_to_pst
);
1826 old_chain
= make_cleanup (free
, fdr_to_pst
);
1829 struct partial_symtab
*pst
= new_psymtab ("", objfile
);
1830 fdr_to_pst
[-1].pst
= pst
;
1834 /* Pass 0 over external syms: swap them in. */
1835 ext_block
= (EXTR
*) xmalloc (hdr
->iextMax
* sizeof (EXTR
));
1836 make_cleanup (free
, ext_block
);
1838 ext_out
= ecoff_data (cur_bfd
)->external_ext
;
1839 ext_out_end
= ext_out
+ hdr
->iextMax
;
1841 for (; ext_out
< ext_out_end
; ext_out
++, ext_in
++)
1842 ecoff_swap_ext_in (cur_bfd
, ext_out
, ext_in
);
1844 /* Pass 1 over external syms: Presize and partition the list */
1846 ext_in_end
= ext_in
+ hdr
->iextMax
;
1847 for (; ext_in
< ext_in_end
; ext_in
++)
1848 fdr_to_pst
[ext_in
->ifd
].n_globals
++;
1850 /* Pass 1.5 over files: partition out global symbol space */
1852 for (f_idx
= -1; f_idx
< hdr
->ifdMax
; f_idx
++)
1854 fdr_to_pst
[f_idx
].globals_offset
= s_idx
;
1855 s_idx
+= fdr_to_pst
[f_idx
].n_globals
;
1856 fdr_to_pst
[f_idx
].n_globals
= 0;
1859 /* Pass 2 over external syms: fill in external symbols */
1861 ext_in_end
= ext_in
+ hdr
->iextMax
;
1862 for (; ext_in
< ext_in_end
; ext_in
++)
1864 enum minimal_symbol_type ms_type
= mst_text
;
1866 extern_tab
[fdr_to_pst
[ext_in
->ifd
].globals_offset
1867 + fdr_to_pst
[ext_in
->ifd
].n_globals
++] = *ext_in
;
1869 if (ext_in
->asym
.sc
== scUndefined
|| ext_in
->asym
.sc
== scNil
)
1872 name
= ecoff_data (cur_bfd
)->ssext
+ ext_in
->asym
.iss
;
1873 switch (ext_in
->asym
.st
)
1883 ms_type
= mst_unknown
;
1884 complain (&unknown_ext_complaint
, name
);
1886 prim_record_minimal_symbol (name
, ext_in
->asym
.value
, ms_type
);
1889 /* Pass 3 over files, over local syms: fill in static symbols */
1890 for (f_idx
= 0; f_idx
< hdr
->ifdMax
; f_idx
++)
1892 struct partial_symtab
*save_pst
;
1895 cur_fdr
= fh
= ecoff_data (cur_bfd
)->fdr
+ f_idx
;
1899 fdr_to_pst
[f_idx
].pst
= NULL
;
1902 pst
= start_psymtab_common (objfile
, section_offsets
,
1904 fh
->cpd
? fh
->adr
: 0,
1905 objfile
->global_psymbols
.next
,
1906 objfile
->static_psymbols
.next
);
1907 pst
->read_symtab_private
= ((char *)
1908 obstack_alloc (&objfile
->psymbol_obstack
,
1909 sizeof (struct symloc
)));
1910 memset ((PTR
) pst
->read_symtab_private
, 0, sizeof (struct symloc
));
1913 /* Make everything point to everything. */
1914 FDR_IDX (pst
) = f_idx
;
1915 fdr_to_pst
[f_idx
].pst
= pst
;
1917 /* FIXME: This tampers with data from BFD. */
1918 fh
->ioptBase
= (int) pst
;
1920 CUR_BFD (pst
) = cur_bfd
;
1922 /* The way to turn this into a symtab is to call... */
1923 pst
->read_symtab
= mipscoff_psymtab_to_symtab
;
1925 pst
->texthigh
= pst
->textlow
;
1927 /* For stabs-in-ecoff files, the second symbol must be @stab.
1928 This symbol is emitted by mips-tfile to signal that the
1929 current object file uses encapsulated stabs instead of mips
1930 ecoff for local symbols. (It is the second symbol because
1931 the first symbol is the stFile used to signal the start of a
1933 processing_gcc_compilation
= 0;
1936 ecoff_swap_sym_in (cur_bfd
,
1937 (ecoff_data (cur_bfd
)->external_sym
1941 if (STREQ (ecoff_data (cur_bfd
)->ss
+ fh
->issBase
+ sh
.iss
,
1943 processing_gcc_compilation
= 2;
1946 if (processing_gcc_compilation
!= 0)
1948 for (cur_sdx
= 2; cur_sdx
< fh
->csym
; cur_sdx
++)
1953 ecoff_swap_sym_in (cur_bfd
,
1954 (ecoff_data (cur_bfd
)->external_sym
1958 type_code
= MIPS_UNMARK_STAB (sh
.index
);
1959 if (!MIPS_IS_STAB (&sh
))
1961 if (sh
.st
== stProc
|| sh
.st
== stStaticProc
)
1963 long procaddr
= sh
.value
;
1967 isym
= AUX_GET_ISYM (fh
->fBigendian
,
1968 (ecoff_data (cur_bfd
)->external_aux
1971 ecoff_swap_sym_in (cur_bfd
,
1972 (ecoff_data (cur_bfd
)->external_sym
1979 long high
= procaddr
+ sh
.value
;
1980 if (high
> pst
->texthigh
)
1981 pst
->texthigh
= high
;
1986 #define SET_NAMESTRING() \
1987 namestring = ecoff_data (cur_bfd)->ss + fh->issBase + sh.iss
1988 #define CUR_SYMBOL_TYPE type_code
1989 #define CUR_SYMBOL_VALUE sh.value
1990 #define START_PSYMTAB(ofile,secoff,fname,low,symoff,global_syms,static_syms)\
1992 #define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps) (void)0
1993 #define HANDLE_RBRAC(val) \
1994 if ((val) > save_pst->texthigh) save_pst->texthigh = (val);
1995 #include "partial-stab.h"
2000 for (cur_sdx
= 0; cur_sdx
< fh
->csym
;)
2003 enum address_class
class;
2005 ecoff_swap_sym_in (cur_bfd
,
2006 (ecoff_data (cur_bfd
)->external_sym
2011 if (MIPS_IS_STAB (&sh
))
2017 if (sh
.sc
== scUndefined
|| sh
.sc
== scNil
||
2018 sh
.index
== 0xfffff)
2020 /* FIXME, premature? */
2025 name
= ecoff_data (cur_bfd
)->ss
+ fh
->issBase
+ sh
.iss
;
2033 case stProc
: /* Asm labels apparently */
2034 case stStaticProc
: /* Function */
2035 ADD_PSYMBOL_TO_LIST (name
, strlen (name
),
2036 VAR_NAMESPACE
, LOC_BLOCK
,
2037 objfile
->static_psymbols
, sh
.value
,
2038 psymtab_language
, objfile
);
2039 /* Skip over procedure to next one. */
2040 if (sh
.index
>= hdr
->iauxMax
)
2042 /* Should not happen, but does when cross-compiling
2043 with the MIPS compiler. FIXME -- pull later. */
2044 complain (&index_complaint
, name
);
2045 new_sdx
= cur_sdx
+ 1; /* Don't skip at all */
2048 new_sdx
= AUX_GET_ISYM (fh
->fBigendian
,
2049 (ecoff_data (cur_bfd
)->external_aux
2052 procaddr
= sh
.value
;
2054 if (new_sdx
<= cur_sdx
)
2056 /* This should not happen either... FIXME. */
2057 complain (&aux_index_complaint
, name
);
2058 new_sdx
= cur_sdx
+ 1; /* Don't skip backward */
2062 ecoff_swap_sym_in (cur_bfd
,
2063 (ecoff_data (cur_bfd
)->external_sym
2070 high
= procaddr
+ sh
.value
;
2071 if (high
> pst
->texthigh
)
2072 pst
->texthigh
= high
;
2075 case stStatic
: /* Variable */
2079 case stTypedef
:/* Typedef */
2080 class = LOC_TYPEDEF
;
2083 case stConstant
: /* Constant decl */
2090 case stBlock
: /* { }, str, un, enum*/
2091 if (sh
.sc
== scInfo
)
2093 ADD_PSYMBOL_TO_LIST (name
, strlen (name
),
2094 STRUCT_NAMESPACE
, LOC_TYPEDEF
,
2095 objfile
->static_psymbols
,
2097 psymtab_language
, objfile
);
2099 /* Skip over the block */
2101 if (new_sdx
<= cur_sdx
)
2103 /* This happens with the Ultrix kernel. */
2104 complain (&block_index_complaint
, name
);
2105 new_sdx
= cur_sdx
+ 1; /* Don't skip backward */
2110 case stFile
: /* File headers */
2111 case stLabel
: /* Labels */
2112 case stEnd
: /* Ends of files */
2115 case stLocal
: /* Local variables */
2116 /* Normally these are skipped because we skip over
2117 all blocks we see. However, these can occur
2118 as visible symbols in a .h file that contains code. */
2122 /* Both complaints are valid: one gives symbol name,
2123 the other the offending symbol type. */
2124 complain (&unknown_sym_complaint
, name
);
2125 complain (&unknown_st_complaint
, sh
.st
);
2129 /* Use this gdb symbol */
2130 ADD_PSYMBOL_TO_LIST (name
, strlen (name
),
2131 VAR_NAMESPACE
, class,
2132 objfile
->static_psymbols
, sh
.value
,
2133 psymtab_language
, objfile
);
2135 cur_sdx
++; /* Go to next file symbol */
2138 /* Now do enter the external symbols. */
2139 ext_ptr
= &extern_tab
[fdr_to_pst
[f_idx
].globals_offset
];
2140 cur_sdx
= fdr_to_pst
[f_idx
].n_globals
;
2141 PST_PRIVATE (save_pst
)->extern_count
= cur_sdx
;
2142 PST_PRIVATE (save_pst
)->extern_tab
= ext_ptr
;
2143 for (; --cur_sdx
>= 0; ext_ptr
++)
2145 register struct partial_symbol
*psym
;
2146 enum address_class
class;
2150 if (ext_ptr
->ifd
!= f_idx
)
2152 psh
= &ext_ptr
->asym
;
2162 complain (&unknown_ext_complaint
,
2163 ecoff_data (cur_bfd
)->ssext
+ psh
->iss
);
2164 /* Fall through, pretend it's global. */
2169 name
= ecoff_data (cur_bfd
)->ssext
+ psh
->iss
;
2170 ADD_PSYMBOL_ADDR_TO_LIST (name
, strlen (name
),
2171 VAR_NAMESPACE
, class,
2172 objfile
->global_psymbols
, (CORE_ADDR
) psh
->value
,
2173 psymtab_language
, objfile
);
2177 end_psymtab (save_pst
, psymtab_include_list
, includes_used
,
2178 -1, save_pst
->texthigh
,
2179 dependency_list
, dependencies_used
);
2180 if (objfile
->ei
.entry_point
>= save_pst
->textlow
&&
2181 objfile
->ei
.entry_point
< save_pst
->texthigh
)
2183 objfile
->ei
.entry_file_lowpc
= save_pst
->textlow
;
2184 objfile
->ei
.entry_file_highpc
= save_pst
->texthigh
;
2188 /* Now scan the FDRs for dependencies */
2189 for (f_idx
= 0; f_idx
< hdr
->ifdMax
; f_idx
++)
2192 fh
= f_idx
+ ecoff_data (cur_bfd
)->fdr
;
2193 pst
= fdr_to_pst
[f_idx
].pst
;
2195 /* This should catch stabs-in-ecoff. */
2200 { /* If there are no functions defined here ... */
2201 /* ...then presumably a .h file: drop reverse depends .h->.c */
2202 for (; s_id0
< fh
->crfd
; s_id0
++)
2206 ecoff_swap_rfd_in (cur_bfd
,
2207 (ecoff_data (cur_bfd
)->external_rfd
2213 s_id0
++; /* Skip self-dependency */
2218 pst
->number_of_dependencies
= fh
->crfd
- s_id0
;
2220 ((struct partial_symtab
**)
2221 obstack_alloc (&objfile
->psymbol_obstack
,
2222 (pst
->number_of_dependencies
2223 * sizeof (struct partial_symtab
*))));
2224 for (s_idx
= s_id0
; s_idx
< fh
->crfd
; s_idx
++)
2228 ecoff_swap_rfd_in (cur_bfd
,
2229 (ecoff_data (cur_bfd
)->external_rfd
2233 if (rh
< 0 || rh
>= hdr
->ifdMax
)
2234 complain (&bad_file_number_complaint
, rh
);
2236 pst
->dependencies
[s_idx
- s_id0
] = fdr_to_pst
[rh
].pst
;
2239 do_cleanups (old_chain
);
2244 /* Do the initial analisys of the F_IDX-th file descriptor.
2245 Allocates a partial symtab for it, and builds the list
2246 of dependent files by recursion. LEV says at which level
2247 of recursion we are called (to pretty up debug traces) */
2249 static struct partial_symtab
*
2250 parse_fdr (f_idx
, lev
, objfile
)
2253 struct objfile
*objfile
;
2256 register struct partial_symtab
*pst
;
2259 fh
= ecoff_data (cur_bfd
)->fdr
+ f_idx
;
2261 /* Use this to indicate into which symtab this file was parsed */
2263 return (struct partial_symtab
*) fh
->ioptBase
;
2265 /* Debuggability level */
2266 if (compare_glevel (max_glevel
, fh
->glevel
) < 0)
2267 max_glevel
= fh
->glevel
;
2269 /* Make a new partial_symtab */
2270 pst
= new_psymtab (fdr_name (fh
), objfile
);
2278 pst
->textlow
= fh
->adr
;
2279 pst
->texthigh
= fh
->cpd
; /* To be fixed later */
2282 /* Make everything point to everything. */
2283 FDR_IDX (pst
) = f_idx
;
2284 fdr_to_pst
[f_idx
].pst
= pst
;
2285 fh
->ioptBase
= (int) pst
;
2287 /* Analyze its dependencies */
2293 { /* If there are no functions defined here ... */
2294 /* ...then presumably a .h file: drop reverse depends .h->.c */
2295 for (; s_id0
< fh
->crfd
; s_id0
++)
2299 ecoff_swap_rfd_in (cur_bfd
,
2300 (ecoff_data (cur_bfd
)->external_rfd
2306 s_id0
++; /* Skip self-dependency */
2311 pst
->number_of_dependencies
= fh
->crfd
- s_id0
;
2312 pst
->dependencies
= ((struct partial_symtab
**)
2313 obstack_alloc (&objfile
->psymbol_obstack
,
2314 (pst
->number_of_dependencies
2315 * sizeof (struct partial_symtab
*))));
2316 for (s_idx
= s_id0
; s_idx
< fh
->crfd
; s_idx
++)
2320 ecoff_swap_rfd_in (cur_bfd
,
2321 (ecoff_data (cur_bfd
)->external_rfd
2325 pst
->dependencies
[s_idx
- s_id0
] = parse_fdr (rh
, lev
+ 1, objfile
);
2334 mips_next_symbol_text ()
2339 ecoff_swap_sym_in (cur_bfd
,
2340 (ecoff_data (cur_bfd
)->external_sym
2344 return ecoff_data (cur_bfd
)->ss
+ cur_fdr
->issBase
+ sh
.iss
;
2347 /* Ancillary function to psymtab_to_symtab(). Does all the work
2348 for turning the partial symtab PST into a symtab, recurring
2349 first on all dependent psymtabs. The argument FILENAME is
2350 only passed so we can see in debug stack traces what file
2353 This function has a split personality, based on whether the
2354 symbol table contains ordinary ecoff symbols, or stabs-in-ecoff.
2355 The flow of control and even the memory allocation differs. FIXME. */
2358 psymtab_to_symtab_1 (pst
, filename
)
2359 struct partial_symtab
*pst
;
2365 struct linetable
*lines
;
2371 /* Read in all partial symbtabs on which this one is dependent.
2372 NOTE that we do have circular dependencies, sigh. We solved
2373 that by setting pst->readin before this point. */
2375 for (i
= 0; i
< pst
->number_of_dependencies
; i
++)
2376 if (!pst
->dependencies
[i
]->readin
)
2378 /* Inform about additional files to be read in. */
2381 fputs_filtered (" ", stdout
);
2383 fputs_filtered ("and ", stdout
);
2385 printf_filtered ("%s...",
2386 pst
->dependencies
[i
]->filename
);
2387 wrap_here (""); /* Flush output */
2390 /* We only pass the filename for debug purposes */
2391 psymtab_to_symtab_1 (pst
->dependencies
[i
],
2392 pst
->dependencies
[i
]->filename
);
2395 /* Now read the symbols for this symtab */
2397 current_objfile
= pst
->objfile
;
2398 cur_fd
= FDR_IDX (pst
);
2399 fh
= (cur_fd
== -1) ? (FDR
*) NULL
: ecoff_data (cur_bfd
)->fdr
+ cur_fd
;
2402 /* See comment in parse_partial_symbols about the @stabs sentinel. */
2403 processing_gcc_compilation
= 0;
2404 if (fh
!= (FDR
*) NULL
&& fh
->csym
>= 2)
2408 ecoff_swap_sym_in (cur_bfd
,
2409 (ecoff_data (cur_bfd
)->external_sym
2413 if (STREQ (ecoff_data (cur_bfd
)->ss
+ fh
->issBase
+ sh
.iss
,
2416 /* We indicate that this is a GCC compilation so that certain
2417 features will be enabled in stabsread/dbxread. */
2418 processing_gcc_compilation
= 2;
2422 if (processing_gcc_compilation
!= 0)
2424 struct pdr_ext
*pdr_ptr
;
2425 struct pdr_ext
*pdr_end
;
2427 unsigned long first_off
;
2429 /* This symbol table contains stabs-in-ecoff entries. */
2431 /* Parse local symbols first */
2433 if (fh
->csym
<= 2) /* FIXME, this blows psymtab->symtab ptr */
2435 current_objfile
= NULL
;
2438 for (cur_sdx
= 2; cur_sdx
< fh
->csym
; cur_sdx
++)
2444 ecoff_swap_sym_in (cur_bfd
,
2445 (ecoff_data (cur_bfd
)->external_sym
2449 name
= ecoff_data (cur_bfd
)->ss
+ fh
->issBase
+ sh
.iss
;
2451 if (MIPS_IS_STAB (&sh
))
2453 int type_code
= MIPS_UNMARK_STAB (sh
.index
);
2454 process_one_symbol (type_code
, 0, valu
, name
,
2455 pst
->section_offsets
, pst
->objfile
);
2456 if (type_code
== N_FUN
)
2458 /* Make up special symbol to contain
2459 procedure specific info */
2460 struct mips_extra_func_info
*e
=
2461 ((struct mips_extra_func_info
*)
2462 obstack_alloc (¤t_objfile
->symbol_obstack
,
2463 sizeof (struct mips_extra_func_info
)));
2464 struct symbol
*s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
2465 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
2466 SYMBOL_CLASS (s
) = LOC_CONST
;
2467 SYMBOL_TYPE (s
) = builtin_type_void
;
2468 SYMBOL_VALUE (s
) = (int) e
;
2469 add_symbol_to_list (s
, &local_symbols
);
2472 else if (sh
.st
== stLabel
&& sh
.index
!= indexNil
)
2474 /* Handle encoded stab line number. */
2475 record_line (current_subfile
, sh
.index
, valu
);
2477 else if (sh
.st
== stProc
|| sh
.st
== stStaticProc
|| sh
.st
== stEnd
)
2478 /* These are generated by gcc-2.x, do not complain */
2481 complain (&stab_unknown_complaint
, name
);
2483 st
= end_symtab (pst
->texthigh
, 0, 0, pst
->objfile
, SECT_OFF_TEXT
);
2486 /* Sort the symbol table now, we are done adding symbols to it.
2487 We must do this before parse_procedure calls lookup_symbol. */
2488 sort_symtab_syms (st
);
2490 /* This may not be necessary for stabs symtabs. FIXME. */
2493 /* Fill in procedure info next. */
2495 pdr_ptr
= ecoff_data (cur_bfd
)->external_pdr
+ fh
->ipdFirst
;
2496 pdr_end
= pdr_ptr
+ fh
->cpd
;
2497 for (; pdr_ptr
< pdr_end
; pdr_ptr
++)
2501 ecoff_swap_pdr_in (cur_bfd
, pdr_ptr
, &pr
);
2507 parse_procedure (&pr
, 1, first_off
);
2512 /* This symbol table contains ordinary ecoff entries. */
2514 /* FIXME: doesn't use pst->section_offsets. */
2520 /* How many symbols will we need */
2521 /* FIXME, this does not count enum values. */
2522 f_max
= pst
->n_global_syms
+ pst
->n_static_syms
;
2526 st
= new_symtab ("unknown", f_max
, 0, pst
->objfile
);
2530 f_max
+= fh
->csym
+ fh
->cpd
;
2531 maxlines
= 2 * fh
->cline
;
2532 st
= new_symtab (pst
->filename
, 2 * f_max
, maxlines
, pst
->objfile
);
2535 lines
= LINETABLE (st
);
2536 pending_list
= PST_PRIVATE (pst
)->pending_list
;
2537 if (pending_list
== 0)
2539 pending_list
= ((struct mips_pending
**)
2540 xzalloc (ecoff_data (cur_bfd
)->symbolic_header
.ifdMax
2541 * sizeof (struct mips_pending
*)));
2542 PST_PRIVATE (pst
)->pending_list
= pending_list
;
2545 /* Get a new lexical context */
2547 push_parse_stack ();
2548 top_stack
->cur_st
= st
;
2549 top_stack
->cur_block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (st
),
2551 BLOCK_START (top_stack
->cur_block
) = fh
? fh
->adr
: 0;
2552 BLOCK_END (top_stack
->cur_block
) = 0;
2553 top_stack
->blocktype
= stFile
;
2554 top_stack
->maxsyms
= 2 * f_max
;
2555 top_stack
->cur_type
= 0;
2556 top_stack
->procadr
= 0;
2557 top_stack
->numargs
= 0;
2561 struct sym_ext
*sym_ptr
;
2562 struct sym_ext
*sym_end
;
2564 /* Parse local symbols first */
2565 sym_ptr
= ecoff_data (cur_bfd
)->external_sym
+ fh
->isymBase
;
2566 sym_end
= sym_ptr
+ fh
->csym
;
2567 while (sym_ptr
< sym_end
)
2572 ecoff_swap_sym_in (cur_bfd
, sym_ptr
, &sh
);
2573 c
= parse_symbol (&sh
,
2574 (ecoff_data (cur_bfd
)->external_aux
2576 sym_ptr
, fh
->fBigendian
);
2577 /* FIXME: We must swap the modified symbol back out,
2578 although we would rather not. See parse_symbol. */
2579 ecoff_swap_sym_out (cur_bfd
, &sh
, sym_ptr
);
2583 /* Linenumbers. At the end, check if we can save memory.
2584 parse_lines has to look ahead an arbitrary number of PDR
2585 structures, so we swap them all first. */
2589 struct cleanup
*old_chain
;
2590 struct pdr_ext
*pdr_ptr
;
2591 struct pdr_ext
*pdr_end
;
2595 pr_block
= (PDR
*) xmalloc (fh
->cpd
* sizeof (PDR
));
2597 old_chain
= make_cleanup (free
, pr_block
);
2599 pdr_ptr
= ecoff_data (cur_bfd
)->external_pdr
+ fh
->ipdFirst
;
2600 pdr_end
= pdr_ptr
+ fh
->cpd
;
2602 for (; pdr_ptr
< pdr_end
; pdr_ptr
++, pdr_in
++)
2603 ecoff_swap_pdr_in (cur_bfd
, pdr_ptr
, pdr_in
);
2605 parse_lines (fh
, pr_block
, lines
);
2606 if (lines
->nitems
< fh
->cline
)
2607 lines
= shrink_linetable (lines
);
2609 /* Fill in procedure info next. */
2611 pdr_in_end
= pdr_in
+ fh
->cpd
;
2612 for (; pdr_in
< pdr_in_end
; pdr_in
++)
2613 parse_procedure (pdr_in
, 0, pr_block
->adr
);
2615 do_cleanups (old_chain
);
2619 LINETABLE (st
) = lines
;
2621 /* .. and our share of externals.
2622 XXX use the global list to speed up things here. how?
2623 FIXME, Maybe quit once we have found the right number of ext's? */
2624 top_stack
->cur_st
= st
;
2625 top_stack
->cur_block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack
->cur_st
),
2627 top_stack
->blocktype
= stFile
;
2628 top_stack
->maxsyms
= (ecoff_data (cur_bfd
)->symbolic_header
.isymMax
2629 + ecoff_data (cur_bfd
)->symbolic_header
.ipdMax
2630 + ecoff_data (cur_bfd
)->symbolic_header
.iextMax
);
2632 ext_ptr
= PST_PRIVATE (pst
)->extern_tab
;
2633 for (i
= PST_PRIVATE (pst
)->extern_count
; --i
>= 0; ext_ptr
++)
2634 parse_external (ext_ptr
, 1, fh
->fBigendian
);
2636 /* If there are undefined, tell the user */
2637 if (n_undef_symbols
)
2639 printf_filtered ("File %s contains %d unresolved references:",
2640 st
->filename
, n_undef_symbols
);
2641 printf_filtered ("\n\t%4d variables\n\t%4d procedures\n\t%4d labels\n",
2642 n_undef_vars
, n_undef_procs
, n_undef_labels
);
2643 n_undef_symbols
= n_undef_labels
= n_undef_vars
= n_undef_procs
= 0;
2648 /* Sort the symbol table now, we are done adding symbols to it.*/
2649 sort_symtab_syms (st
);
2654 /* Now link the psymtab and the symtab. */
2657 current_objfile
= NULL
;
2660 /* Ancillary parsing procedures. */
2662 /* Lookup the type at relative index RN. Return it in TPP
2663 if found and in any event come up with its name PNAME.
2664 BIGEND says whether aux symbols are big-endian or not (from fh->fBigendian).
2665 Return value says how many aux symbols we ate. */
2668 cross_ref (ax
, tpp
, type_code
, pname
, bigend
)
2671 enum type_code type_code
; /* Use to alloc new type if none is found. */
2679 ecoff_swap_rndx_in (bigend
, &ax
->a_rndx
, rn
);
2681 /* Escape index means 'the next one' */
2682 if (rn
->rfd
== 0xfff)
2685 rf
= AUX_GET_ISYM (bigend
, ax
+ 1);
2695 *pname
= "<undefined>";
2700 * Find the relative file descriptor and the symbol in it
2702 FDR
*fh
= get_rfd (cur_fd
, rf
);
2703 struct sym_ext
*esh
;
2707 /* If we have processed this symbol then we left a forwarding
2708 pointer to the corresponding GDB symbol. If not, we`ll put
2709 it in a list of pending symbols, to be processed later when
2710 the file will be. In any event, we collect the name for the
2711 type here. Which is why we made a first pass at strings. */
2713 esh
= ecoff_data (cur_bfd
)->external_sym
+ fh
->isymBase
+ rn
->index
;
2714 ecoff_swap_sym_in (cur_bfd
, esh
, &sh
);
2716 /* Careful, we might be looking at .o files */
2718 *pname
= "<undefined>";
2720 *pname
= ecoff_data (cur_bfd
)->ss
+ fh
->issBase
+ sh
.iss
;
2722 /* Have we parsed it ? */
2723 if (sh
.value
!= 0 && sh
.st
== stParsed
)
2725 t
= (struct type
*) sh
.value
;
2730 /* Avoid duplicates */
2731 struct mips_pending
*p
= is_pending_symbol (fh
, esh
);
2736 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
,
2737 (struct objfile
*) NULL
);
2738 add_pending (fh
, esh
, *tpp
);
2743 /* We used one auxent normally, two if we got a "next one" rf. */
2748 /* Quick&dirty lookup procedure, to avoid the MI ones that require
2749 keeping the symtab sorted */
2751 static struct symbol
*
2752 mylookup_symbol (name
, block
, namespace, class)
2754 register struct block
*block
;
2755 enum namespace namespace;
2756 enum address_class
class;
2758 register int bot
, top
, inc
;
2759 register struct symbol
*sym
;
2762 top
= BLOCK_NSYMS (block
);
2766 sym
= BLOCK_SYM (block
, bot
);
2767 if (SYMBOL_NAME (sym
)[0] == inc
2768 && SYMBOL_NAMESPACE (sym
) == namespace
2769 && SYMBOL_CLASS (sym
) == class
2770 && STREQ (SYMBOL_NAME (sym
), name
))
2774 block
= BLOCK_SUPERBLOCK (block
);
2776 return mylookup_symbol (name
, block
, namespace, class);
2781 /* Add a new symbol S to a block B.
2782 Infrequently, we will need to reallocate the block to make it bigger.
2783 We only detect this case when adding to top_stack->cur_block, since
2784 that's the only time we know how big the block is. FIXME. */
2791 int nsyms
= BLOCK_NSYMS (b
)++;
2792 struct block
*origb
;
2793 struct parse_stack
*stackp
;
2795 if (b
== top_stack
->cur_block
&&
2796 nsyms
>= top_stack
->maxsyms
)
2798 complain (&block_overflow_complaint
, SYMBOL_NAME (s
));
2799 /* In this case shrink_block is actually grow_block, since
2800 BLOCK_NSYMS(b) is larger than its current size. */
2802 b
= shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
2804 /* Now run through the stack replacing pointers to the
2805 original block. shrink_block has already done this
2806 for the blockvector and BLOCK_FUNCTION. */
2807 for (stackp
= top_stack
; stackp
; stackp
= stackp
->next
)
2809 if (stackp
->cur_block
== origb
)
2811 stackp
->cur_block
= b
;
2812 stackp
->maxsyms
= BLOCK_NSYMS (b
);
2816 BLOCK_SYM (b
, nsyms
) = s
;
2819 /* Add a new block B to a symtab S */
2826 struct blockvector
*bv
= BLOCKVECTOR (s
);
2828 bv
= (struct blockvector
*) xrealloc ((PTR
) bv
,
2829 (sizeof (struct blockvector
)
2830 + BLOCKVECTOR_NBLOCKS (bv
)
2831 * sizeof (bv
->block
)));
2832 if (bv
!= BLOCKVECTOR (s
))
2833 BLOCKVECTOR (s
) = bv
;
2835 BLOCKVECTOR_BLOCK (bv
, BLOCKVECTOR_NBLOCKS (bv
)++) = b
;
2838 /* Add a new linenumber entry (LINENO,ADR) to a linevector LT.
2839 MIPS' linenumber encoding might need more than one byte
2840 to describe it, LAST is used to detect these continuation lines.
2842 Combining lines with the same line number seems like a bad idea.
2843 E.g: There could be a line number entry with the same line number after the
2844 prologue and GDB should not ignore it (this is a better way to find
2845 a prologue than mips_skip_prologue).
2846 But due to the compressed line table format there are line number entries
2847 for the same line which are needed to bridge the gap to the next
2848 line number entry. These entries have a bogus address info with them
2849 and we are unable to tell them from intended duplicate line number
2851 This is another reason why -ggdb debugging format is preferable. */
2854 add_line (lt
, lineno
, adr
, last
)
2855 struct linetable
*lt
;
2861 last
= -2; /* make sure we record first line */
2863 if (last
== lineno
) /* skip continuation lines */
2866 lt
->item
[lt
->nitems
].line
= lineno
;
2867 lt
->item
[lt
->nitems
++].pc
= adr
<< 2;
2871 /* Sorting and reordering procedures */
2873 /* Blocks with a smaller low bound should come first */
2876 compare_blocks (arg1
, arg2
)
2877 const void *arg1
, *arg2
;
2879 register int addr_diff
;
2880 struct block
**b1
= (struct block
**) arg1
;
2881 struct block
**b2
= (struct block
**) arg2
;
2883 addr_diff
= (BLOCK_START ((*b1
))) - (BLOCK_START ((*b2
)));
2885 return (BLOCK_END ((*b2
))) - (BLOCK_END ((*b1
)));
2889 /* Sort the blocks of a symtab S.
2890 Reorder the blocks in the blockvector by code-address,
2891 as required by some MI search routines */
2897 struct blockvector
*bv
= BLOCKVECTOR (s
);
2899 if (BLOCKVECTOR_NBLOCKS (bv
) <= 2)
2902 if (BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) == 0)
2903 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) = 0;
2904 if (BLOCK_END (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) == 0)
2905 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) = 0;
2909 * This is very unfortunate: normally all functions are compiled in
2910 * the order they are found, but if the file is compiled -O3 things
2911 * are very different. It would be nice to find a reliable test
2912 * to detect -O3 images in advance.
2914 if (BLOCKVECTOR_NBLOCKS (bv
) > 3)
2915 qsort (&BLOCKVECTOR_BLOCK (bv
, FIRST_LOCAL_BLOCK
),
2916 BLOCKVECTOR_NBLOCKS (bv
) - FIRST_LOCAL_BLOCK
,
2917 sizeof (struct block
*),
2921 register CORE_ADDR high
= 0;
2922 register int i
, j
= BLOCKVECTOR_NBLOCKS (bv
);
2924 for (i
= FIRST_LOCAL_BLOCK
; i
< j
; i
++)
2925 if (high
< BLOCK_END (BLOCKVECTOR_BLOCK (bv
, i
)))
2926 high
= BLOCK_END (BLOCKVECTOR_BLOCK (bv
, i
));
2927 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) = high
;
2930 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) =
2931 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, FIRST_LOCAL_BLOCK
));
2933 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) =
2934 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
));
2935 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) =
2936 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
));
2940 /* Constructor/restructor/destructor procedures */
2942 /* Allocate a new symtab for NAME. Needs an estimate of how many symbols
2943 MAXSYMS and linenumbers MAXLINES we'll put in it */
2945 static struct symtab
*
2946 new_symtab (name
, maxsyms
, maxlines
, objfile
)
2950 struct objfile
*objfile
;
2952 struct symtab
*s
= allocate_symtab (name
, objfile
);
2954 LINETABLE (s
) = new_linetable (maxlines
);
2956 /* All symtabs must have at least two blocks */
2957 BLOCKVECTOR (s
) = new_bvect (2);
2958 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), GLOBAL_BLOCK
) = new_block (maxsyms
);
2959 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), STATIC_BLOCK
) = new_block (maxsyms
);
2960 BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), STATIC_BLOCK
)) =
2961 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), GLOBAL_BLOCK
);
2963 s
->free_code
= free_linetable
;
2968 /* Allocate a new partial_symtab NAME */
2970 static struct partial_symtab
*
2971 new_psymtab (name
, objfile
)
2973 struct objfile
*objfile
;
2975 struct partial_symtab
*psymtab
;
2977 psymtab
= allocate_psymtab (name
, objfile
);
2979 /* Keep a backpointer to the file's symbols */
2981 psymtab
->read_symtab_private
= ((char *)
2982 obstack_alloc (&objfile
->psymbol_obstack
,
2983 sizeof (struct symloc
)));
2984 memset ((PTR
) psymtab
->read_symtab_private
, 0, sizeof (struct symloc
));
2985 CUR_BFD (psymtab
) = cur_bfd
;
2987 /* The way to turn this into a symtab is to call... */
2988 psymtab
->read_symtab
= mipscoff_psymtab_to_symtab
;
2993 /* Allocate a linetable array of the given SIZE. Since the struct
2994 already includes one item, we subtract one when calculating the
2995 proper size to allocate. */
2997 static struct linetable
*
2998 new_linetable (size
)
3001 struct linetable
*l
;
3003 size
= (size
- 1) * sizeof (l
->item
) + sizeof (struct linetable
);
3004 l
= (struct linetable
*) xmalloc (size
);
3009 /* Oops, too big. Shrink it. This was important with the 2.4 linetables,
3010 I am not so sure about the 3.4 ones.
3012 Since the struct linetable already includes one item, we subtract one when
3013 calculating the proper size to allocate. */
3015 static struct linetable
*
3016 shrink_linetable (lt
)
3017 struct linetable
*lt
;
3020 return (struct linetable
*) xrealloc ((PTR
) lt
,
3021 (sizeof (struct linetable
)
3023 * sizeof (lt
->item
))));
3026 /* Allocate and zero a new blockvector of NBLOCKS blocks. */
3028 static struct blockvector
*
3032 struct blockvector
*bv
;
3035 size
= sizeof (struct blockvector
) + nblocks
* sizeof (struct block
*);
3036 bv
= (struct blockvector
*) xzalloc (size
);
3038 BLOCKVECTOR_NBLOCKS (bv
) = nblocks
;
3043 /* Allocate and zero a new block of MAXSYMS symbols */
3045 static struct block
*
3049 int size
= sizeof (struct block
) + (maxsyms
- 1) * sizeof (struct symbol
*);
3051 return (struct block
*) xzalloc (size
);
3054 /* Ooops, too big. Shrink block B in symtab S to its minimal size.
3055 Shrink_block can also be used by add_symbol to grow a block. */
3057 static struct block
*
3063 struct blockvector
*bv
= BLOCKVECTOR (s
);
3066 /* Just reallocate it and fix references to the old one */
3068 new = (struct block
*) xrealloc ((PTR
) b
,
3069 (sizeof (struct block
)
3070 + ((BLOCK_NSYMS (b
) - 1)
3071 * sizeof (struct symbol
*))));
3073 /* Should chase pointers to old one. Fortunately, that`s just
3074 the block`s function and inferior blocks */
3075 if (BLOCK_FUNCTION (new) && SYMBOL_BLOCK_VALUE (BLOCK_FUNCTION (new)) == b
)
3076 SYMBOL_BLOCK_VALUE (BLOCK_FUNCTION (new)) = new;
3077 for (i
= 0; i
< BLOCKVECTOR_NBLOCKS (bv
); i
++)
3078 if (BLOCKVECTOR_BLOCK (bv
, i
) == b
)
3079 BLOCKVECTOR_BLOCK (bv
, i
) = new;
3080 else if (BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv
, i
)) == b
)
3081 BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv
, i
)) = new;
3085 /* Create a new symbol with printname NAME */
3087 static struct symbol
*
3091 struct symbol
*s
= ((struct symbol
*)
3092 obstack_alloc (¤t_objfile
->symbol_obstack
,
3093 sizeof (struct symbol
)));
3095 memset ((PTR
) s
, 0, sizeof (*s
));
3096 SYMBOL_NAME (s
) = name
;
3100 /* Create a new type with printname NAME */
3102 static struct type
*
3108 t
= alloc_type (current_objfile
);
3109 TYPE_NAME (t
) = name
;
3110 TYPE_CPLUS_SPECIFIC (t
) = (struct cplus_struct_type
*) &cplus_struct_default
;
3115 /* Things used for calling functions in the inferior.
3116 These functions are exported to our companion
3117 mips-tdep.c file and are here because they play
3118 with the symbol-table explicitly. */
3120 /* Sigtramp: make sure we have all the necessary information
3121 about the signal trampoline code. Since the official code
3122 from MIPS does not do so, we make up that information ourselves.
3123 If they fix the library (unlikely) this code will neutralize itself. */
3130 struct block
*b
, *b0
;
3132 sigtramp_address
= -1;
3134 /* We know it is sold as sigvec */
3135 s
= lookup_symbol ("sigvec", 0, VAR_NAMESPACE
, 0, NULL
);
3137 /* Most programs do not play with signals */
3139 s
= lookup_symbol ("_sigtramp", 0, VAR_NAMESPACE
, 0, NULL
);
3142 b0
= SYMBOL_BLOCK_VALUE (s
);
3144 /* A label of sigvec, to be more precise */
3145 s
= lookup_symbol ("sigtramp", b0
, VAR_NAMESPACE
, 0, NULL
);
3148 /* But maybe this program uses its own version of sigvec */
3152 /* Did we or MIPSco fix the library ? */
3153 if (SYMBOL_CLASS (s
) == LOC_BLOCK
)
3155 sigtramp_address
= BLOCK_START (SYMBOL_BLOCK_VALUE (s
));
3156 sigtramp_end
= BLOCK_END (SYMBOL_BLOCK_VALUE (s
));
3160 sigtramp_address
= SYMBOL_VALUE (s
);
3161 sigtramp_end
= sigtramp_address
+ 0x88; /* black magic */
3163 /* But what symtab does it live in ? */
3164 st
= find_pc_symtab (SYMBOL_VALUE (s
));
3167 * Ok, there goes the fix: turn it into a procedure, with all the
3168 * needed info. Note we make it a nested procedure of sigvec,
3169 * which is the way the (assembly) code is actually written.
3171 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
3172 SYMBOL_CLASS (s
) = LOC_BLOCK
;
3173 SYMBOL_TYPE (s
) = init_type (TYPE_CODE_FUNC
, 4, 0, (char *) NULL
,
3174 (struct objfile
*) NULL
);
3175 TYPE_TARGET_TYPE (SYMBOL_TYPE (s
)) = builtin_type_void
;
3177 /* Need a block to allocate MIPS_EFI_SYMBOL_NAME in */
3179 SYMBOL_BLOCK_VALUE (s
) = b
;
3180 BLOCK_START (b
) = sigtramp_address
;
3181 BLOCK_END (b
) = sigtramp_end
;
3182 BLOCK_FUNCTION (b
) = s
;
3183 BLOCK_SUPERBLOCK (b
) = BLOCK_SUPERBLOCK (b0
);
3187 /* Make a MIPS_EFI_SYMBOL_NAME entry for it */
3189 struct mips_extra_func_info
*e
=
3190 ((struct mips_extra_func_info
*)
3191 xzalloc (sizeof (struct mips_extra_func_info
)));
3193 e
->numargs
= 0; /* the kernel thinks otherwise */
3194 /* align_longword(sigcontext + SIGFRAME) */
3195 e
->pdr
.frameoffset
= 0x150;
3196 e
->pdr
.framereg
= SP_REGNUM
;
3197 /* read_next_frame_reg provides the true pc at the time of signal */
3198 e
->pdr
.pcreg
= PC_REGNUM
;
3199 e
->pdr
.regmask
= -2;
3200 e
->pdr
.regoffset
= -(41 * sizeof (int));
3201 e
->pdr
.fregmask
= -1;
3202 e
->pdr
.fregoffset
= -(7 * sizeof (int));
3203 e
->pdr
.isym
= (long) s
;
3205 current_objfile
= st
->objfile
; /* Keep new_symbol happy */
3206 s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
3207 SYMBOL_VALUE (s
) = (int) e
;
3208 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
3209 SYMBOL_CLASS (s
) = LOC_CONST
;
3210 SYMBOL_TYPE (s
) = builtin_type_void
;
3211 current_objfile
= NULL
;
3214 BLOCK_SYM (b
, BLOCK_NSYMS (b
)++) = s
;
3218 /* Fake up identical offsets for all sections. */
3220 struct section_offsets
*
3221 mipscoff_symfile_offsets (objfile
, addr
)
3222 struct objfile
*objfile
;
3225 struct section_offsets
*section_offsets
;
3228 section_offsets
= ((struct section_offsets
*)
3229 obstack_alloc (&objfile
->psymbol_obstack
,
3230 (sizeof (struct section_offsets
)
3231 + (sizeof (section_offsets
->offsets
)
3232 * (SECT_OFF_MAX
- 1)))));
3234 for (i
= 0; i
< SECT_OFF_MAX
; i
++)
3235 ANOFFSET (section_offsets
, i
) = addr
;
3237 return section_offsets
;
3240 /* Initialization */
3242 static struct sym_fns ecoff_sym_fns
=
3244 "ecoff", /* sym_name: name or name prefix of BFD target type */
3245 5, /* sym_namelen: number of significant sym_name chars */
3246 mipscoff_new_init
, /* sym_new_init: init anything gbl to entire symtab */
3247 mipscoff_symfile_init
, /* sym_init: read initial info, setup for sym_read() */
3248 mipscoff_symfile_read
, /* sym_read: read a symbol file into symtab */
3249 mipscoff_symfile_finish
, /* sym_finish: finished with file, cleanup */
3250 mipscoff_symfile_offsets
, /* sym_offsets: dummy FIXME til implem sym reloc */
3251 NULL
/* next: pointer to next struct sym_fns */
3256 _initialize_mipsread ()
3258 add_symtab_fns (&ecoff_sym_fns
);
3260 /* Missing basic types */
3262 builtin_type_string
=
3263 init_type (TYPE_CODE_STRING
,
3264 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
3266 (struct objfile
*) NULL
);
3267 builtin_type_complex
=
3268 init_type (TYPE_CODE_FLT
,
3269 TARGET_COMPLEX_BIT
/ TARGET_CHAR_BIT
,
3271 (struct objfile
*) NULL
);
3272 builtin_type_double_complex
=
3273 init_type (TYPE_CODE_FLT
,
3274 TARGET_DOUBLE_COMPLEX_BIT
/ TARGET_CHAR_BIT
,
3275 0, "double complex",
3276 (struct objfile
*) NULL
);
3277 builtin_type_fixed_dec
=
3278 init_type (TYPE_CODE_INT
,
3279 TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
3281 (struct objfile
*) NULL
);
3282 builtin_type_float_dec
=
3283 init_type (TYPE_CODE_FLT
,
3284 TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
3285 0, "floating decimal",
3286 (struct objfile
*) NULL
);