1 /* Read a symbol table in ECOFF format (Third-Eye).
2 Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
3 1997, 1998, 1999, 2000, 2001
4 Free Software Foundation, Inc.
5 Original version contributed by Alessandro Forin (af@cs.cmu.edu) at
6 CMU. Major work by Per Bothner, John Gilmore and Ian Lance Taylor
9 This file is part of GDB.
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. */
26 /* This module provides the function mdebug_build_psymtabs. It reads
27 ECOFF debugging information into partial symbol tables. The
28 debugging information is read from two structures. A struct
29 ecoff_debug_swap includes the sizes of each ECOFF structure and
30 swapping routines; these are fixed for a particular target. A
31 struct ecoff_debug_info points to the debugging information for a
32 particular object file.
34 ECOFF symbol tables are mostly written in the byte order of the
35 target machine. However, one section of the table (the auxiliary
36 symbol information) is written in the host byte order. There is a
37 bit in the other symbol info which describes which host byte order
38 was used. ECOFF thereby takes the trophy from Intel `b.out' for
39 the most brain-dead adaptation of a file format to byte order.
41 This module can read all four of the known byte-order combinations,
42 on any type of host. */
52 #include "stabsread.h"
53 #include "complaints.h"
56 /* These are needed if the tm.h file does not contain the necessary
57 mips specific definitions. */
59 #ifndef MIPS_EFI_SYMBOL_NAME
60 #define MIPS_EFI_SYMBOL_NAME "__GDB_EFI_INFO__"
61 extern void ecoff_relocate_efi (struct symbol
*, CORE_ADDR
);
63 #include "coff/symconst.h"
64 typedef struct mips_extra_func_info
69 *mips_extra_func_info_t
;
76 #include <sys/types.h>
80 #include "gdb_string.h"
82 #include "gdb-stabs.h"
86 #include "coff/ecoff.h" /* COFF-like aspects of ecoff files */
88 #include "libaout.h" /* Private BFD a.out information. */
89 #include "aout/aout64.h"
90 #include "aout/stab_gnu.h" /* STABS information */
92 #include "expression.h"
93 #include "language.h" /* Needed inside partial-stab.h */
95 extern void _initialize_mdebugread (void);
97 /* Provide a way to test if we have both ECOFF and ELF symbol tables.
98 We use this define in order to know whether we should override a
99 symbol's ECOFF section with its ELF section. This is necessary in
100 case the symbol's ELF section could not be represented in ECOFF. */
101 #define ECOFF_IN_ELF(bfd) (bfd_get_flavour (bfd) == bfd_target_elf_flavour \
102 && bfd_get_section_by_name (bfd, ".mdebug") != NULL)
105 /* We put a pointer to this structure in the read_symtab_private field
110 /* Index of the FDR that this psymtab represents. */
112 /* The BFD that the psymtab was created from. */
114 const struct ecoff_debug_swap
*debug_swap
;
115 struct ecoff_debug_info
*debug_info
;
116 struct mdebug_pending
**pending_list
;
117 /* Pointer to external symbols for this file. */
119 /* Size of extern_tab. */
121 enum language pst_language
;
124 #define PST_PRIVATE(p) ((struct symloc *)(p)->read_symtab_private)
125 #define FDR_IDX(p) (PST_PRIVATE(p)->fdr_idx)
126 #define CUR_BFD(p) (PST_PRIVATE(p)->cur_bfd)
127 #define DEBUG_SWAP(p) (PST_PRIVATE(p)->debug_swap)
128 #define DEBUG_INFO(p) (PST_PRIVATE(p)->debug_info)
129 #define PENDING_LIST(p) (PST_PRIVATE(p)->pending_list)
131 #define SC_IS_TEXT(sc) ((sc) == scText \
132 || (sc) == scRConst \
135 #define SC_IS_DATA(sc) ((sc) == scData \
140 #define SC_IS_COMMON(sc) ((sc) == scCommon || (sc) == scSCommon)
141 #define SC_IS_BSS(sc) ((sc) == scBss || (sc) == scSBss)
142 #define SC_IS_UNDEF(sc) ((sc) == scUndefined || (sc) == scSUndefined)
145 /* Things we import explicitly from other modules */
147 extern int info_verbose
;
149 /* Various complaints about symbol reading that don't abort the process */
151 static struct complaint bad_file_number_complaint
=
152 {"bad file number %d", 0, 0};
154 static struct complaint index_complaint
=
155 {"bad aux index at symbol %s", 0, 0};
157 static struct complaint aux_index_complaint
=
158 {"bad proc end in aux found from symbol %s", 0, 0};
160 static struct complaint block_index_complaint
=
161 {"bad aux index at block symbol %s", 0, 0};
163 static struct complaint unknown_ext_complaint
=
164 {"unknown external symbol %s", 0, 0};
166 static struct complaint unknown_sym_complaint
=
167 {"unknown local symbol %s", 0, 0};
169 static struct complaint unknown_st_complaint
=
170 {"with type %d", 0, 0};
172 static struct complaint block_overflow_complaint
=
173 {"block containing %s overfilled", 0, 0};
175 static struct complaint basic_type_complaint
=
176 {"cannot map ECOFF basic type 0x%x for %s", 0, 0};
178 static struct complaint unknown_type_qual_complaint
=
179 {"unknown type qualifier 0x%x", 0, 0};
181 static struct complaint array_index_type_complaint
=
182 {"illegal array index type for %s, assuming int", 0, 0};
184 static struct complaint bad_tag_guess_complaint
=
185 {"guessed tag type of %s incorrectly", 0, 0};
187 static struct complaint block_member_complaint
=
188 {"declaration block contains unhandled symbol type %d", 0, 0};
190 static struct complaint stEnd_complaint
=
191 {"stEnd with storage class %d not handled", 0, 0};
193 static struct complaint unknown_mdebug_symtype_complaint
=
194 {"unknown symbol type 0x%x", 0, 0};
196 static struct complaint stab_unknown_complaint
=
197 {"unknown stabs symbol %s", 0, 0};
199 static struct complaint pdr_for_nonsymbol_complaint
=
200 {"PDR for %s, but no symbol", 0, 0};
202 static struct complaint pdr_static_symbol_complaint
=
203 {"can't handle PDR for static proc at 0x%lx", 0, 0};
205 static struct complaint bad_setjmp_pdr_complaint
=
206 {"fixing bad setjmp PDR from libc", 0, 0};
208 static struct complaint bad_fbitfield_complaint
=
209 {"can't handle TIR fBitfield for %s", 0, 0};
211 static struct complaint bad_continued_complaint
=
212 {"illegal TIR continued for %s", 0, 0};
214 static struct complaint bad_rfd_entry_complaint
=
215 {"bad rfd entry for %s: file %d, index %d", 0, 0};
217 static struct complaint unexpected_type_code_complaint
=
218 {"unexpected type code for %s", 0, 0};
220 static struct complaint unable_to_cross_ref_complaint
=
221 {"unable to cross ref btTypedef for %s", 0, 0};
223 static struct complaint bad_indirect_xref_complaint
=
224 {"unable to cross ref btIndirect for %s", 0, 0};
226 static struct complaint illegal_forward_tq0_complaint
=
227 {"illegal tq0 in forward typedef for %s", 0, 0};
229 static struct complaint illegal_forward_bt_complaint
=
230 {"illegal bt %d in forward typedef for %s", 0, 0};
232 static struct complaint bad_linetable_guess_complaint
=
233 {"guessed size of linetable for %s incorrectly", 0, 0};
235 static struct complaint bad_ext_ifd_complaint
=
236 {"bad ifd for external symbol: %d (max %d)", 0, 0};
238 static struct complaint bad_ext_iss_complaint
=
239 {"bad iss for external symbol: %ld (max %ld)", 0, 0};
241 /* Macros and extra defs */
243 /* Puns: hard to find whether -g was used and how */
245 #define MIN_GLEVEL GLEVEL_0
246 #define compare_glevel(a,b) \
247 (((a) == GLEVEL_3) ? ((b) < GLEVEL_3) : \
248 ((b) == GLEVEL_3) ? -1 : (int)((b) - (a)))
250 /* Things that really are local to this module */
252 /* Remember what we deduced to be the source language of this psymtab. */
254 static enum language psymtab_language
= language_unknown
;
260 /* How to parse debugging information for CUR_BFD. */
262 static const struct ecoff_debug_swap
*debug_swap
;
264 /* Pointers to debugging information for CUR_BFD. */
266 static struct ecoff_debug_info
*debug_info
;
268 /* Pointer to current file decriptor record, and its index */
273 /* Index of current symbol */
277 /* Note how much "debuggable" this image is. We would like
278 to see at least one FDR with full symbols */
280 static int max_gdbinfo
;
281 static int max_glevel
;
283 /* When examining .o files, report on undefined symbols */
285 static int n_undef_symbols
, n_undef_labels
, n_undef_vars
, n_undef_procs
;
287 /* Pseudo symbol to use when putting stabs into the symbol table. */
289 static char stabs_symbol
[] = STABS_SYMBOL
;
291 /* Types corresponding to mdebug format bt* basic types. */
293 static struct type
*mdebug_type_void
;
294 static struct type
*mdebug_type_char
;
295 static struct type
*mdebug_type_short
;
296 static struct type
*mdebug_type_int_32
;
297 #define mdebug_type_int mdebug_type_int_32
298 static struct type
*mdebug_type_int_64
;
299 static struct type
*mdebug_type_long_32
;
300 static struct type
*mdebug_type_long_64
;
301 static struct type
*mdebug_type_long_long_64
;
302 static struct type
*mdebug_type_unsigned_char
;
303 static struct type
*mdebug_type_unsigned_short
;
304 static struct type
*mdebug_type_unsigned_int_32
;
305 static struct type
*mdebug_type_unsigned_int_64
;
306 static struct type
*mdebug_type_unsigned_long_32
;
307 static struct type
*mdebug_type_unsigned_long_64
;
308 static struct type
*mdebug_type_unsigned_long_long_64
;
309 static struct type
*mdebug_type_adr_32
;
310 static struct type
*mdebug_type_adr_64
;
311 static struct type
*mdebug_type_float
;
312 static struct type
*mdebug_type_double
;
313 static struct type
*mdebug_type_complex
;
314 static struct type
*mdebug_type_double_complex
;
315 static struct type
*mdebug_type_fixed_dec
;
316 static struct type
*mdebug_type_float_dec
;
317 static struct type
*mdebug_type_string
;
319 /* Types for symbols from files compiled without debugging info. */
321 static struct type
*nodebug_func_symbol_type
;
322 static struct type
*nodebug_var_symbol_type
;
324 /* Nonzero if we have seen ecoff debugging info for a file. */
326 static int found_ecoff_debugging_info
;
328 /* Forward declarations */
330 static void add_pending (FDR
*, char *, struct type
*);
332 static struct mdebug_pending
*is_pending_symbol (FDR
*, char *);
334 static void pop_parse_stack (void);
336 static void push_parse_stack (void);
338 static char *fdr_name (FDR
*);
340 static void mdebug_psymtab_to_symtab (struct partial_symtab
*);
343 upgrade_type (int, struct type
**, int, union aux_ext
*, int, char *);
345 static void parse_partial_symbols (struct objfile
*);
347 static FDR
* get_rfd (int, int);
349 static int has_opaque_xref (FDR
*, SYMR
*);
352 cross_ref (int, union aux_ext
*, struct type
**, enum type_code
,
353 char **, int, char *);
355 static struct symbol
*new_symbol (char *);
357 static struct type
*new_type (char *);
359 static struct block
*new_block (int);
361 static struct symtab
*new_symtab (char *, int, int, struct objfile
*);
363 static struct linetable
*new_linetable (int);
365 static struct blockvector
*new_bvect (int);
368 parse_symbol (SYMR
*, union aux_ext
*, char *, int, struct section_offsets
*,
371 static struct type
*parse_type (int, union aux_ext
*, unsigned int, int *,
374 static struct symbol
*mylookup_symbol (char *, struct block
*, namespace_enum
,
377 static struct block
*shrink_block (struct block
*, struct symtab
*);
379 static PTR
xzalloc (unsigned int);
381 static void sort_blocks (struct symtab
*);
383 static int compare_blocks (const void *, const void *);
385 static struct partial_symtab
*new_psymtab (char *, struct objfile
*);
387 static void psymtab_to_symtab_1 (struct partial_symtab
*, char *);
389 static void add_block (struct block
*, struct symtab
*);
391 static void add_symbol (struct symbol
*, struct block
*);
393 static int add_line (struct linetable
*, int, CORE_ADDR
, int);
395 static struct linetable
*shrink_linetable (struct linetable
*);
398 handle_psymbol_enumerators (struct objfile
*, FDR
*, int, CORE_ADDR
);
400 static char *mdebug_next_symbol_text (struct objfile
*);
402 /* Address bounds for the signal trampoline in inferior, if any */
404 CORE_ADDR sigtramp_address
, sigtramp_end
;
406 /* Allocate zeroed memory */
409 xzalloc (unsigned int size
)
411 PTR p
= xmalloc (size
);
417 /* Exported procedure: Builds a symtab from the PST partial one.
418 Restores the environment in effect when PST was created, delegates
419 most of the work to an ancillary procedure, and sorts
420 and reorders the symtab list at the end */
423 mdebug_psymtab_to_symtab (struct partial_symtab
*pst
)
431 printf_filtered ("Reading in symbols for %s...", pst
->filename
);
432 gdb_flush (gdb_stdout
);
435 next_symbol_text_func
= mdebug_next_symbol_text
;
437 psymtab_to_symtab_1 (pst
, pst
->filename
);
439 /* Match with global symbols. This only needs to be done once,
440 after all of the symtabs and dependencies have been read in. */
441 scan_file_globals (pst
->objfile
);
444 printf_filtered ("done.\n");
447 /* File-level interface functions */
449 /* Find a file descriptor given its index RF relative to a file CF */
452 get_rfd (int cf
, int rf
)
458 fdrs
= debug_info
->fdr
;
460 /* Object files do not have the RFD table, all refs are absolute */
463 (*debug_swap
->swap_rfd_in
) (cur_bfd
,
464 ((char *) debug_info
->external_rfd
466 * debug_swap
->external_rfd_size
)),
471 /* Return a safer print NAME for a file descriptor */
477 return "<stripped file>";
480 return debug_info
->ss
+ f
->issBase
+ f
->rss
;
484 /* Read in and parse the symtab of the file OBJFILE. Symbols from
485 different sections are relocated via the SECTION_OFFSETS. */
488 mdebug_build_psymtabs (struct objfile
*objfile
,
489 const struct ecoff_debug_swap
*swap
,
490 struct ecoff_debug_info
*info
)
492 cur_bfd
= objfile
->obfd
;
496 /* Make sure all the FDR information is swapped in. */
497 if (info
->fdr
== (FDR
*) NULL
)
503 info
->fdr
= (FDR
*) obstack_alloc (&objfile
->psymbol_obstack
,
504 (info
->symbolic_header
.ifdMax
506 fdr_src
= info
->external_fdr
;
508 + info
->symbolic_header
.ifdMax
* swap
->external_fdr_size
);
510 for (; fdr_src
< fdr_end
; fdr_src
+= swap
->external_fdr_size
, fdr_ptr
++)
511 (*swap
->swap_fdr_in
) (objfile
->obfd
, fdr_src
, fdr_ptr
);
514 parse_partial_symbols (objfile
);
517 /* Check to make sure file was compiled with -g. If not, warn the
518 user of this limitation. */
519 if (compare_glevel (max_glevel
, GLEVEL_2
) < 0)
521 if (max_gdbinfo
== 0)
522 printf_unfiltered ("\n%s not compiled with -g, debugging support is limited.\n",
524 printf_unfiltered ("You should compile with -g2 or -g3 for best debugging support.\n");
525 gdb_flush (gdb_stdout
);
530 /* Local utilities */
532 /* Map of FDR indexes to partial symtabs */
536 struct partial_symtab
*pst
; /* the psymtab proper */
537 long n_globals
; /* exported globals (external symbols) */
538 long globals_offset
; /* cumulative */
542 /* Utility stack, used to nest procedures and blocks properly.
543 It is a doubly linked list, to avoid too many alloc/free.
544 Since we might need it quite a few times it is NOT deallocated
547 static struct parse_stack
549 struct parse_stack
*next
, *prev
;
550 struct symtab
*cur_st
; /* Current symtab. */
551 struct block
*cur_block
; /* Block in it. */
553 /* What are we parsing. stFile, or stBlock are for files and
554 blocks. stProc or stStaticProc means we have seen the start of a
555 procedure, but not the start of the block within in. When we see
556 the start of that block, we change it to stNil, without pushing a
557 new block, i.e. stNil means both a procedure and a block. */
561 int maxsyms
; /* Max symbols in this block. */
562 struct type
*cur_type
; /* Type we parse fields for. */
563 int cur_field
; /* Field number in cur_type. */
564 CORE_ADDR procadr
; /* Start addres of this procedure */
565 int numargs
; /* Its argument count */
568 *top_stack
; /* Top stack ptr */
571 /* Enter a new lexical context */
574 push_parse_stack (void)
576 struct parse_stack
*new;
578 /* Reuse frames if possible */
579 if (top_stack
&& top_stack
->prev
)
580 new = top_stack
->prev
;
582 new = (struct parse_stack
*) xzalloc (sizeof (struct parse_stack
));
583 /* Initialize new frame with previous content */
586 register struct parse_stack
*prev
= new->prev
;
589 top_stack
->prev
= new;
591 new->next
= top_stack
;
596 /* Exit a lexical context */
599 pop_parse_stack (void)
604 top_stack
= top_stack
->next
;
608 /* Cross-references might be to things we haven't looked at
609 yet, e.g. type references. To avoid too many type
610 duplications we keep a quick fixup table, an array
611 of lists of references indexed by file descriptor */
613 struct mdebug_pending
615 struct mdebug_pending
*next
; /* link */
616 char *s
; /* the unswapped symbol */
617 struct type
*t
; /* its partial type descriptor */
621 /* The pending information is kept for an entire object file, and used
622 to be in the sym_private field. I took it out when I split
623 mdebugread from mipsread, because this might not be the only type
624 of symbols read from an object file. Instead, we allocate the
625 pending information table when we create the partial symbols, and
626 we store a pointer to the single table in each psymtab. */
628 static struct mdebug_pending
**pending_list
;
630 /* Check whether we already saw symbol SH in file FH */
632 static struct mdebug_pending
*
633 is_pending_symbol (FDR
*fh
, char *sh
)
635 int f_idx
= fh
- debug_info
->fdr
;
636 register struct mdebug_pending
*p
;
638 /* Linear search is ok, list is typically no more than 10 deep */
639 for (p
= pending_list
[f_idx
]; p
; p
= p
->next
)
645 /* Add a new symbol SH of type T */
648 add_pending (FDR
*fh
, char *sh
, struct type
*t
)
650 int f_idx
= fh
- debug_info
->fdr
;
651 struct mdebug_pending
*p
= is_pending_symbol (fh
, sh
);
653 /* Make sure we do not make duplicates */
656 p
= ((struct mdebug_pending
*)
657 obstack_alloc (¤t_objfile
->psymbol_obstack
,
658 sizeof (struct mdebug_pending
)));
661 p
->next
= pending_list
[f_idx
];
662 pending_list
[f_idx
] = p
;
667 /* Parsing Routines proper. */
669 /* Parse a single symbol. Mostly just make up a GDB symbol for it.
670 For blocks, procedures and types we open a new lexical context.
671 This is basically just a big switch on the symbol's type. Argument
672 AX is the base pointer of aux symbols for this file (fh->iauxBase).
673 EXT_SH points to the unswapped symbol, which is needed for struct,
674 union, etc., types; it is NULL for an EXTR. BIGEND says whether
675 aux symbols are big-endian or little-endian. Return count of
676 SYMR's handled (normally one). */
679 parse_symbol (SYMR
*sh
, union aux_ext
*ax
, char *ext_sh
, int bigend
,
680 struct section_offsets
*section_offsets
, struct objfile
*objfile
)
682 const bfd_size_type external_sym_size
= debug_swap
->external_sym_size
;
683 void (*const swap_sym_in
) (bfd
*, PTR
, SYMR
*) = debug_swap
->swap_sym_in
;
687 struct mdebug_pending
*pend
;
691 enum address_class
class;
693 long svalue
= sh
->value
;
696 if (ext_sh
== (char *) NULL
)
697 name
= debug_info
->ssext
+ sh
->iss
;
699 name
= debug_info
->ss
+ cur_fdr
->issBase
+ sh
->iss
;
705 /* Do not relocate relative values.
706 The value of a stEnd symbol is the displacement from the
707 corresponding start symbol value.
708 The value of a stBlock symbol is the displacement from the
709 procedure address. */
710 if (sh
->st
!= stEnd
&& sh
->st
!= stBlock
)
711 sh
->value
+= ANOFFSET (section_offsets
, SECT_OFF_TEXT (objfile
));
718 sh
->value
+= ANOFFSET (section_offsets
, SECT_OFF_DATA (objfile
));
722 sh
->value
+= ANOFFSET (section_offsets
, SECT_OFF_BSS (objfile
));
731 case stGlobal
: /* external symbol, goes into global block */
733 b
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack
->cur_st
),
735 s
= new_symbol (name
);
736 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
739 case stStatic
: /* static data, goes into current block. */
741 b
= top_stack
->cur_block
;
742 s
= new_symbol (name
);
743 if (SC_IS_COMMON (sh
->sc
))
745 /* It is a FORTRAN common block. At least for SGI Fortran the
746 address is not in the symbol; we need to fix it later in
747 scan_file_globals. */
748 int bucket
= hashname (SYMBOL_NAME (s
));
749 SYMBOL_VALUE_CHAIN (s
) = global_sym_chain
[bucket
];
750 global_sym_chain
[bucket
] = s
;
753 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
756 case stLocal
: /* local variable, goes into current block */
757 if (sh
->sc
== scRegister
)
759 class = LOC_REGISTER
;
760 svalue
= ECOFF_REG_TO_REGNUM (svalue
);
764 b
= top_stack
->cur_block
;
765 s
= new_symbol (name
);
766 SYMBOL_VALUE (s
) = svalue
;
768 data
: /* Common code for symbols describing data */
769 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
770 SYMBOL_CLASS (s
) = class;
773 /* Type could be missing if file is compiled without debugging info. */
774 if (SC_IS_UNDEF (sh
->sc
)
775 || sh
->sc
== scNil
|| sh
->index
== indexNil
)
776 SYMBOL_TYPE (s
) = nodebug_var_symbol_type
;
778 SYMBOL_TYPE (s
) = parse_type (cur_fd
, ax
, sh
->index
, 0, bigend
, name
);
779 /* Value of a data symbol is its memory address */
782 case stParam
: /* arg to procedure, goes into current block */
784 found_ecoff_debugging_info
= 1;
785 top_stack
->numargs
++;
787 /* Special GNU C++ name. */
788 if (is_cplus_marker (name
[0]) && name
[1] == 't' && name
[2] == 0)
789 name
= "this"; /* FIXME, not alloc'd in obstack */
790 s
= new_symbol (name
);
792 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
796 /* Pass by value in register. */
797 SYMBOL_CLASS (s
) = LOC_REGPARM
;
798 svalue
= ECOFF_REG_TO_REGNUM (svalue
);
801 /* Pass by reference on stack. */
802 SYMBOL_CLASS (s
) = LOC_REF_ARG
;
805 /* Pass by reference in register. */
806 SYMBOL_CLASS (s
) = LOC_REGPARM_ADDR
;
807 svalue
= ECOFF_REG_TO_REGNUM (svalue
);
810 /* Pass by value on stack. */
811 SYMBOL_CLASS (s
) = LOC_ARG
;
814 SYMBOL_VALUE (s
) = svalue
;
815 SYMBOL_TYPE (s
) = parse_type (cur_fd
, ax
, sh
->index
, 0, bigend
, name
);
816 add_symbol (s
, top_stack
->cur_block
);
819 case stLabel
: /* label, goes into current block */
820 s
= new_symbol (name
);
821 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
; /* so that it can be used */
822 SYMBOL_CLASS (s
) = LOC_LABEL
; /* but not misused */
823 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
824 SYMBOL_TYPE (s
) = mdebug_type_int
;
825 add_symbol (s
, top_stack
->cur_block
);
828 case stProc
: /* Procedure, usually goes into global block */
829 case stStaticProc
: /* Static procedure, goes into current block */
830 s
= new_symbol (name
);
831 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
832 SYMBOL_CLASS (s
) = LOC_BLOCK
;
833 /* Type of the return value */
834 if (SC_IS_UNDEF (sh
->sc
) || sh
->sc
== scNil
)
838 t
= parse_type (cur_fd
, ax
, sh
->index
+ 1, 0, bigend
, name
);
839 if (STREQ (name
, "malloc") && t
->code
== TYPE_CODE_VOID
)
841 /* I don't know why, but, at least under Alpha GNU/Linux,
842 when linking against a malloc without debugging
843 symbols, its read as a function returning void---this
844 is bad because it means we cannot call functions with
845 string arguments interactively; i.e., "call
846 printf("howdy\n")" would fail with the error message
847 "program has no memory available". To avoid this, we
848 patch up the type and make it void*
849 instead. (davidm@azstarnet.com)
851 t
= make_pointer_type (t
, NULL
);
854 b
= top_stack
->cur_block
;
855 if (sh
->st
== stProc
)
857 struct blockvector
*bv
= BLOCKVECTOR (top_stack
->cur_st
);
858 /* The next test should normally be true, but provides a
859 hook for nested functions (which we don't want to make
861 if (b
== BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
))
862 b
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
863 /* Irix 5 sometimes has duplicate names for the same
864 function. We want to add such names up at the global
865 level, not as a nested function. */
866 else if (sh
->value
== top_stack
->procadr
)
867 b
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
871 /* Make a type for the procedure itself */
872 SYMBOL_TYPE (s
) = lookup_function_type (t
);
874 /* Create and enter a new lexical context */
875 b
= new_block (top_stack
->maxsyms
);
876 SYMBOL_BLOCK_VALUE (s
) = b
;
877 BLOCK_FUNCTION (b
) = s
;
878 BLOCK_START (b
) = BLOCK_END (b
) = sh
->value
;
879 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
880 add_block (b
, top_stack
->cur_st
);
882 /* Not if we only have partial info */
883 if (SC_IS_UNDEF (sh
->sc
) || sh
->sc
== scNil
)
887 top_stack
->cur_block
= b
;
888 top_stack
->blocktype
= sh
->st
;
889 top_stack
->cur_type
= SYMBOL_TYPE (s
);
890 top_stack
->cur_field
= -1;
891 top_stack
->procadr
= sh
->value
;
892 top_stack
->numargs
= 0;
895 /* Beginning of code for structure, union, and enum definitions.
896 They all share a common set of local variables, defined here. */
898 enum type_code type_code
;
904 case stStruct
: /* Start a block defining a struct type */
905 type_code
= TYPE_CODE_STRUCT
;
906 goto structured_common
;
908 case stUnion
: /* Start a block defining a union type */
909 type_code
= TYPE_CODE_UNION
;
910 goto structured_common
;
912 case stEnum
: /* Start a block defining an enum type */
913 type_code
= TYPE_CODE_ENUM
;
914 goto structured_common
;
916 case stBlock
: /* Either a lexical block, or some type */
917 if (sh
->sc
!= scInfo
&& !SC_IS_COMMON (sh
->sc
))
918 goto case_stBlock_code
; /* Lexical block */
920 type_code
= TYPE_CODE_UNDEF
; /* We have a type. */
922 /* Common code for handling struct, union, enum, and/or as-yet-
923 unknown-type blocks of info about structured data. `type_code'
924 has been set to the proper TYPE_CODE, if we know it. */
926 found_ecoff_debugging_info
= 1;
928 top_stack
->blocktype
= stBlock
;
930 /* First count the number of fields and the highest value. */
933 for (ext_tsym
= ext_sh
+ external_sym_size
;
935 ext_tsym
+= external_sym_size
)
939 (*swap_sym_in
) (cur_bfd
, ext_tsym
, &tsym
);
947 if (nfields
== 0 && type_code
== TYPE_CODE_UNDEF
)
949 /* If the type of the member is Nil (or Void),
950 without qualifiers, assume the tag is an
952 Alpha cc -migrate enums are recognized by a zero
953 index and a zero symbol value.
954 DU 4.0 cc enums are recognized by a member type of
955 btEnum without qualifiers and a zero symbol value. */
956 if (tsym
.index
== indexNil
957 || (tsym
.index
== 0 && sh
->value
== 0))
958 type_code
= TYPE_CODE_ENUM
;
961 (*debug_swap
->swap_tir_in
) (bigend
,
962 &ax
[tsym
.index
].a_ti
,
964 if ((tir
.bt
== btNil
|| tir
.bt
== btVoid
965 || (tir
.bt
== btEnum
&& sh
->value
== 0))
967 type_code
= TYPE_CODE_ENUM
;
971 if (tsym
.value
> max_value
)
972 max_value
= tsym
.value
;
981 /* This is a no-op; is it trying to tell us something
982 we should be checking? */
983 if (tsym
.sc
== scVariant
); /*UNIMPLEMENTED */
987 /* This is something like a struct within a
988 struct. Skip over the fields of the inner
989 struct. The -1 is because the for loop will
990 increment ext_tsym. */
991 ext_tsym
= ((char *) debug_info
->external_sym
992 + ((cur_fdr
->isymBase
+ tsym
.index
- 1)
993 * external_sym_size
));
999 /* mips cc puts out a typedef for struct x if it is not yet
1000 defined when it encounters
1001 struct y { struct x *xp; };
1006 /* Irix5 cc puts out a stIndirect for struct x if it is not
1007 yet defined when it encounters
1008 struct y { struct x *xp; };
1013 complain (&block_member_complaint
, tsym
.st
);
1018 /* In an stBlock, there is no way to distinguish structs,
1019 unions, and enums at this point. This is a bug in the
1020 original design (that has been fixed with the recent
1021 addition of the stStruct, stUnion, and stEnum symbol
1022 types.) The way you can tell is if/when you see a variable
1023 or field of that type. In that case the variable's type
1024 (in the AUX table) says if the type is struct, union, or
1025 enum, and points back to the stBlock here. So you can
1026 patch the tag kind up later - but only if there actually is
1027 a variable or field of that type.
1029 So until we know for sure, we will guess at this point.
1031 If the first member has index==indexNil or a void type,
1032 assume we have an enumeration.
1033 Otherwise, if there is more than one member, and all
1034 the members have offset 0, assume we have a union.
1035 Otherwise, assume we have a struct.
1037 The heuristic could guess wrong in the case of of an
1038 enumeration with no members or a union with one (or zero)
1039 members, or when all except the last field of a struct have
1040 width zero. These are uncommon and/or illegal situations,
1041 and in any case guessing wrong probably doesn't matter
1044 But if we later do find out we were wrong, we fixup the tag
1045 kind. Members of an enumeration must be handled
1046 differently from struct/union fields, and that is harder to
1047 patch up, but luckily we shouldn't need to. (If there are
1048 any enumeration members, we can tell for sure it's an enum
1051 if (type_code
== TYPE_CODE_UNDEF
)
1053 if (nfields
> 1 && max_value
== 0)
1054 type_code
= TYPE_CODE_UNION
;
1056 type_code
= TYPE_CODE_STRUCT
;
1059 /* Create a new type or use the pending type. */
1060 pend
= is_pending_symbol (cur_fdr
, ext_sh
);
1061 if (pend
== (struct mdebug_pending
*) NULL
)
1063 t
= new_type (NULL
);
1064 add_pending (cur_fdr
, ext_sh
, t
);
1069 /* Do not set the tag name if it is a compiler generated tag name
1070 (.Fxx or .xxfake or empty) for unnamed struct/union/enums.
1071 Alpha cc puts out an sh->iss of zero for those. */
1072 if (sh
->iss
== 0 || name
[0] == '.' || name
[0] == '\0')
1073 TYPE_TAG_NAME (t
) = NULL
;
1075 TYPE_TAG_NAME (t
) = obconcat (¤t_objfile
->symbol_obstack
,
1078 TYPE_CODE (t
) = type_code
;
1079 TYPE_LENGTH (t
) = sh
->value
;
1080 TYPE_NFIELDS (t
) = nfields
;
1081 TYPE_FIELDS (t
) = f
= ((struct field
*)
1083 nfields
* sizeof (struct field
)));
1085 if (type_code
== TYPE_CODE_ENUM
)
1087 int unsigned_enum
= 1;
1089 /* This is a non-empty enum. */
1091 /* DEC c89 has the number of enumerators in the sh.value field,
1092 not the type length, so we have to compensate for that
1093 incompatibility quirk.
1094 This might do the wrong thing for an enum with one or two
1095 enumerators and gcc -gcoff -fshort-enums, but these cases
1096 are hopefully rare enough.
1097 Alpha cc -migrate has a sh.value field of zero, we adjust
1099 if (TYPE_LENGTH (t
) == TYPE_NFIELDS (t
)
1100 || TYPE_LENGTH (t
) == 0)
1101 TYPE_LENGTH (t
) = TARGET_INT_BIT
/ HOST_CHAR_BIT
;
1102 for (ext_tsym
= ext_sh
+ external_sym_size
;
1104 ext_tsym
+= external_sym_size
)
1107 struct symbol
*enum_sym
;
1109 (*swap_sym_in
) (cur_bfd
, ext_tsym
, &tsym
);
1111 if (tsym
.st
!= stMember
)
1114 FIELD_BITPOS (*f
) = tsym
.value
;
1115 FIELD_TYPE (*f
) = t
;
1116 FIELD_NAME (*f
) = debug_info
->ss
+ cur_fdr
->issBase
+ tsym
.iss
;
1117 FIELD_BITSIZE (*f
) = 0;
1119 enum_sym
= ((struct symbol
*)
1120 obstack_alloc (¤t_objfile
->symbol_obstack
,
1121 sizeof (struct symbol
)));
1122 memset ((PTR
) enum_sym
, 0, sizeof (struct symbol
));
1123 SYMBOL_NAME (enum_sym
) =
1124 obsavestring (f
->name
, strlen (f
->name
),
1125 ¤t_objfile
->symbol_obstack
);
1126 SYMBOL_CLASS (enum_sym
) = LOC_CONST
;
1127 SYMBOL_TYPE (enum_sym
) = t
;
1128 SYMBOL_NAMESPACE (enum_sym
) = VAR_NAMESPACE
;
1129 SYMBOL_VALUE (enum_sym
) = tsym
.value
;
1130 if (SYMBOL_VALUE (enum_sym
) < 0)
1132 add_symbol (enum_sym
, top_stack
->cur_block
);
1134 /* Skip the stMembers that we've handled. */
1139 TYPE_FLAGS (t
) |= TYPE_FLAG_UNSIGNED
;
1141 /* make this the current type */
1142 top_stack
->cur_type
= t
;
1143 top_stack
->cur_field
= 0;
1145 /* Do not create a symbol for alpha cc unnamed structs. */
1149 /* gcc puts out an empty struct for an opaque struct definitions,
1150 do not create a symbol for it either. */
1151 if (TYPE_NFIELDS (t
) == 0)
1153 TYPE_FLAGS (t
) |= TYPE_FLAG_STUB
;
1157 s
= new_symbol (name
);
1158 SYMBOL_NAMESPACE (s
) = STRUCT_NAMESPACE
;
1159 SYMBOL_CLASS (s
) = LOC_TYPEDEF
;
1160 SYMBOL_VALUE (s
) = 0;
1161 SYMBOL_TYPE (s
) = t
;
1162 add_symbol (s
, top_stack
->cur_block
);
1165 /* End of local variables shared by struct, union, enum, and
1166 block (as yet unknown struct/union/enum) processing. */
1170 found_ecoff_debugging_info
= 1;
1171 /* beginnning of (code) block. Value of symbol
1172 is the displacement from procedure start */
1173 push_parse_stack ();
1175 /* Do not start a new block if this is the outermost block of a
1176 procedure. This allows the LOC_BLOCK symbol to point to the
1177 block with the local variables, so funcname::var works. */
1178 if (top_stack
->blocktype
== stProc
1179 || top_stack
->blocktype
== stStaticProc
)
1181 top_stack
->blocktype
= stNil
;
1185 top_stack
->blocktype
= stBlock
;
1186 b
= new_block (top_stack
->maxsyms
);
1187 BLOCK_START (b
) = sh
->value
+ top_stack
->procadr
;
1188 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
1189 top_stack
->cur_block
= b
;
1190 add_block (b
, top_stack
->cur_st
);
1193 case stEnd
: /* end (of anything) */
1194 if (sh
->sc
== scInfo
|| SC_IS_COMMON (sh
->sc
))
1196 /* Finished with type */
1197 top_stack
->cur_type
= 0;
1199 else if (sh
->sc
== scText
&&
1200 (top_stack
->blocktype
== stProc
||
1201 top_stack
->blocktype
== stStaticProc
))
1203 /* Finished with procedure */
1204 struct blockvector
*bv
= BLOCKVECTOR (top_stack
->cur_st
);
1205 struct mips_extra_func_info
*e
;
1207 struct type
*ftype
= top_stack
->cur_type
;
1210 BLOCK_END (top_stack
->cur_block
) += sh
->value
; /* size */
1212 /* Make up special symbol to contain procedure specific info */
1213 s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
1214 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
1215 SYMBOL_CLASS (s
) = LOC_CONST
;
1216 SYMBOL_TYPE (s
) = mdebug_type_void
;
1217 e
= ((struct mips_extra_func_info
*)
1218 obstack_alloc (¤t_objfile
->symbol_obstack
,
1219 sizeof (struct mips_extra_func_info
)));
1220 memset ((PTR
) e
, 0, sizeof (struct mips_extra_func_info
));
1221 SYMBOL_VALUE (s
) = (long) e
;
1222 e
->numargs
= top_stack
->numargs
;
1223 e
->pdr
.framereg
= -1;
1224 add_symbol (s
, top_stack
->cur_block
);
1226 /* Reallocate symbols, saving memory */
1227 b
= shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
1229 /* f77 emits proc-level with address bounds==[0,0],
1230 So look for such child blocks, and patch them. */
1231 for (i
= 0; i
< BLOCKVECTOR_NBLOCKS (bv
); i
++)
1233 struct block
*b_bad
= BLOCKVECTOR_BLOCK (bv
, i
);
1234 if (BLOCK_SUPERBLOCK (b_bad
) == b
1235 && BLOCK_START (b_bad
) == top_stack
->procadr
1236 && BLOCK_END (b_bad
) == top_stack
->procadr
)
1238 BLOCK_START (b_bad
) = BLOCK_START (b
);
1239 BLOCK_END (b_bad
) = BLOCK_END (b
);
1243 if (TYPE_NFIELDS (ftype
) <= 0)
1245 /* No parameter type information is recorded with the function's
1246 type. Set that from the type of the parameter symbols. */
1247 int nparams
= top_stack
->numargs
;
1253 TYPE_NFIELDS (ftype
) = nparams
;
1254 TYPE_FIELDS (ftype
) = (struct field
*)
1255 TYPE_ALLOC (ftype
, nparams
* sizeof (struct field
));
1257 for (i
= iparams
= 0; iparams
< nparams
; i
++)
1259 sym
= BLOCK_SYM (b
, i
);
1260 switch (SYMBOL_CLASS (sym
))
1265 case LOC_REGPARM_ADDR
:
1266 TYPE_FIELD_TYPE (ftype
, iparams
) = SYMBOL_TYPE (sym
);
1276 else if (sh
->sc
== scText
&& top_stack
->blocktype
== stBlock
)
1278 /* End of (code) block. The value of the symbol is the
1279 displacement from the procedure`s start address of the
1280 end of this block. */
1281 BLOCK_END (top_stack
->cur_block
) = sh
->value
+ top_stack
->procadr
;
1282 shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
1284 else if (sh
->sc
== scText
&& top_stack
->blocktype
== stNil
)
1286 /* End of outermost block. Pop parse stack and ignore. The
1287 following stEnd of stProc will take care of the block. */
1290 else if (sh
->sc
== scText
&& top_stack
->blocktype
== stFile
)
1292 /* End of file. Pop parse stack and ignore. Higher
1293 level code deals with this. */
1297 complain (&stEnd_complaint
, sh
->sc
);
1299 pop_parse_stack (); /* restore previous lexical context */
1302 case stMember
: /* member of struct or union */
1303 f
= &TYPE_FIELDS (top_stack
->cur_type
)[top_stack
->cur_field
++];
1304 FIELD_NAME (*f
) = name
;
1305 FIELD_BITPOS (*f
) = sh
->value
;
1307 FIELD_TYPE (*f
) = parse_type (cur_fd
, ax
, sh
->index
, &bitsize
, bigend
, name
);
1308 FIELD_BITSIZE (*f
) = bitsize
;
1311 case stIndirect
: /* forward declaration on Irix5 */
1312 /* Forward declarations from Irix5 cc are handled by cross_ref,
1316 case stTypedef
: /* type definition */
1317 found_ecoff_debugging_info
= 1;
1319 /* Typedefs for forward declarations and opaque structs from alpha cc
1320 are handled by cross_ref, skip them. */
1324 /* Parse the type or use the pending type. */
1325 pend
= is_pending_symbol (cur_fdr
, ext_sh
);
1326 if (pend
== (struct mdebug_pending
*) NULL
)
1328 t
= parse_type (cur_fd
, ax
, sh
->index
, (int *) NULL
, bigend
, name
);
1329 add_pending (cur_fdr
, ext_sh
, t
);
1334 /* mips cc puts out a typedef with the name of the struct for forward
1335 declarations. These should not go into the symbol table and
1336 TYPE_NAME should not be set for them.
1337 They can't be distinguished from an intentional typedef to
1338 the same name however:
1340 struct x { int ix; int jx; };
1344 struct xx {int ixx; int jxx; };
1345 generates a cross referencing stTypedef for x and xx.
1346 The user visible effect of this is that the type of a pointer
1347 to struct foo sometimes is given as `foo *' instead of `struct foo *'.
1348 The problem is fixed with alpha cc and Irix5 cc. */
1350 /* However if the typedef cross references to an opaque aggregate, it
1351 is safe to omit it from the symbol table. */
1353 if (has_opaque_xref (cur_fdr
, sh
))
1355 s
= new_symbol (name
);
1356 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
1357 SYMBOL_CLASS (s
) = LOC_TYPEDEF
;
1358 SYMBOL_BLOCK_VALUE (s
) = top_stack
->cur_block
;
1359 SYMBOL_TYPE (s
) = t
;
1360 add_symbol (s
, top_stack
->cur_block
);
1362 /* Incomplete definitions of structs should not get a name. */
1363 if (TYPE_NAME (SYMBOL_TYPE (s
)) == NULL
1364 && (TYPE_NFIELDS (SYMBOL_TYPE (s
)) != 0
1365 || (TYPE_CODE (SYMBOL_TYPE (s
)) != TYPE_CODE_STRUCT
1366 && TYPE_CODE (SYMBOL_TYPE (s
)) != TYPE_CODE_UNION
)))
1368 if (TYPE_CODE (SYMBOL_TYPE (s
)) == TYPE_CODE_PTR
1369 || TYPE_CODE (SYMBOL_TYPE (s
)) == TYPE_CODE_FUNC
)
1371 /* If we are giving a name to a type such as "pointer to
1372 foo" or "function returning foo", we better not set
1373 the TYPE_NAME. If the program contains "typedef char
1374 *caddr_t;", we don't want all variables of type char
1375 * to print as caddr_t. This is not just a
1376 consequence of GDB's type management; CC and GCC (at
1377 least through version 2.4) both output variables of
1378 either type char * or caddr_t with the type
1379 refering to the stTypedef symbol for caddr_t. If a future
1380 compiler cleans this up it GDB is not ready for it
1381 yet, but if it becomes ready we somehow need to
1382 disable this check (without breaking the PCC/GCC2.4
1387 Fortunately, this check seems not to be necessary
1388 for anything except pointers or functions. */
1391 TYPE_NAME (SYMBOL_TYPE (s
)) = SYMBOL_NAME (s
);
1395 case stFile
: /* file name */
1396 push_parse_stack ();
1397 top_stack
->blocktype
= sh
->st
;
1400 /* I`ve never seen these for C */
1402 break; /* register relocation */
1404 break; /* forwarding address */
1406 break; /* constant */
1408 complain (&unknown_mdebug_symtype_complaint
, sh
->st
);
1415 /* Parse the type information provided in the raw AX entries for
1416 the symbol SH. Return the bitfield size in BS, in case.
1417 We must byte-swap the AX entries before we use them; BIGEND says whether
1418 they are big-endian or little-endian (from fh->fBigendian). */
1420 static struct type
*
1421 parse_type (int fd
, union aux_ext
*ax
, unsigned int aux_index
, int *bs
,
1422 int bigend
, char *sym_name
)
1424 /* Null entries in this map are treated specially */
1425 static struct type
**map_bt
[] =
1427 &mdebug_type_void
, /* btNil */
1428 &mdebug_type_adr_32
, /* btAdr */
1429 &mdebug_type_char
, /* btChar */
1430 &mdebug_type_unsigned_char
, /* btUChar */
1431 &mdebug_type_short
, /* btShort */
1432 &mdebug_type_unsigned_short
, /* btUShort */
1433 &mdebug_type_int_32
, /* btInt */
1434 &mdebug_type_unsigned_int_32
, /* btUInt */
1435 &mdebug_type_long_32
, /* btLong */
1436 &mdebug_type_unsigned_long_32
, /* btULong */
1437 &mdebug_type_float
, /* btFloat */
1438 &mdebug_type_double
, /* btDouble */
1445 &mdebug_type_complex
, /* btComplex */
1446 &mdebug_type_double_complex
, /* btDComplex */
1448 &mdebug_type_fixed_dec
, /* btFixedDec */
1449 &mdebug_type_float_dec
, /* btFloatDec */
1450 &mdebug_type_string
, /* btString */
1453 &mdebug_type_void
, /* btVoid */
1454 0, /* DEC C++: Pointer to member */
1455 0, /* DEC C++: Virtual function table */
1456 0, /* DEC C++: Class (Record) */
1457 &mdebug_type_long_64
, /* btLong64 */
1458 &mdebug_type_unsigned_long_64
, /* btULong64 */
1459 &mdebug_type_long_long_64
, /* btLongLong64 */
1460 &mdebug_type_unsigned_long_long_64
, /* btULongLong64 */
1461 &mdebug_type_adr_64
, /* btAdr64 */
1462 &mdebug_type_int_64
, /* btInt64 */
1463 &mdebug_type_unsigned_int_64
, /* btUInt64 */
1467 struct type
*tp
= 0;
1468 enum type_code type_code
= TYPE_CODE_UNDEF
;
1470 /* Handle undefined types, they have indexNil. */
1471 if (aux_index
== indexNil
)
1472 return mdebug_type_int
;
1474 /* Handle corrupt aux indices. */
1475 if (aux_index
>= (debug_info
->fdr
+ fd
)->caux
)
1477 complain (&index_complaint
, sym_name
);
1478 return mdebug_type_int
;
1482 /* Use aux as a type information record, map its basic type. */
1483 (*debug_swap
->swap_tir_in
) (bigend
, &ax
->a_ti
, t
);
1484 if (t
->bt
>= (sizeof (map_bt
) / sizeof (*map_bt
)))
1486 complain (&basic_type_complaint
, t
->bt
, sym_name
);
1487 return mdebug_type_int
;
1491 tp
= *map_bt
[t
->bt
];
1496 /* Cannot use builtin types -- build our own */
1500 type_code
= TYPE_CODE_STRUCT
;
1503 type_code
= TYPE_CODE_UNION
;
1506 type_code
= TYPE_CODE_ENUM
;
1509 type_code
= TYPE_CODE_RANGE
;
1512 type_code
= TYPE_CODE_SET
;
1515 /* alpha cc -migrate uses this for typedefs. The true type will
1516 be obtained by crossreferencing below. */
1517 type_code
= TYPE_CODE_ERROR
;
1520 /* alpha cc uses this for typedefs. The true type will be
1521 obtained by crossreferencing below. */
1522 type_code
= TYPE_CODE_ERROR
;
1525 complain (&basic_type_complaint
, t
->bt
, sym_name
);
1526 return mdebug_type_int
;
1530 /* Move on to next aux */
1535 int width
= AUX_GET_WIDTH (bigend
, ax
);
1537 /* Inhibit core dumps with some cfront generated objects that
1539 if (bs
== (int *) NULL
)
1541 /* Alpha cc -migrate encodes char and unsigned char types
1542 as short and unsigned short types with a field width of 8.
1543 Enum types also have a field width which we ignore for now. */
1544 if (t
->bt
== btShort
&& width
== 8)
1545 tp
= mdebug_type_char
;
1546 else if (t
->bt
== btUShort
&& width
== 8)
1547 tp
= mdebug_type_unsigned_char
;
1548 else if (t
->bt
== btEnum
)
1551 complain (&bad_fbitfield_complaint
, sym_name
);
1558 /* A btIndirect entry cross references to an aux entry containing
1560 if (t
->bt
== btIndirect
)
1567 (*debug_swap
->swap_rndx_in
) (bigend
, &ax
->a_rndx
, rn
);
1569 if (rn
->rfd
== 0xfff)
1571 rf
= AUX_GET_ISYM (bigend
, ax
);
1579 complain (&bad_indirect_xref_complaint
, sym_name
);
1580 return mdebug_type_int
;
1582 xref_fh
= get_rfd (fd
, rf
);
1583 xref_fd
= xref_fh
- debug_info
->fdr
;
1584 tp
= parse_type (xref_fd
, debug_info
->external_aux
+ xref_fh
->iauxBase
,
1585 rn
->index
, (int *) NULL
, xref_fh
->fBigendian
, sym_name
);
1588 /* All these types really point to some (common) MIPS type
1589 definition, and only the type-qualifiers fully identify
1590 them. We'll make the same effort at sharing. */
1591 if (t
->bt
== btStruct
||
1595 /* btSet (I think) implies that the name is a tag name, not a typedef
1596 name. This apparently is a MIPS extension for C sets. */
1601 /* Try to cross reference this type, build new type on failure. */
1602 ax
+= cross_ref (fd
, ax
, &tp
, type_code
, &name
, bigend
, sym_name
);
1603 if (tp
== (struct type
*) NULL
)
1604 tp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
1606 /* DEC c89 produces cross references to qualified aggregate types,
1607 dereference them. */
1608 while (TYPE_CODE (tp
) == TYPE_CODE_PTR
1609 || TYPE_CODE (tp
) == TYPE_CODE_ARRAY
)
1610 tp
= tp
->target_type
;
1612 /* Make sure that TYPE_CODE(tp) has an expected type code.
1613 Any type may be returned from cross_ref if file indirect entries
1615 if (TYPE_CODE (tp
) != TYPE_CODE_STRUCT
1616 && TYPE_CODE (tp
) != TYPE_CODE_UNION
1617 && TYPE_CODE (tp
) != TYPE_CODE_ENUM
)
1619 complain (&unexpected_type_code_complaint
, sym_name
);
1624 /* Usually, TYPE_CODE(tp) is already type_code. The main
1625 exception is if we guessed wrong re struct/union/enum.
1626 But for struct vs. union a wrong guess is harmless, so
1627 don't complain(). */
1628 if ((TYPE_CODE (tp
) == TYPE_CODE_ENUM
1629 && type_code
!= TYPE_CODE_ENUM
)
1630 || (TYPE_CODE (tp
) != TYPE_CODE_ENUM
1631 && type_code
== TYPE_CODE_ENUM
))
1633 complain (&bad_tag_guess_complaint
, sym_name
);
1636 if (TYPE_CODE (tp
) != type_code
)
1638 TYPE_CODE (tp
) = type_code
;
1641 /* Do not set the tag name if it is a compiler generated tag name
1642 (.Fxx or .xxfake or empty) for unnamed struct/union/enums. */
1643 if (name
[0] == '.' || name
[0] == '\0')
1644 TYPE_TAG_NAME (tp
) = NULL
;
1645 else if (TYPE_TAG_NAME (tp
) == NULL
1646 || !STREQ (TYPE_TAG_NAME (tp
), name
))
1647 TYPE_TAG_NAME (tp
) = obsavestring (name
, strlen (name
),
1648 ¤t_objfile
->type_obstack
);
1652 /* All these types really point to some (common) MIPS type
1653 definition, and only the type-qualifiers fully identify
1654 them. We'll make the same effort at sharing.
1655 FIXME: We are not doing any guessing on range types. */
1656 if (t
->bt
== btRange
)
1660 /* Try to cross reference this type, build new type on failure. */
1661 ax
+= cross_ref (fd
, ax
, &tp
, type_code
, &name
, bigend
, sym_name
);
1662 if (tp
== (struct type
*) NULL
)
1663 tp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
1665 /* Make sure that TYPE_CODE(tp) has an expected type code.
1666 Any type may be returned from cross_ref if file indirect entries
1668 if (TYPE_CODE (tp
) != TYPE_CODE_RANGE
)
1670 complain (&unexpected_type_code_complaint
, sym_name
);
1674 /* Usually, TYPE_CODE(tp) is already type_code. The main
1675 exception is if we guessed wrong re struct/union/enum. */
1676 if (TYPE_CODE (tp
) != type_code
)
1678 complain (&bad_tag_guess_complaint
, sym_name
);
1679 TYPE_CODE (tp
) = type_code
;
1681 if (TYPE_NAME (tp
) == NULL
|| !STREQ (TYPE_NAME (tp
), name
))
1682 TYPE_NAME (tp
) = obsavestring (name
, strlen (name
),
1683 ¤t_objfile
->type_obstack
);
1686 if (t
->bt
== btTypedef
)
1690 /* Try to cross reference this type, it should succeed. */
1691 ax
+= cross_ref (fd
, ax
, &tp
, type_code
, &name
, bigend
, sym_name
);
1692 if (tp
== (struct type
*) NULL
)
1694 complain (&unable_to_cross_ref_complaint
, sym_name
);
1695 tp
= mdebug_type_int
;
1699 /* Deal with range types */
1700 if (t
->bt
== btRange
)
1702 TYPE_NFIELDS (tp
) = 2;
1703 TYPE_FIELDS (tp
) = ((struct field
*)
1704 TYPE_ALLOC (tp
, 2 * sizeof (struct field
)));
1705 TYPE_FIELD_NAME (tp
, 0) = obsavestring ("Low", strlen ("Low"),
1706 ¤t_objfile
->type_obstack
);
1707 TYPE_FIELD_BITPOS (tp
, 0) = AUX_GET_DNLOW (bigend
, ax
);
1709 TYPE_FIELD_NAME (tp
, 1) = obsavestring ("High", strlen ("High"),
1710 ¤t_objfile
->type_obstack
);
1711 TYPE_FIELD_BITPOS (tp
, 1) = AUX_GET_DNHIGH (bigend
, ax
);
1715 /* Parse all the type qualifiers now. If there are more
1716 than 6 the game will continue in the next aux */
1720 #define PARSE_TQ(tq) \
1721 if (t->tq != tqNil) \
1722 ax += upgrade_type(fd, &tp, t->tq, ax, bigend, sym_name); \
1734 /* mips cc 2.x and gcc never put out continued aux entries. */
1738 (*debug_swap
->swap_tir_in
) (bigend
, &ax
->a_ti
, t
);
1742 /* Complain for illegal continuations due to corrupt aux entries. */
1744 complain (&bad_continued_complaint
, sym_name
);
1749 /* Make up a complex type from a basic one. Type is passed by
1750 reference in TPP and side-effected as necessary. The type
1751 qualifier TQ says how to handle the aux symbols at AX for
1752 the symbol SX we are currently analyzing. BIGEND says whether
1753 aux symbols are big-endian or little-endian.
1754 Returns the number of aux symbols we parsed. */
1757 upgrade_type (int fd
, struct type
**tpp
, int tq
, union aux_ext
*ax
, int bigend
,
1763 /* Used in array processing */
1774 t
= lookup_pointer_type (*tpp
);
1779 t
= lookup_function_type (*tpp
);
1786 /* Determine and record the domain type (type of index) */
1787 (*debug_swap
->swap_rndx_in
) (bigend
, &ax
->a_rndx
, &rndx
);
1793 rf
= AUX_GET_ISYM (bigend
, ax
);
1796 fh
= get_rfd (fd
, rf
);
1798 indx
= parse_type (fh
- debug_info
->fdr
,
1799 debug_info
->external_aux
+ fh
->iauxBase
,
1800 id
, (int *) NULL
, bigend
, sym_name
);
1802 /* The bounds type should be an integer type, but might be anything
1803 else due to corrupt aux entries. */
1804 if (TYPE_CODE (indx
) != TYPE_CODE_INT
)
1806 complain (&array_index_type_complaint
, sym_name
);
1807 indx
= mdebug_type_int
;
1810 /* Get the bounds, and create the array type. */
1812 lower
= AUX_GET_DNLOW (bigend
, ax
);
1814 upper
= AUX_GET_DNHIGH (bigend
, ax
);
1816 rf
= AUX_GET_WIDTH (bigend
, ax
); /* bit size of array element */
1818 range
= create_range_type ((struct type
*) NULL
, indx
,
1821 t
= create_array_type ((struct type
*) NULL
, *tpp
, range
);
1823 /* We used to fill in the supplied array element bitsize
1824 here if the TYPE_LENGTH of the target type was zero.
1825 This happens for a `pointer to an array of anonymous structs',
1826 but in this case the array element bitsize is also zero,
1827 so nothing is gained.
1828 And we used to check the TYPE_LENGTH of the target type against
1829 the supplied array element bitsize.
1830 gcc causes a mismatch for `pointer to array of object',
1831 since the sdb directives it uses do not have a way of
1832 specifying the bitsize, but it does no harm (the
1833 TYPE_LENGTH should be correct) and we should be able to
1834 ignore the erroneous bitsize from the auxiliary entry safely.
1835 dbx seems to ignore it too. */
1837 /* TYPE_FLAG_TARGET_STUB now takes care of the zero TYPE_LENGTH
1839 if (TYPE_LENGTH (*tpp
) == 0)
1841 TYPE_FLAGS (t
) |= TYPE_FLAG_TARGET_STUB
;
1848 /* Volatile -- currently ignored */
1852 /* Const -- currently ignored */
1856 complain (&unknown_type_qual_complaint
, tq
);
1862 /* Parse a procedure descriptor record PR. Note that the procedure is
1863 parsed _after_ the local symbols, now we just insert the extra
1864 information we need into a MIPS_EFI_SYMBOL_NAME symbol that has
1865 already been placed in the procedure's main block. Note also that
1866 images that have been partially stripped (ld -x) have been deprived
1867 of local symbols, and we have to cope with them here. FIRST_OFF is
1868 the offset of the first procedure for this FDR; we adjust the
1869 address by this amount, but I don't know why. SEARCH_SYMTAB is the symtab
1870 to look for the function which contains the MIPS_EFI_SYMBOL_NAME symbol
1871 in question, or NULL to use top_stack->cur_block. */
1873 static void parse_procedure (PDR
*, struct symtab
*, struct partial_symtab
*);
1876 parse_procedure (PDR
*pr
, struct symtab
*search_symtab
,
1877 struct partial_symtab
*pst
)
1879 struct symbol
*s
, *i
;
1881 struct mips_extra_func_info
*e
;
1884 /* Simple rule to find files linked "-x" */
1885 if (cur_fdr
->rss
== -1)
1889 /* Static procedure at address pr->adr. Sigh. */
1890 /* FIXME-32x64. assuming pr->adr fits in long. */
1891 complain (&pdr_static_symbol_complaint
, (unsigned long) pr
->adr
);
1899 (*debug_swap
->swap_ext_in
) (cur_bfd
,
1900 ((char *) debug_info
->external_ext
1902 * debug_swap
->external_ext_size
)),
1904 sh_name
= debug_info
->ssext
+ she
.asym
.iss
;
1912 (*debug_swap
->swap_sym_in
) (cur_bfd
,
1913 ((char *) debug_info
->external_sym
1914 + ((cur_fdr
->isymBase
+ pr
->isym
)
1915 * debug_swap
->external_sym_size
)),
1917 sh_name
= debug_info
->ss
+ cur_fdr
->issBase
+ sh
.iss
;
1920 if (search_symtab
!= NULL
)
1923 /* This loses both in the case mentioned (want a static, find a global),
1924 but also if we are looking up a non-mangled name which happens to
1925 match the name of a mangled function. */
1926 /* We have to save the cur_fdr across the call to lookup_symbol.
1927 If the pdr is for a static function and if a global function with
1928 the same name exists, lookup_symbol will eventually read in the symtab
1929 for the global function and clobber cur_fdr. */
1930 FDR
*save_cur_fdr
= cur_fdr
;
1931 s
= lookup_symbol (sh_name
, NULL
, VAR_NAMESPACE
, 0, NULL
);
1932 cur_fdr
= save_cur_fdr
;
1936 BLOCKVECTOR_BLOCK (BLOCKVECTOR (search_symtab
), STATIC_BLOCK
),
1942 s
= mylookup_symbol (sh_name
, top_stack
->cur_block
,
1943 VAR_NAMESPACE
, LOC_BLOCK
);
1947 b
= SYMBOL_BLOCK_VALUE (s
);
1951 complain (&pdr_for_nonsymbol_complaint
, sh_name
);
1955 /* FIXME -- delete. We can't do symbol allocation now; it's all done. */
1956 s
= new_symbol (sh_name
);
1957 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
1958 SYMBOL_CLASS (s
) = LOC_BLOCK
;
1959 /* Donno its type, hope int is ok */
1960 SYMBOL_TYPE (s
) = lookup_function_type (mdebug_type_int
);
1961 add_symbol (s
, top_stack
->cur_block
);
1962 /* Wont have symbols for this one */
1964 SYMBOL_BLOCK_VALUE (s
) = b
;
1965 BLOCK_FUNCTION (b
) = s
;
1966 BLOCK_START (b
) = pr
->adr
;
1967 /* BOUND used to be the end of procedure's text, but the
1968 argument is no longer passed in. */
1969 BLOCK_END (b
) = bound
;
1970 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
1971 add_block (b
, top_stack
->cur_st
);
1975 i
= mylookup_symbol (MIPS_EFI_SYMBOL_NAME
, b
, LABEL_NAMESPACE
, LOC_CONST
);
1979 e
= (struct mips_extra_func_info
*) SYMBOL_VALUE (i
);
1981 e
->pdr
.isym
= (long) s
;
1983 /* GDB expects the absolute function start address for the
1984 procedure descriptor in e->pdr.adr.
1985 As the address in the procedure descriptor is usually relative,
1986 we would have to relocate e->pdr.adr with cur_fdr->adr and
1987 ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (pst->objfile)).
1988 Unfortunately cur_fdr->adr and e->pdr.adr are both absolute
1989 in shared libraries on some systems, and on other systems
1990 e->pdr.adr is sometimes offset by a bogus value.
1991 To work around these problems, we replace e->pdr.adr with
1992 the start address of the function. */
1993 e
->pdr
.adr
= BLOCK_START (b
);
1995 /* Correct incorrect setjmp procedure descriptor from the library
1996 to make backtrace through setjmp work. */
1997 if (e
->pdr
.pcreg
== 0 && STREQ (sh_name
, "setjmp"))
1999 complain (&bad_setjmp_pdr_complaint
, 0);
2000 e
->pdr
.pcreg
= RA_REGNUM
;
2001 e
->pdr
.regmask
= 0x80000000;
2002 e
->pdr
.regoffset
= -4;
2006 /* It would be reasonable that functions that have been compiled
2007 without debugging info have a btNil type for their return value,
2008 and functions that are void and are compiled with debugging info
2010 gcc and DEC f77 put out btNil types for both cases, so btNil is mapped
2011 to TYPE_CODE_VOID in parse_type to get the `compiled with debugging info'
2013 The glevel field in cur_fdr could be used to determine the presence
2014 of debugging info, but GCC doesn't always pass the -g switch settings
2015 to the assembler and GAS doesn't set the glevel field from the -g switch
2017 To work around these problems, the return value type of a TYPE_CODE_VOID
2018 function is adjusted accordingly if no debugging info was found in the
2019 compilation unit. */
2021 if (processing_gcc_compilation
== 0
2022 && found_ecoff_debugging_info
== 0
2023 && TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (s
))) == TYPE_CODE_VOID
)
2024 SYMBOL_TYPE (s
) = nodebug_func_symbol_type
;
2027 /* Relocate the extra function info pointed to by the symbol table. */
2030 ecoff_relocate_efi (struct symbol
*sym
, CORE_ADDR delta
)
2032 struct mips_extra_func_info
*e
;
2034 e
= (struct mips_extra_func_info
*) SYMBOL_VALUE (sym
);
2036 e
->pdr
.adr
+= delta
;
2039 /* Parse the external symbol ES. Just call parse_symbol() after
2040 making sure we know where the aux are for it.
2041 BIGEND says whether aux entries are big-endian or little-endian.
2043 This routine clobbers top_stack->cur_block and ->cur_st. */
2045 static void parse_external (EXTR
*, int, struct section_offsets
*,
2049 parse_external (EXTR
*es
, int bigend
, struct section_offsets
*section_offsets
,
2050 struct objfile
*objfile
)
2054 if (es
->ifd
!= ifdNil
)
2057 cur_fdr
= debug_info
->fdr
+ cur_fd
;
2058 ax
= debug_info
->external_aux
+ cur_fdr
->iauxBase
;
2062 cur_fdr
= debug_info
->fdr
;
2066 /* Reading .o files */
2067 if (SC_IS_UNDEF (es
->asym
.sc
) || es
->asym
.sc
== scNil
)
2070 switch (es
->asym
.st
)
2073 /* These are generated for static symbols in .o files,
2094 /* FIXME: Turn this into a complaint? */
2096 printf_filtered ("Warning: %s `%s' is undefined (in %s)\n",
2097 what
, debug_info
->ssext
+ es
->asym
.iss
,
2098 fdr_name (cur_fdr
));
2102 switch (es
->asym
.st
)
2106 /* There is no need to parse the external procedure symbols.
2107 If they are from objects compiled without -g, their index will
2108 be indexNil, and the symbol definition from the minimal symbol
2109 is preferrable (yielding a function returning int instead of int).
2110 If the index points to a local procedure symbol, the local
2111 symbol already provides the correct type.
2112 Note that the index of the external procedure symbol points
2113 to the local procedure symbol in the local symbol table, and
2114 _not_ to the auxiliary symbol info. */
2118 /* Global common symbols are resolved by the runtime loader,
2120 if (SC_IS_COMMON (es
->asym
.sc
))
2123 /* Note that the case of a symbol with indexNil must be handled
2124 anyways by parse_symbol(). */
2125 parse_symbol (&es
->asym
, ax
, (char *) NULL
, bigend
, section_offsets
, objfile
);
2132 /* Parse the line number info for file descriptor FH into
2133 GDB's linetable LT. MIPS' encoding requires a little bit
2134 of magic to get things out. Note also that MIPS' line
2135 numbers can go back and forth, apparently we can live
2136 with that and do not need to reorder our linetables */
2138 static void parse_lines (FDR
*, PDR
*, struct linetable
*, int,
2139 struct partial_symtab
*, CORE_ADDR
);
2142 parse_lines (FDR
*fh
, PDR
*pr
, struct linetable
*lt
, int maxlines
,
2143 struct partial_symtab
*pst
, CORE_ADDR lowest_pdr_addr
)
2145 unsigned char *base
;
2147 int delta
, count
, lineno
= 0;
2149 if (fh
->cbLine
== 0)
2152 /* Scan by procedure descriptors */
2154 for (j
= 0; j
< fh
->cpd
; j
++, pr
++)
2158 unsigned char *halt
;
2160 /* No code for this one */
2161 if (pr
->iline
== ilineNil
||
2162 pr
->lnLow
== -1 || pr
->lnHigh
== -1)
2165 /* Determine start and end address of compressed line bytes for
2167 base
= debug_info
->line
+ fh
->cbLineOffset
;
2168 if (j
!= (fh
->cpd
- 1))
2169 halt
= base
+ pr
[1].cbLineOffset
;
2171 halt
= base
+ fh
->cbLine
;
2172 base
+= pr
->cbLineOffset
;
2174 adr
= pst
->textlow
+ pr
->adr
- lowest_pdr_addr
;
2176 l
= adr
>> 2; /* in words */
2177 for (lineno
= pr
->lnLow
; base
< halt
;)
2179 count
= *base
& 0x0f;
2180 delta
= *base
++ >> 4;
2185 delta
= (base
[0] << 8) | base
[1];
2186 if (delta
>= 0x8000)
2190 lineno
+= delta
; /* first delta is 0 */
2192 /* Complain if the line table overflows. Could happen
2193 with corrupt binaries. */
2194 if (lt
->nitems
>= maxlines
)
2196 complain (&bad_linetable_guess_complaint
, fdr_name (fh
));
2199 k
= add_line (lt
, lineno
, l
, k
);
2205 /* Master parsing procedure for first-pass reading of file symbols
2206 into a partial_symtab. */
2209 parse_partial_symbols (struct objfile
*objfile
)
2211 const bfd_size_type external_sym_size
= debug_swap
->external_sym_size
;
2212 const bfd_size_type external_rfd_size
= debug_swap
->external_rfd_size
;
2213 const bfd_size_type external_ext_size
= debug_swap
->external_ext_size
;
2214 void (*const swap_ext_in
) (bfd
*, PTR
, EXTR
*) = debug_swap
->swap_ext_in
;
2215 void (*const swap_sym_in
) (bfd
*, PTR
, SYMR
*) = debug_swap
->swap_sym_in
;
2216 void (*const swap_rfd_in
) (bfd
*, PTR
, RFDT
*) = debug_swap
->swap_rfd_in
;
2218 HDRR
*hdr
= &debug_info
->symbolic_header
;
2219 /* Running pointers */
2224 register EXTR
*ext_in
;
2227 struct partial_symtab
*pst
;
2228 int textlow_not_set
= 1;
2229 int past_first_source_file
= 0;
2231 /* List of current psymtab's include files */
2232 char **psymtab_include_list
;
2233 int includes_allocated
;
2236 struct pst_map
*fdr_to_pst
;
2237 /* Index within current psymtab dependency list */
2238 struct partial_symtab
**dependency_list
;
2239 int dependencies_used
, dependencies_allocated
;
2240 struct cleanup
*old_chain
;
2242 enum language prev_language
;
2243 asection
*text_sect
;
2244 int relocatable
= 0;
2246 /* Irix 5.2 shared libraries have a fh->adr field of zero, but
2247 the shared libraries are prelinked at a high memory address.
2248 We have to adjust the start address of the object file for this case,
2249 by setting it to the start address of the first procedure in the file.
2250 But we should do no adjustments if we are debugging a .o file, where
2251 the text section (and fh->adr) really starts at zero. */
2252 text_sect
= bfd_get_section_by_name (cur_bfd
, ".text");
2253 if (text_sect
!= NULL
2254 && (bfd_get_section_flags (cur_bfd
, text_sect
) & SEC_RELOC
))
2257 extern_tab
= (EXTR
*) obstack_alloc (&objfile
->psymbol_obstack
,
2258 sizeof (EXTR
) * hdr
->iextMax
);
2260 includes_allocated
= 30;
2262 psymtab_include_list
= (char **) alloca (includes_allocated
*
2264 next_symbol_text_func
= mdebug_next_symbol_text
;
2266 dependencies_allocated
= 30;
2267 dependencies_used
= 0;
2269 (struct partial_symtab
**) alloca (dependencies_allocated
*
2270 sizeof (struct partial_symtab
*));
2272 last_source_file
= NULL
;
2277 * Only parse the Local and External symbols, and the Relative FDR.
2278 * Fixup enough of the loader symtab to be able to use it.
2279 * Allocate space only for the file's portions we need to
2284 max_glevel
= MIN_GLEVEL
;
2286 /* Allocate the map FDR -> PST.
2287 Minor hack: -O3 images might claim some global data belongs
2288 to FDR -1. We`ll go along with that */
2289 fdr_to_pst
= (struct pst_map
*) xzalloc ((hdr
->ifdMax
+ 1) * sizeof *fdr_to_pst
);
2290 old_chain
= make_cleanup (xfree
, fdr_to_pst
);
2293 struct partial_symtab
*pst
= new_psymtab ("", objfile
);
2294 fdr_to_pst
[-1].pst
= pst
;
2298 /* Allocate the global pending list. */
2300 ((struct mdebug_pending
**)
2301 obstack_alloc (&objfile
->psymbol_obstack
,
2302 hdr
->ifdMax
* sizeof (struct mdebug_pending
*)));
2303 memset ((PTR
) pending_list
, 0,
2304 hdr
->ifdMax
* sizeof (struct mdebug_pending
*));
2306 /* Pass 0 over external syms: swap them in. */
2307 ext_block
= (EXTR
*) xmalloc (hdr
->iextMax
* sizeof (EXTR
));
2308 make_cleanup (xfree
, ext_block
);
2310 ext_out
= (char *) debug_info
->external_ext
;
2311 ext_out_end
= ext_out
+ hdr
->iextMax
* external_ext_size
;
2313 for (; ext_out
< ext_out_end
; ext_out
+= external_ext_size
, ext_in
++)
2314 (*swap_ext_in
) (cur_bfd
, ext_out
, ext_in
);
2316 /* Pass 1 over external syms: Presize and partition the list */
2318 ext_in_end
= ext_in
+ hdr
->iextMax
;
2319 for (; ext_in
< ext_in_end
; ext_in
++)
2321 /* See calls to complain below. */
2322 if (ext_in
->ifd
>= -1
2323 && ext_in
->ifd
< hdr
->ifdMax
2324 && ext_in
->asym
.iss
>= 0
2325 && ext_in
->asym
.iss
< hdr
->issExtMax
)
2326 fdr_to_pst
[ext_in
->ifd
].n_globals
++;
2329 /* Pass 1.5 over files: partition out global symbol space */
2331 for (f_idx
= -1; f_idx
< hdr
->ifdMax
; f_idx
++)
2333 fdr_to_pst
[f_idx
].globals_offset
= s_idx
;
2334 s_idx
+= fdr_to_pst
[f_idx
].n_globals
;
2335 fdr_to_pst
[f_idx
].n_globals
= 0;
2340 For ECOFF in ELF, we skip the creation of the minimal symbols.
2341 The ECOFF symbols should be a subset of the Elf symbols, and the
2342 section information of the elf symbols will be more accurate.
2343 FIXME! What about Irix 5's native linker?
2345 By default, Elf sections which don't exist in ECOFF
2346 get put in ECOFF's absolute section by the gnu linker.
2347 Since absolute sections don't get relocated, we
2348 end up calculating an address different from that of
2349 the symbol's minimal symbol (created earlier from the
2352 To fix this, either :
2353 1) don't create the duplicate symbol
2354 (assumes ECOFF symtab is a subset of the ELF symtab;
2355 assumes no side-effects result from ignoring ECOFF symbol)
2356 2) create it, only if lookup for existing symbol in ELF's minimal
2359 assumes no side-effects result from ignoring ECOFF symbol)
2360 3) create it, but lookup ELF's minimal symbol and use it's section
2361 during relocation, then modify "uniqify" phase to merge and
2362 eliminate the duplicate symbol
2363 (highly inefficient)
2365 I've implemented #1 here...
2366 Skip the creation of the minimal symbols based on the ECOFF
2369 /* Pass 2 over external syms: fill in external symbols */
2371 ext_in_end
= ext_in
+ hdr
->iextMax
;
2372 for (; ext_in
< ext_in_end
; ext_in
++)
2374 enum minimal_symbol_type ms_type
= mst_text
;
2375 CORE_ADDR svalue
= ext_in
->asym
.value
;
2377 /* The Irix 5 native tools seem to sometimes generate bogus
2378 external symbols. */
2379 if (ext_in
->ifd
< -1 || ext_in
->ifd
>= hdr
->ifdMax
)
2381 complain (&bad_ext_ifd_complaint
, ext_in
->ifd
, hdr
->ifdMax
);
2384 if (ext_in
->asym
.iss
< 0 || ext_in
->asym
.iss
>= hdr
->issExtMax
)
2386 complain (&bad_ext_iss_complaint
, ext_in
->asym
.iss
,
2391 extern_tab
[fdr_to_pst
[ext_in
->ifd
].globals_offset
2392 + fdr_to_pst
[ext_in
->ifd
].n_globals
++] = *ext_in
;
2395 if (SC_IS_UNDEF (ext_in
->asym
.sc
) || ext_in
->asym
.sc
== scNil
)
2399 /* Pass 3 over files, over local syms: fill in static symbols */
2400 name
= debug_info
->ssext
+ ext_in
->asym
.iss
;
2402 /* Process ECOFF Symbol Types and Storage Classes */
2403 switch (ext_in
->asym
.st
)
2406 /* Beginnning of Procedure */
2407 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2410 /* Load time only static procs */
2411 ms_type
= mst_file_text
;
2412 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2415 /* External symbol */
2416 if (SC_IS_COMMON (ext_in
->asym
.sc
))
2418 /* The value of a common symbol is its size, not its address.
2422 else if (SC_IS_DATA (ext_in
->asym
.sc
))
2425 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
2427 else if (SC_IS_BSS (ext_in
->asym
.sc
))
2430 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
2437 if (SC_IS_TEXT (ext_in
->asym
.sc
))
2439 ms_type
= mst_file_text
;
2440 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2442 else if (SC_IS_DATA (ext_in
->asym
.sc
))
2444 ms_type
= mst_file_data
;
2445 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
2447 else if (SC_IS_BSS (ext_in
->asym
.sc
))
2449 ms_type
= mst_file_bss
;
2450 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
2457 /* The alpha has the section start addresses in stLocal symbols
2458 whose name starts with a `.'. Skip those but complain for all
2459 other stLocal symbols.
2460 Irix6 puts the section start addresses in stNil symbols, skip
2466 ms_type
= mst_unknown
;
2467 complain (&unknown_ext_complaint
, name
);
2469 if (!ECOFF_IN_ELF (cur_bfd
))
2470 prim_record_minimal_symbol (name
, svalue
, ms_type
, objfile
);
2473 /* Pass 3 over files, over local syms: fill in static symbols */
2474 for (f_idx
= 0; f_idx
< hdr
->ifdMax
; f_idx
++)
2476 struct partial_symtab
*save_pst
;
2480 cur_fdr
= fh
= debug_info
->fdr
+ f_idx
;
2484 fdr_to_pst
[f_idx
].pst
= NULL
;
2488 /* Determine the start address for this object file from the
2489 file header and relocate it, except for Irix 5.2 zero fh->adr. */
2493 if (relocatable
|| textlow
!= 0)
2494 textlow
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2498 pst
= start_psymtab_common (objfile
, objfile
->section_offsets
,
2501 objfile
->global_psymbols
.next
,
2502 objfile
->static_psymbols
.next
);
2503 pst
->read_symtab_private
= ((char *)
2504 obstack_alloc (&objfile
->psymbol_obstack
,
2505 sizeof (struct symloc
)));
2506 memset ((PTR
) pst
->read_symtab_private
, 0, sizeof (struct symloc
));
2509 FDR_IDX (pst
) = f_idx
;
2510 CUR_BFD (pst
) = cur_bfd
;
2511 DEBUG_SWAP (pst
) = debug_swap
;
2512 DEBUG_INFO (pst
) = debug_info
;
2513 PENDING_LIST (pst
) = pending_list
;
2515 /* The way to turn this into a symtab is to call... */
2516 pst
->read_symtab
= mdebug_psymtab_to_symtab
;
2518 /* Set up language for the pst.
2519 The language from the FDR is used if it is unambigious (e.g. cfront
2520 with native cc and g++ will set the language to C).
2521 Otherwise we have to deduce the language from the filename.
2522 Native ecoff has every header file in a separate FDR, so
2523 deduce_language_from_filename will return language_unknown for
2524 a header file, which is not what we want.
2525 But the FDRs for the header files are after the FDR for the source
2526 file, so we can assign the language of the source file to the
2527 following header files. Then we save the language in the private
2528 pst data so that we can reuse it when building symtabs. */
2529 prev_language
= psymtab_language
;
2533 case langCplusplusV2
:
2534 psymtab_language
= language_cplus
;
2537 psymtab_language
= deduce_language_from_filename (fdr_name (fh
));
2540 if (psymtab_language
== language_unknown
)
2541 psymtab_language
= prev_language
;
2542 PST_PRIVATE (pst
)->pst_language
= psymtab_language
;
2544 pst
->texthigh
= pst
->textlow
;
2546 /* For stabs-in-ecoff files, the second symbol must be @stab.
2547 This symbol is emitted by mips-tfile to signal that the
2548 current object file uses encapsulated stabs instead of mips
2549 ecoff for local symbols. (It is the second symbol because
2550 the first symbol is the stFile used to signal the start of a
2552 processing_gcc_compilation
= 0;
2555 (*swap_sym_in
) (cur_bfd
,
2556 ((char *) debug_info
->external_sym
2557 + (fh
->isymBase
+ 1) * external_sym_size
),
2559 if (STREQ (debug_info
->ss
+ fh
->issBase
+ sh
.iss
, stabs_symbol
))
2560 processing_gcc_compilation
= 2;
2563 if (processing_gcc_compilation
!= 0)
2565 for (cur_sdx
= 2; cur_sdx
< fh
->csym
; cur_sdx
++)
2570 (*swap_sym_in
) (cur_bfd
,
2571 (((char *) debug_info
->external_sym
)
2572 + (fh
->isymBase
+ cur_sdx
) * external_sym_size
),
2574 type_code
= ECOFF_UNMARK_STAB (sh
.index
);
2575 if (!ECOFF_IS_STAB (&sh
))
2577 if (sh
.st
== stProc
|| sh
.st
== stStaticProc
)
2582 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2583 if (sh
.st
== stStaticProc
)
2585 namestring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2586 prim_record_minimal_symbol_and_info (namestring
,
2590 SECT_OFF_TEXT (objfile
),
2594 procaddr
= sh
.value
;
2596 isym
= AUX_GET_ISYM (fh
->fBigendian
,
2597 (debug_info
->external_aux
2600 (*swap_sym_in
) (cur_bfd
,
2601 ((char *) debug_info
->external_sym
2602 + ((fh
->isymBase
+ isym
- 1)
2603 * external_sym_size
)),
2607 CORE_ADDR high
= procaddr
+ sh
.value
;
2609 /* Kludge for Irix 5.2 zero fh->adr. */
2611 && (pst
->textlow
== 0 || procaddr
< pst
->textlow
))
2612 pst
->textlow
= procaddr
;
2613 if (high
> pst
->texthigh
)
2614 pst
->texthigh
= high
;
2617 else if (sh
.st
== stStatic
)
2632 namestring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2633 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
2634 prim_record_minimal_symbol_and_info (namestring
,
2638 SECT_OFF_DATA (objfile
),
2644 /* FIXME! Shouldn't this use cases for bss,
2645 then have the default be abs? */
2646 namestring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2647 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
2648 prim_record_minimal_symbol_and_info (namestring
,
2652 SECT_OFF_BSS (objfile
),
2660 /* Handle stabs continuation */
2662 char *stabstring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2663 int len
= strlen (stabstring
);
2664 while (stabstring
[len
- 1] == '\\')
2667 char *stabstring1
= stabstring
;
2671 /* Ignore continuation char from 1st string */
2674 /* Read next stabstring */
2676 (*swap_sym_in
) (cur_bfd
,
2677 (((char *) debug_info
->external_sym
)
2678 + (fh
->isymBase
+ cur_sdx
)
2679 * external_sym_size
),
2681 stabstring2
= debug_info
->ss
+ fh
->issBase
+ sh2
.iss
;
2682 len2
= strlen (stabstring2
);
2684 /* Concatinate stabstring2 with stabstring1 */
2686 && stabstring
!= debug_info
->ss
+ fh
->issBase
+ sh
.iss
)
2687 stabstring
= xrealloc (stabstring
, len
+ len2
+ 1);
2689 stabstring
= xmalloc (len
+ len2
+ 1);
2690 strcpy (stabstring
, stabstring1
);
2691 strcpy (stabstring
+ len
, stabstring2
);
2695 #define SET_NAMESTRING() \
2696 namestring = stabstring
2697 #define CUR_SYMBOL_TYPE type_code
2698 #define CUR_SYMBOL_VALUE sh.value
2699 #define START_PSYMTAB(ofile,fname,low,symoff,global_syms,static_syms)\
2701 #define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps,textlow_not_set) (void)0
2702 #define HANDLE_RBRAC(val) \
2703 if ((val) > save_pst->texthigh) save_pst->texthigh = (val);
2704 #include "partial-stab.h"
2707 && stabstring
!= debug_info
->ss
+ fh
->issBase
+ sh
.iss
)
2710 /* end - Handle continuation */
2715 for (cur_sdx
= 0; cur_sdx
< fh
->csym
;)
2718 enum address_class
class;
2720 (*swap_sym_in
) (cur_bfd
,
2721 ((char *) debug_info
->external_sym
2722 + ((fh
->isymBase
+ cur_sdx
)
2723 * external_sym_size
)),
2726 if (ECOFF_IS_STAB (&sh
))
2732 /* Non absolute static symbols go into the minimal table. */
2733 if (SC_IS_UNDEF (sh
.sc
) || sh
.sc
== scNil
2734 || (sh
.index
== indexNil
2735 && (sh
.st
!= stStatic
|| sh
.sc
== scAbs
)))
2737 /* FIXME, premature? */
2742 name
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2748 /* The value of a stEnd symbol is the displacement from the
2749 corresponding start symbol value, do not relocate it. */
2751 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2758 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
2762 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
2773 prim_record_minimal_symbol_and_info (name
, sh
.value
,
2774 mst_file_text
, NULL
,
2775 SECT_OFF_TEXT (objfile
), NULL
,
2781 /* Usually there is a local and a global stProc symbol
2782 for a function. This means that the function name
2783 has already been entered into the mimimal symbol table
2784 while processing the global symbols in pass 2 above.
2785 One notable exception is the PROGRAM name from
2786 f77 compiled executables, it is only put out as
2787 local stProc symbol, and a global MAIN__ stProc symbol
2788 points to it. It doesn't matter though, as gdb is
2789 still able to find the PROGRAM name via the partial
2790 symbol table, and the MAIN__ symbol via the minimal
2792 if (sh
.st
== stProc
)
2793 add_psymbol_to_list (name
, strlen (name
),
2794 VAR_NAMESPACE
, LOC_BLOCK
,
2795 &objfile
->global_psymbols
,
2796 0, sh
.value
, psymtab_language
, objfile
);
2798 add_psymbol_to_list (name
, strlen (name
),
2799 VAR_NAMESPACE
, LOC_BLOCK
,
2800 &objfile
->static_psymbols
,
2801 0, sh
.value
, psymtab_language
, objfile
);
2803 /* Skip over procedure to next one. */
2804 if (sh
.index
>= hdr
->iauxMax
)
2806 /* Should not happen, but does when cross-compiling
2807 with the MIPS compiler. FIXME -- pull later. */
2808 complain (&index_complaint
, name
);
2809 new_sdx
= cur_sdx
+ 1; /* Don't skip at all */
2812 new_sdx
= AUX_GET_ISYM (fh
->fBigendian
,
2813 (debug_info
->external_aux
2816 procaddr
= sh
.value
;
2818 if (new_sdx
<= cur_sdx
)
2820 /* This should not happen either... FIXME. */
2821 complain (&aux_index_complaint
, name
);
2822 new_sdx
= cur_sdx
+ 1; /* Don't skip backward */
2826 (*swap_sym_in
) (cur_bfd
,
2827 ((char *) debug_info
->external_sym
2828 + ((fh
->isymBase
+ cur_sdx
- 1)
2829 * external_sym_size
)),
2834 /* Kludge for Irix 5.2 zero fh->adr. */
2836 && (pst
->textlow
== 0 || procaddr
< pst
->textlow
))
2837 pst
->textlow
= procaddr
;
2839 high
= procaddr
+ sh
.value
;
2840 if (high
> pst
->texthigh
)
2841 pst
->texthigh
= high
;
2844 case stStatic
: /* Variable */
2845 if (SC_IS_DATA (sh
.sc
))
2846 prim_record_minimal_symbol_and_info (name
, sh
.value
,
2847 mst_file_data
, NULL
,
2848 SECT_OFF_DATA (objfile
),
2852 prim_record_minimal_symbol_and_info (name
, sh
.value
,
2854 SECT_OFF_BSS (objfile
),
2860 case stIndirect
: /* Irix5 forward declaration */
2861 /* Skip forward declarations from Irix5 cc */
2864 case stTypedef
: /* Typedef */
2865 /* Skip typedefs for forward declarations and opaque
2866 structs from alpha and mips cc. */
2867 if (sh
.iss
== 0 || has_opaque_xref (fh
, &sh
))
2869 class = LOC_TYPEDEF
;
2872 case stConstant
: /* Constant decl */
2879 case stBlock
: /* { }, str, un, enum */
2880 /* Do not create a partial symbol for cc unnamed aggregates
2881 and gcc empty aggregates. */
2882 if ((sh
.sc
== scInfo
2883 || SC_IS_COMMON (sh
.sc
))
2885 && sh
.index
!= cur_sdx
+ 2)
2887 add_psymbol_to_list (name
, strlen (name
),
2888 STRUCT_NAMESPACE
, LOC_TYPEDEF
,
2889 &objfile
->static_psymbols
,
2891 psymtab_language
, objfile
);
2893 handle_psymbol_enumerators (objfile
, fh
, sh
.st
, sh
.value
);
2895 /* Skip over the block */
2897 if (new_sdx
<= cur_sdx
)
2899 /* This happens with the Ultrix kernel. */
2900 complain (&block_index_complaint
, name
);
2901 new_sdx
= cur_sdx
+ 1; /* Don't skip backward */
2906 case stFile
: /* File headers */
2907 case stLabel
: /* Labels */
2908 case stEnd
: /* Ends of files */
2911 case stLocal
: /* Local variables */
2912 /* Normally these are skipped because we skip over
2913 all blocks we see. However, these can occur
2914 as visible symbols in a .h file that contains code. */
2918 /* Both complaints are valid: one gives symbol name,
2919 the other the offending symbol type. */
2920 complain (&unknown_sym_complaint
, name
);
2921 complain (&unknown_st_complaint
, sh
.st
);
2925 /* Use this gdb symbol */
2926 add_psymbol_to_list (name
, strlen (name
),
2927 VAR_NAMESPACE
, class,
2928 &objfile
->static_psymbols
,
2929 0, sh
.value
, psymtab_language
, objfile
);
2931 cur_sdx
++; /* Go to next file symbol */
2934 /* Now do enter the external symbols. */
2935 ext_ptr
= &extern_tab
[fdr_to_pst
[f_idx
].globals_offset
];
2936 cur_sdx
= fdr_to_pst
[f_idx
].n_globals
;
2937 PST_PRIVATE (save_pst
)->extern_count
= cur_sdx
;
2938 PST_PRIVATE (save_pst
)->extern_tab
= ext_ptr
;
2939 for (; --cur_sdx
>= 0; ext_ptr
++)
2941 enum address_class
class;
2946 if (ext_ptr
->ifd
!= f_idx
)
2947 internal_error (__FILE__
, __LINE__
, "failed internal consistency check");
2948 psh
= &ext_ptr
->asym
;
2950 /* Do not add undefined symbols to the partial symbol table. */
2951 if (SC_IS_UNDEF (psh
->sc
) || psh
->sc
== scNil
)
2954 svalue
= psh
->value
;
2959 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2966 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
2970 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
2977 /* These are generated for static symbols in .o files,
2982 /* External procedure symbols have been entered
2983 into the minimal symbol table in pass 2 above.
2984 Ignore them, as parse_external will ignore them too. */
2990 complain (&unknown_ext_complaint
,
2991 debug_info
->ssext
+ psh
->iss
);
2992 /* Fall through, pretend it's global. */
2994 /* Global common symbols are resolved by the runtime loader,
2996 if (SC_IS_COMMON (psh
->sc
))
3002 name
= debug_info
->ssext
+ psh
->iss
;
3003 add_psymbol_to_list (name
, strlen (name
),
3004 VAR_NAMESPACE
, class,
3005 &objfile
->global_psymbols
,
3007 psymtab_language
, objfile
);
3011 /* Link pst to FDR. end_psymtab returns NULL if the psymtab was
3012 empty and put on the free list. */
3013 fdr_to_pst
[f_idx
].pst
= end_psymtab (save_pst
,
3014 psymtab_include_list
, includes_used
,
3015 -1, save_pst
->texthigh
,
3016 dependency_list
, dependencies_used
, textlow_not_set
);
3018 dependencies_used
= 0;
3020 if (objfile
->ei
.entry_point
>= save_pst
->textlow
&&
3021 objfile
->ei
.entry_point
< save_pst
->texthigh
)
3023 objfile
->ei
.entry_file_lowpc
= save_pst
->textlow
;
3024 objfile
->ei
.entry_file_highpc
= save_pst
->texthigh
;
3027 /* The objfile has its functions reordered if this partial symbol
3028 table overlaps any other partial symbol table.
3029 We cannot assume a reordered objfile if a partial symbol table
3030 is contained within another partial symbol table, as partial symbol
3031 tables for include files with executable code are contained
3032 within the partial symbol table for the including source file,
3033 and we do not want to flag the objfile reordered for these cases.
3035 This strategy works well for Irix-5.2 shared libraries, but we
3036 might have to use a more elaborate (and slower) algorithm for
3038 save_pst
= fdr_to_pst
[f_idx
].pst
;
3039 if (save_pst
!= NULL
3040 && save_pst
->textlow
!= 0
3041 && !(objfile
->flags
& OBJF_REORDERED
))
3043 ALL_OBJFILE_PSYMTABS (objfile
, pst
)
3046 && save_pst
->textlow
>= pst
->textlow
3047 && save_pst
->textlow
< pst
->texthigh
3048 && save_pst
->texthigh
> pst
->texthigh
)
3050 objfile
->flags
|= OBJF_REORDERED
;
3057 /* Now scan the FDRs for dependencies */
3058 for (f_idx
= 0; f_idx
< hdr
->ifdMax
; f_idx
++)
3060 fh
= f_idx
+ debug_info
->fdr
;
3061 pst
= fdr_to_pst
[f_idx
].pst
;
3063 if (pst
== (struct partial_symtab
*) NULL
)
3066 /* This should catch stabs-in-ecoff. */
3070 /* Skip the first file indirect entry as it is a self dependency
3071 for source files or a reverse .h -> .c dependency for header files. */
3072 pst
->number_of_dependencies
= 0;
3074 ((struct partial_symtab
**)
3075 obstack_alloc (&objfile
->psymbol_obstack
,
3077 * sizeof (struct partial_symtab
*))));
3078 for (s_idx
= 1; s_idx
< fh
->crfd
; s_idx
++)
3082 (*swap_rfd_in
) (cur_bfd
,
3083 ((char *) debug_info
->external_rfd
3084 + (fh
->rfdBase
+ s_idx
) * external_rfd_size
),
3086 if (rh
< 0 || rh
>= hdr
->ifdMax
)
3088 complain (&bad_file_number_complaint
, rh
);
3092 /* Skip self dependencies of header files. */
3096 /* Do not add to dependeny list if psymtab was empty. */
3097 if (fdr_to_pst
[rh
].pst
== (struct partial_symtab
*) NULL
)
3099 pst
->dependencies
[pst
->number_of_dependencies
++] = fdr_to_pst
[rh
].pst
;
3103 /* Remove the dummy psymtab created for -O3 images above, if it is
3104 still empty, to enable the detection of stripped executables. */
3105 if (objfile
->psymtabs
->next
== NULL
3106 && objfile
->psymtabs
->number_of_dependencies
== 0
3107 && objfile
->psymtabs
->n_global_syms
== 0
3108 && objfile
->psymtabs
->n_static_syms
== 0)
3109 objfile
->psymtabs
= NULL
;
3110 do_cleanups (old_chain
);
3113 /* If the current psymbol has an enumerated type, we need to add
3114 all the the enum constants to the partial symbol table. */
3117 handle_psymbol_enumerators (struct objfile
*objfile
, FDR
*fh
, int stype
,
3120 const bfd_size_type external_sym_size
= debug_swap
->external_sym_size
;
3121 void (*const swap_sym_in
) (bfd
*, PTR
, SYMR
*) = debug_swap
->swap_sym_in
;
3122 char *ext_sym
= ((char *) debug_info
->external_sym
3123 + ((fh
->isymBase
+ cur_sdx
+ 1) * external_sym_size
));
3133 /* It is an enumerated type if the next symbol entry is a stMember
3134 and its auxiliary index is indexNil or its auxiliary entry
3135 is a plain btNil or btVoid.
3136 Alpha cc -migrate enums are recognized by a zero index and
3137 a zero symbol value.
3138 DU 4.0 cc enums are recognized by a member type of btEnum without
3139 qualifiers and a zero symbol value. */
3140 (*swap_sym_in
) (cur_bfd
, ext_sym
, &sh
);
3141 if (sh
.st
!= stMember
)
3144 if (sh
.index
== indexNil
3145 || (sh
.index
== 0 && svalue
== 0))
3147 (*debug_swap
->swap_tir_in
) (fh
->fBigendian
,
3148 &(debug_info
->external_aux
3149 + fh
->iauxBase
+ sh
.index
)->a_ti
,
3151 if ((tir
.bt
!= btNil
3153 && (tir
.bt
!= btEnum
|| svalue
!= 0))
3154 || tir
.tq0
!= tqNil
)
3166 (*swap_sym_in
) (cur_bfd
, ext_sym
, &sh
);
3167 if (sh
.st
!= stMember
)
3169 name
= debug_info
->ss
+ cur_fdr
->issBase
+ sh
.iss
;
3171 /* Note that the value doesn't matter for enum constants
3172 in psymtabs, just in symtabs. */
3173 add_psymbol_to_list (name
, strlen (name
),
3174 VAR_NAMESPACE
, LOC_CONST
,
3175 &objfile
->static_psymbols
, 0,
3176 (CORE_ADDR
) 0, psymtab_language
, objfile
);
3177 ext_sym
+= external_sym_size
;
3181 /* Get the next symbol. OBJFILE is unused. */
3184 mdebug_next_symbol_text (struct objfile
*objfile
)
3189 (*debug_swap
->swap_sym_in
) (cur_bfd
,
3190 ((char *) debug_info
->external_sym
3191 + ((cur_fdr
->isymBase
+ cur_sdx
)
3192 * debug_swap
->external_sym_size
)),
3194 return debug_info
->ss
+ cur_fdr
->issBase
+ sh
.iss
;
3197 /* Ancillary function to psymtab_to_symtab(). Does all the work
3198 for turning the partial symtab PST into a symtab, recurring
3199 first on all dependent psymtabs. The argument FILENAME is
3200 only passed so we can see in debug stack traces what file
3203 This function has a split personality, based on whether the
3204 symbol table contains ordinary ecoff symbols, or stabs-in-ecoff.
3205 The flow of control and even the memory allocation differs. FIXME. */
3208 psymtab_to_symtab_1 (struct partial_symtab
*pst
, char *filename
)
3210 bfd_size_type external_sym_size
;
3211 bfd_size_type external_pdr_size
;
3212 void (*swap_sym_in
) (bfd
*, PTR
, SYMR
*);
3213 void (*swap_pdr_in
) (bfd
*, PTR
, PDR
*);
3217 struct linetable
*lines
;
3218 CORE_ADDR lowest_pdr_addr
= 0;
3224 /* Read in all partial symbtabs on which this one is dependent.
3225 NOTE that we do have circular dependencies, sigh. We solved
3226 that by setting pst->readin before this point. */
3228 for (i
= 0; i
< pst
->number_of_dependencies
; i
++)
3229 if (!pst
->dependencies
[i
]->readin
)
3231 /* Inform about additional files to be read in. */
3234 fputs_filtered (" ", gdb_stdout
);
3236 fputs_filtered ("and ", gdb_stdout
);
3238 printf_filtered ("%s...",
3239 pst
->dependencies
[i
]->filename
);
3240 wrap_here (""); /* Flush output */
3241 gdb_flush (gdb_stdout
);
3243 /* We only pass the filename for debug purposes */
3244 psymtab_to_symtab_1 (pst
->dependencies
[i
],
3245 pst
->dependencies
[i
]->filename
);
3248 /* Do nothing if this is a dummy psymtab. */
3250 if (pst
->n_global_syms
== 0 && pst
->n_static_syms
== 0
3251 && pst
->textlow
== 0 && pst
->texthigh
== 0)
3254 /* Now read the symbols for this symtab */
3256 cur_bfd
= CUR_BFD (pst
);
3257 debug_swap
= DEBUG_SWAP (pst
);
3258 debug_info
= DEBUG_INFO (pst
);
3259 pending_list
= PENDING_LIST (pst
);
3260 external_sym_size
= debug_swap
->external_sym_size
;
3261 external_pdr_size
= debug_swap
->external_pdr_size
;
3262 swap_sym_in
= debug_swap
->swap_sym_in
;
3263 swap_pdr_in
= debug_swap
->swap_pdr_in
;
3264 current_objfile
= pst
->objfile
;
3265 cur_fd
= FDR_IDX (pst
);
3266 fh
= ((cur_fd
== -1)
3268 : debug_info
->fdr
+ cur_fd
);
3271 /* See comment in parse_partial_symbols about the @stabs sentinel. */
3272 processing_gcc_compilation
= 0;
3273 if (fh
!= (FDR
*) NULL
&& fh
->csym
>= 2)
3277 (*swap_sym_in
) (cur_bfd
,
3278 ((char *) debug_info
->external_sym
3279 + (fh
->isymBase
+ 1) * external_sym_size
),
3281 if (STREQ (debug_info
->ss
+ fh
->issBase
+ sh
.iss
,
3284 /* We indicate that this is a GCC compilation so that certain
3285 features will be enabled in stabsread/dbxread. */
3286 processing_gcc_compilation
= 2;
3290 if (processing_gcc_compilation
!= 0)
3293 /* This symbol table contains stabs-in-ecoff entries. */
3295 /* Parse local symbols first */
3297 if (fh
->csym
<= 2) /* FIXME, this blows psymtab->symtab ptr */
3299 current_objfile
= NULL
;
3302 for (cur_sdx
= 2; cur_sdx
< fh
->csym
; cur_sdx
++)
3308 (*swap_sym_in
) (cur_bfd
,
3309 (((char *) debug_info
->external_sym
)
3310 + (fh
->isymBase
+ cur_sdx
) * external_sym_size
),
3312 name
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
3314 /* XXX This is a hack. It will go away! */
3315 if (ECOFF_IS_STAB (&sh
) || (name
[0] == '#'))
3317 int type_code
= ECOFF_UNMARK_STAB (sh
.index
);
3319 /* We should never get non N_STAB symbols here, but they
3320 should be harmless, so keep process_one_symbol from
3321 complaining about them. */
3322 if (type_code
& N_STAB
)
3324 process_one_symbol (type_code
, 0, valu
, name
,
3325 pst
->section_offsets
, pst
->objfile
);
3327 /* Similarly a hack. */
3328 else if (name
[0] == '#')
3330 process_one_symbol (N_SLINE
, 0, valu
, name
,
3331 pst
->section_offsets
, pst
->objfile
);
3333 if (type_code
== N_FUN
)
3335 /* Make up special symbol to contain
3336 procedure specific info */
3337 struct mips_extra_func_info
*e
=
3338 ((struct mips_extra_func_info
*)
3339 obstack_alloc (¤t_objfile
->symbol_obstack
,
3340 sizeof (struct mips_extra_func_info
)));
3341 struct symbol
*s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
3343 memset ((PTR
) e
, 0, sizeof (struct mips_extra_func_info
));
3344 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
3345 SYMBOL_CLASS (s
) = LOC_CONST
;
3346 SYMBOL_TYPE (s
) = mdebug_type_void
;
3347 SYMBOL_VALUE (s
) = (long) e
;
3348 e
->pdr
.framereg
= -1;
3349 add_symbol_to_list (s
, &local_symbols
);
3352 else if (sh
.st
== stLabel
)
3354 if (sh
.index
== indexNil
)
3356 /* This is what the gcc2_compiled and __gnu_compiled_*
3357 show up as. So don't complain. */
3362 /* Handle encoded stab line number. */
3363 valu
+= ANOFFSET (pst
->section_offsets
, SECT_OFF_TEXT (pst
->objfile
));
3364 record_line (current_subfile
, sh
.index
, valu
);
3367 else if (sh
.st
== stProc
|| sh
.st
== stStaticProc
3368 || sh
.st
== stStatic
|| sh
.st
== stEnd
)
3369 /* These are generated by gcc-2.x, do not complain */
3372 complain (&stab_unknown_complaint
, name
);
3374 st
= end_symtab (pst
->texthigh
, pst
->objfile
, SECT_OFF_TEXT (pst
->objfile
));
3377 /* Sort the symbol table now, we are done adding symbols to it.
3378 We must do this before parse_procedure calls lookup_symbol. */
3379 sort_symtab_syms (st
);
3381 /* There used to be a call to sort_blocks here, but this should not
3382 be necessary for stabs symtabs. And as sort_blocks modifies the
3383 start address of the GLOBAL_BLOCK to the FIRST_LOCAL_BLOCK,
3384 it did the wrong thing if the first procedure in a file was
3385 generated via asm statements. */
3387 /* Fill in procedure info next. */
3391 struct cleanup
*old_chain
;
3397 pr_block
= (PDR
*) xmalloc (fh
->cpd
* sizeof (PDR
));
3398 old_chain
= make_cleanup (xfree
, pr_block
);
3400 pdr_ptr
= ((char *) debug_info
->external_pdr
3401 + fh
->ipdFirst
* external_pdr_size
);
3402 pdr_end
= pdr_ptr
+ fh
->cpd
* external_pdr_size
;
3406 pdr_ptr
+= external_pdr_size
, pdr_in
++)
3408 (*swap_pdr_in
) (cur_bfd
, pdr_ptr
, pdr_in
);
3410 /* Determine lowest PDR address, the PDRs are not always
3412 if (pdr_in
== pr_block
)
3413 lowest_pdr_addr
= pdr_in
->adr
;
3414 else if (pdr_in
->adr
< lowest_pdr_addr
)
3415 lowest_pdr_addr
= pdr_in
->adr
;
3419 pdr_in_end
= pdr_in
+ fh
->cpd
;
3420 for (; pdr_in
< pdr_in_end
; pdr_in
++)
3421 parse_procedure (pdr_in
, st
, pst
);
3423 do_cleanups (old_chain
);
3428 /* This symbol table contains ordinary ecoff entries. */
3434 /* How many symbols will we need */
3435 /* FIXME, this does not count enum values. */
3436 f_max
= pst
->n_global_syms
+ pst
->n_static_syms
;
3440 st
= new_symtab ("unknown", f_max
, 0, pst
->objfile
);
3444 f_max
+= fh
->csym
+ fh
->cpd
;
3445 maxlines
= 2 * fh
->cline
;
3446 st
= new_symtab (pst
->filename
, 2 * f_max
, maxlines
, pst
->objfile
);
3448 /* The proper language was already determined when building
3449 the psymtab, use it. */
3450 st
->language
= PST_PRIVATE (pst
)->pst_language
;
3453 psymtab_language
= st
->language
;
3455 lines
= LINETABLE (st
);
3457 /* Get a new lexical context */
3459 push_parse_stack ();
3460 top_stack
->cur_st
= st
;
3461 top_stack
->cur_block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (st
),
3463 BLOCK_START (top_stack
->cur_block
) = pst
->textlow
;
3464 BLOCK_END (top_stack
->cur_block
) = 0;
3465 top_stack
->blocktype
= stFile
;
3466 top_stack
->maxsyms
= 2 * f_max
;
3467 top_stack
->cur_type
= 0;
3468 top_stack
->procadr
= 0;
3469 top_stack
->numargs
= 0;
3470 found_ecoff_debugging_info
= 0;
3477 /* Parse local symbols first */
3478 sym_ptr
= ((char *) debug_info
->external_sym
3479 + fh
->isymBase
* external_sym_size
);
3480 sym_end
= sym_ptr
+ fh
->csym
* external_sym_size
;
3481 while (sym_ptr
< sym_end
)
3486 (*swap_sym_in
) (cur_bfd
, sym_ptr
, &sh
);
3487 c
= parse_symbol (&sh
,
3488 debug_info
->external_aux
+ fh
->iauxBase
,
3489 sym_ptr
, fh
->fBigendian
, pst
->section_offsets
, pst
->objfile
);
3490 sym_ptr
+= c
* external_sym_size
;
3493 /* Linenumbers. At the end, check if we can save memory.
3494 parse_lines has to look ahead an arbitrary number of PDR
3495 structures, so we swap them all first. */
3499 struct cleanup
*old_chain
;
3505 pr_block
= (PDR
*) xmalloc (fh
->cpd
* sizeof (PDR
));
3507 old_chain
= make_cleanup (xfree
, pr_block
);
3509 pdr_ptr
= ((char *) debug_info
->external_pdr
3510 + fh
->ipdFirst
* external_pdr_size
);
3511 pdr_end
= pdr_ptr
+ fh
->cpd
* external_pdr_size
;
3515 pdr_ptr
+= external_pdr_size
, pdr_in
++)
3517 (*swap_pdr_in
) (cur_bfd
, pdr_ptr
, pdr_in
);
3519 /* Determine lowest PDR address, the PDRs are not always
3521 if (pdr_in
== pr_block
)
3522 lowest_pdr_addr
= pdr_in
->adr
;
3523 else if (pdr_in
->adr
< lowest_pdr_addr
)
3524 lowest_pdr_addr
= pdr_in
->adr
;
3527 parse_lines (fh
, pr_block
, lines
, maxlines
, pst
, lowest_pdr_addr
);
3528 if (lines
->nitems
< fh
->cline
)
3529 lines
= shrink_linetable (lines
);
3531 /* Fill in procedure info next. */
3533 pdr_in_end
= pdr_in
+ fh
->cpd
;
3534 for (; pdr_in
< pdr_in_end
; pdr_in
++)
3535 parse_procedure (pdr_in
, 0, pst
);
3537 do_cleanups (old_chain
);
3541 LINETABLE (st
) = lines
;
3543 /* .. and our share of externals.
3544 XXX use the global list to speed up things here. how?
3545 FIXME, Maybe quit once we have found the right number of ext's? */
3546 top_stack
->cur_st
= st
;
3547 top_stack
->cur_block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack
->cur_st
),
3549 top_stack
->blocktype
= stFile
;
3551 = (debug_info
->symbolic_header
.isymMax
3552 + debug_info
->symbolic_header
.ipdMax
3553 + debug_info
->symbolic_header
.iextMax
);
3555 ext_ptr
= PST_PRIVATE (pst
)->extern_tab
;
3556 for (i
= PST_PRIVATE (pst
)->extern_count
; --i
>= 0; ext_ptr
++)
3557 parse_external (ext_ptr
, fh
->fBigendian
, pst
->section_offsets
, pst
->objfile
);
3559 /* If there are undefined symbols, tell the user.
3560 The alpha has an undefined symbol for every symbol that is
3561 from a shared library, so tell the user only if verbose is on. */
3562 if (info_verbose
&& n_undef_symbols
)
3564 printf_filtered ("File %s contains %d unresolved references:",
3565 st
->filename
, n_undef_symbols
);
3566 printf_filtered ("\n\t%4d variables\n\t%4d procedures\n\t%4d labels\n",
3567 n_undef_vars
, n_undef_procs
, n_undef_labels
);
3568 n_undef_symbols
= n_undef_labels
= n_undef_vars
= n_undef_procs
= 0;
3575 /* Sort the symbol table now, we are done adding symbols to it. */
3576 sort_symtab_syms (st
);
3581 /* Now link the psymtab and the symtab. */
3584 current_objfile
= NULL
;
3587 /* Ancillary parsing procedures. */
3589 /* Return 1 if the symbol pointed to by SH has a cross reference
3590 to an opaque aggregate type, else 0. */
3593 has_opaque_xref (FDR
*fh
, SYMR
*sh
)
3600 if (sh
->index
== indexNil
)
3603 ax
= debug_info
->external_aux
+ fh
->iauxBase
+ sh
->index
;
3604 (*debug_swap
->swap_tir_in
) (fh
->fBigendian
, &ax
->a_ti
, &tir
);
3605 if (tir
.bt
!= btStruct
&& tir
.bt
!= btUnion
&& tir
.bt
!= btEnum
)
3609 (*debug_swap
->swap_rndx_in
) (fh
->fBigendian
, &ax
->a_rndx
, rn
);
3610 if (rn
->rfd
== 0xfff)
3611 rf
= AUX_GET_ISYM (fh
->fBigendian
, ax
+ 1);
3619 /* Lookup the type at relative index RN. Return it in TPP
3620 if found and in any event come up with its name PNAME.
3621 BIGEND says whether aux symbols are big-endian or not (from fh->fBigendian).
3622 Return value says how many aux symbols we ate. */
3625 cross_ref (int fd
, union aux_ext
*ax
, struct type
**tpp
, enum type_code type_code
, /* Use to alloc new type if none is found. */
3626 char **pname
, int bigend
, char *sym_name
)
3635 struct mdebug_pending
*pend
;
3637 *tpp
= (struct type
*) NULL
;
3639 (*debug_swap
->swap_rndx_in
) (bigend
, &ax
->a_rndx
, rn
);
3641 /* Escape index means 'the next one' */
3642 if (rn
->rfd
== 0xfff)
3645 rf
= AUX_GET_ISYM (bigend
, ax
+ 1);
3652 /* mips cc uses a rf of -1 for opaque struct definitions.
3653 Set TYPE_FLAG_STUB for these types so that check_typedef will
3654 resolve them if the struct gets defined in another compilation unit. */
3657 *pname
= "<undefined>";
3658 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
3659 TYPE_FLAGS (*tpp
) |= TYPE_FLAG_STUB
;
3663 /* mips cc uses an escaped rn->index of 0 for struct return types
3664 of procedures that were compiled without -g. These will always remain
3666 if (rn
->rfd
== 0xfff && rn
->index
== 0)
3668 *pname
= "<undefined>";
3672 /* Find the relative file descriptor and the symbol in it. */
3673 fh
= get_rfd (fd
, rf
);
3674 xref_fd
= fh
- debug_info
->fdr
;
3676 if (rn
->index
>= fh
->csym
)
3678 /* File indirect entry is corrupt. */
3679 *pname
= "<illegal>";
3680 complain (&bad_rfd_entry_complaint
,
3681 sym_name
, xref_fd
, rn
->index
);
3685 /* If we have processed this symbol then we left a forwarding
3686 pointer to the type in the pending list. If not, we`ll put
3687 it in a list of pending types, to be processed later when
3688 the file will be. In any event, we collect the name for the
3691 esh
= ((char *) debug_info
->external_sym
3692 + ((fh
->isymBase
+ rn
->index
)
3693 * debug_swap
->external_sym_size
));
3694 (*debug_swap
->swap_sym_in
) (cur_bfd
, esh
, &sh
);
3696 /* Make sure that this type of cross reference can be handled. */
3697 if ((sh
.sc
!= scInfo
3698 || (sh
.st
!= stBlock
&& sh
.st
!= stTypedef
&& sh
.st
!= stIndirect
3699 && sh
.st
!= stStruct
&& sh
.st
!= stUnion
3700 && sh
.st
!= stEnum
))
3701 && (sh
.st
!= stBlock
|| !SC_IS_COMMON (sh
.sc
)))
3703 /* File indirect entry is corrupt. */
3704 *pname
= "<illegal>";
3705 complain (&bad_rfd_entry_complaint
,
3706 sym_name
, xref_fd
, rn
->index
);
3710 *pname
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
3712 pend
= is_pending_symbol (fh
, esh
);
3717 /* We have not yet seen this type. */
3719 if ((sh
.iss
== 0 && sh
.st
== stTypedef
) || sh
.st
== stIndirect
)
3723 /* alpha cc puts out a stTypedef with a sh.iss of zero for
3725 a) forward declarations of structs/unions/enums which are not
3726 defined in this compilation unit.
3727 For these the type will be void. This is a bad design decision
3728 as cross referencing across compilation units is impossible
3729 due to the missing name.
3730 b) forward declarations of structs/unions/enums/typedefs which
3731 are defined later in this file or in another file in the same
3732 compilation unit. Irix5 cc uses a stIndirect symbol for this.
3733 Simply cross reference those again to get the true type.
3734 The forward references are not entered in the pending list and
3735 in the symbol table. */
3737 (*debug_swap
->swap_tir_in
) (bigend
,
3738 &(debug_info
->external_aux
3739 + fh
->iauxBase
+ sh
.index
)->a_ti
,
3741 if (tir
.tq0
!= tqNil
)
3742 complain (&illegal_forward_tq0_complaint
, sym_name
);
3746 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
,
3748 *pname
= "<undefined>";
3755 (debug_info
->external_aux
3756 + fh
->iauxBase
+ sh
.index
+ 1),
3757 tpp
, type_code
, pname
,
3758 fh
->fBigendian
, sym_name
);
3762 /* Follow a forward typedef. This might recursively
3763 call cross_ref till we get a non typedef'ed type.
3764 FIXME: This is not correct behaviour, but gdb currently
3765 cannot handle typedefs without type copying. Type
3766 copying is impossible as we might have mutual forward
3767 references between two files and the copied type would not
3768 get filled in when we later parse its definition. */
3769 *tpp
= parse_type (xref_fd
,
3770 debug_info
->external_aux
+ fh
->iauxBase
,
3774 debug_info
->ss
+ fh
->issBase
+ sh
.iss
);
3775 add_pending (fh
, esh
, *tpp
);
3779 complain (&illegal_forward_bt_complaint
, tir
.bt
, sym_name
);
3780 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
,
3786 else if (sh
.st
== stTypedef
)
3788 /* Parse the type for a normal typedef. This might recursively call
3789 cross_ref till we get a non typedef'ed type.
3790 FIXME: This is not correct behaviour, but gdb currently
3791 cannot handle typedefs without type copying. But type copying is
3792 impossible as we might have mutual forward references between
3793 two files and the copied type would not get filled in when
3794 we later parse its definition. */
3795 *tpp
= parse_type (xref_fd
,
3796 debug_info
->external_aux
+ fh
->iauxBase
,
3800 debug_info
->ss
+ fh
->issBase
+ sh
.iss
);
3804 /* Cross reference to a struct/union/enum which is defined
3805 in another file in the same compilation unit but that file
3806 has not been parsed yet.
3807 Initialize the type only, it will be filled in when
3808 it's definition is parsed. */
3809 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
3811 add_pending (fh
, esh
, *tpp
);
3814 /* We used one auxent normally, two if we got a "next one" rf. */
3819 /* Quick&dirty lookup procedure, to avoid the MI ones that require
3820 keeping the symtab sorted */
3822 static struct symbol
*
3823 mylookup_symbol (char *name
, register struct block
*block
,
3824 namespace_enum
namespace, enum address_class
class)
3826 register int bot
, top
, inc
;
3827 register struct symbol
*sym
;
3830 top
= BLOCK_NSYMS (block
);
3834 sym
= BLOCK_SYM (block
, bot
);
3835 if (SYMBOL_NAME (sym
)[0] == inc
3836 && SYMBOL_NAMESPACE (sym
) == namespace
3837 && SYMBOL_CLASS (sym
) == class
3838 && strcmp (SYMBOL_NAME (sym
), name
) == 0)
3842 block
= BLOCK_SUPERBLOCK (block
);
3844 return mylookup_symbol (name
, block
, namespace, class);
3849 /* Add a new symbol S to a block B.
3850 Infrequently, we will need to reallocate the block to make it bigger.
3851 We only detect this case when adding to top_stack->cur_block, since
3852 that's the only time we know how big the block is. FIXME. */
3855 add_symbol (struct symbol
*s
, struct block
*b
)
3857 int nsyms
= BLOCK_NSYMS (b
)++;
3858 struct block
*origb
;
3859 struct parse_stack
*stackp
;
3861 if (b
== top_stack
->cur_block
&&
3862 nsyms
>= top_stack
->maxsyms
)
3864 complain (&block_overflow_complaint
, SYMBOL_NAME (s
));
3865 /* In this case shrink_block is actually grow_block, since
3866 BLOCK_NSYMS(b) is larger than its current size. */
3868 b
= shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
3870 /* Now run through the stack replacing pointers to the
3871 original block. shrink_block has already done this
3872 for the blockvector and BLOCK_FUNCTION. */
3873 for (stackp
= top_stack
; stackp
; stackp
= stackp
->next
)
3875 if (stackp
->cur_block
== origb
)
3877 stackp
->cur_block
= b
;
3878 stackp
->maxsyms
= BLOCK_NSYMS (b
);
3882 BLOCK_SYM (b
, nsyms
) = s
;
3885 /* Add a new block B to a symtab S */
3888 add_block (struct block
*b
, struct symtab
*s
)
3890 struct blockvector
*bv
= BLOCKVECTOR (s
);
3892 bv
= (struct blockvector
*) xrealloc ((PTR
) bv
,
3893 (sizeof (struct blockvector
)
3894 + BLOCKVECTOR_NBLOCKS (bv
)
3895 * sizeof (bv
->block
)));
3896 if (bv
!= BLOCKVECTOR (s
))
3897 BLOCKVECTOR (s
) = bv
;
3899 BLOCKVECTOR_BLOCK (bv
, BLOCKVECTOR_NBLOCKS (bv
)++) = b
;
3902 /* Add a new linenumber entry (LINENO,ADR) to a linevector LT.
3903 MIPS' linenumber encoding might need more than one byte
3904 to describe it, LAST is used to detect these continuation lines.
3906 Combining lines with the same line number seems like a bad idea.
3907 E.g: There could be a line number entry with the same line number after the
3908 prologue and GDB should not ignore it (this is a better way to find
3909 a prologue than mips_skip_prologue).
3910 But due to the compressed line table format there are line number entries
3911 for the same line which are needed to bridge the gap to the next
3912 line number entry. These entries have a bogus address info with them
3913 and we are unable to tell them from intended duplicate line number
3915 This is another reason why -ggdb debugging format is preferable. */
3918 add_line (struct linetable
*lt
, int lineno
, CORE_ADDR adr
, int last
)
3920 /* DEC c89 sometimes produces zero linenos which confuse gdb.
3921 Change them to something sensible. */
3925 last
= -2; /* make sure we record first line */
3927 if (last
== lineno
) /* skip continuation lines */
3930 lt
->item
[lt
->nitems
].line
= lineno
;
3931 lt
->item
[lt
->nitems
++].pc
= adr
<< 2;
3935 /* Sorting and reordering procedures */
3937 /* Blocks with a smaller low bound should come first */
3940 compare_blocks (const PTR arg1
, const PTR arg2
)
3942 register int addr_diff
;
3943 struct block
**b1
= (struct block
**) arg1
;
3944 struct block
**b2
= (struct block
**) arg2
;
3946 addr_diff
= (BLOCK_START ((*b1
))) - (BLOCK_START ((*b2
)));
3948 return (BLOCK_END ((*b2
))) - (BLOCK_END ((*b1
)));
3952 /* Sort the blocks of a symtab S.
3953 Reorder the blocks in the blockvector by code-address,
3954 as required by some MI search routines */
3957 sort_blocks (struct symtab
*s
)
3959 struct blockvector
*bv
= BLOCKVECTOR (s
);
3961 if (BLOCKVECTOR_NBLOCKS (bv
) <= 2)
3964 if (BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) == 0)
3965 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) = 0;
3966 if (BLOCK_END (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) == 0)
3967 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) = 0;
3971 * This is very unfortunate: normally all functions are compiled in
3972 * the order they are found, but if the file is compiled -O3 things
3973 * are very different. It would be nice to find a reliable test
3974 * to detect -O3 images in advance.
3976 if (BLOCKVECTOR_NBLOCKS (bv
) > 3)
3977 qsort (&BLOCKVECTOR_BLOCK (bv
, FIRST_LOCAL_BLOCK
),
3978 BLOCKVECTOR_NBLOCKS (bv
) - FIRST_LOCAL_BLOCK
,
3979 sizeof (struct block
*),
3983 register CORE_ADDR high
= 0;
3984 register int i
, j
= BLOCKVECTOR_NBLOCKS (bv
);
3986 for (i
= FIRST_LOCAL_BLOCK
; i
< j
; i
++)
3987 if (high
< BLOCK_END (BLOCKVECTOR_BLOCK (bv
, i
)))
3988 high
= BLOCK_END (BLOCKVECTOR_BLOCK (bv
, i
));
3989 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) = high
;
3992 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) =
3993 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, FIRST_LOCAL_BLOCK
));
3995 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) =
3996 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
));
3997 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) =
3998 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
));
4002 /* Constructor/restructor/destructor procedures */
4004 /* Allocate a new symtab for NAME. Needs an estimate of how many symbols
4005 MAXSYMS and linenumbers MAXLINES we'll put in it */
4007 static struct symtab
*
4008 new_symtab (char *name
, int maxsyms
, int maxlines
, struct objfile
*objfile
)
4010 struct symtab
*s
= allocate_symtab (name
, objfile
);
4012 LINETABLE (s
) = new_linetable (maxlines
);
4014 /* All symtabs must have at least two blocks */
4015 BLOCKVECTOR (s
) = new_bvect (2);
4016 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), GLOBAL_BLOCK
) = new_block (maxsyms
);
4017 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), STATIC_BLOCK
) = new_block (maxsyms
);
4018 BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), STATIC_BLOCK
)) =
4019 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), GLOBAL_BLOCK
);
4021 s
->free_code
= free_linetable
;
4022 s
->debugformat
= obsavestring ("ECOFF", 5,
4023 &objfile
->symbol_obstack
);
4027 /* Allocate a new partial_symtab NAME */
4029 static struct partial_symtab
*
4030 new_psymtab (char *name
, struct objfile
*objfile
)
4032 struct partial_symtab
*psymtab
;
4034 psymtab
= allocate_psymtab (name
, objfile
);
4035 psymtab
->section_offsets
= objfile
->section_offsets
;
4037 /* Keep a backpointer to the file's symbols */
4039 psymtab
->read_symtab_private
= ((char *)
4040 obstack_alloc (&objfile
->psymbol_obstack
,
4041 sizeof (struct symloc
)));
4042 memset ((PTR
) psymtab
->read_symtab_private
, 0, sizeof (struct symloc
));
4043 CUR_BFD (psymtab
) = cur_bfd
;
4044 DEBUG_SWAP (psymtab
) = debug_swap
;
4045 DEBUG_INFO (psymtab
) = debug_info
;
4046 PENDING_LIST (psymtab
) = pending_list
;
4048 /* The way to turn this into a symtab is to call... */
4049 psymtab
->read_symtab
= mdebug_psymtab_to_symtab
;
4054 /* Allocate a linetable array of the given SIZE. Since the struct
4055 already includes one item, we subtract one when calculating the
4056 proper size to allocate. */
4058 static struct linetable
*
4059 new_linetable (int size
)
4061 struct linetable
*l
;
4063 size
= (size
- 1) * sizeof (l
->item
) + sizeof (struct linetable
);
4064 l
= (struct linetable
*) xmalloc (size
);
4069 /* Oops, too big. Shrink it. This was important with the 2.4 linetables,
4070 I am not so sure about the 3.4 ones.
4072 Since the struct linetable already includes one item, we subtract one when
4073 calculating the proper size to allocate. */
4075 static struct linetable
*
4076 shrink_linetable (struct linetable
*lt
)
4079 return (struct linetable
*) xrealloc ((PTR
) lt
,
4080 (sizeof (struct linetable
)
4082 * sizeof (lt
->item
))));
4085 /* Allocate and zero a new blockvector of NBLOCKS blocks. */
4087 static struct blockvector
*
4088 new_bvect (int nblocks
)
4090 struct blockvector
*bv
;
4093 size
= sizeof (struct blockvector
) + nblocks
* sizeof (struct block
*);
4094 bv
= (struct blockvector
*) xzalloc (size
);
4096 BLOCKVECTOR_NBLOCKS (bv
) = nblocks
;
4101 /* Allocate and zero a new block of MAXSYMS symbols */
4103 static struct block
*
4104 new_block (int maxsyms
)
4106 int size
= sizeof (struct block
) + (maxsyms
- 1) * sizeof (struct symbol
*);
4108 return (struct block
*) xzalloc (size
);
4111 /* Ooops, too big. Shrink block B in symtab S to its minimal size.
4112 Shrink_block can also be used by add_symbol to grow a block. */
4114 static struct block
*
4115 shrink_block (struct block
*b
, struct symtab
*s
)
4118 struct blockvector
*bv
= BLOCKVECTOR (s
);
4121 /* Just reallocate it and fix references to the old one */
4123 new = (struct block
*) xrealloc ((PTR
) b
,
4124 (sizeof (struct block
)
4125 + ((BLOCK_NSYMS (b
) - 1)
4126 * sizeof (struct symbol
*))));
4128 /* Should chase pointers to old one. Fortunately, that`s just
4129 the block`s function and inferior blocks */
4130 if (BLOCK_FUNCTION (new) && SYMBOL_BLOCK_VALUE (BLOCK_FUNCTION (new)) == b
)
4131 SYMBOL_BLOCK_VALUE (BLOCK_FUNCTION (new)) = new;
4132 for (i
= 0; i
< BLOCKVECTOR_NBLOCKS (bv
); i
++)
4133 if (BLOCKVECTOR_BLOCK (bv
, i
) == b
)
4134 BLOCKVECTOR_BLOCK (bv
, i
) = new;
4135 else if (BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv
, i
)) == b
)
4136 BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv
, i
)) = new;
4140 /* Create a new symbol with printname NAME */
4142 static struct symbol
*
4143 new_symbol (char *name
)
4145 struct symbol
*s
= ((struct symbol
*)
4146 obstack_alloc (¤t_objfile
->symbol_obstack
,
4147 sizeof (struct symbol
)));
4149 memset ((PTR
) s
, 0, sizeof (*s
));
4150 SYMBOL_NAME (s
) = obsavestring (name
, strlen (name
),
4151 ¤t_objfile
->symbol_obstack
);
4152 SYMBOL_LANGUAGE (s
) = psymtab_language
;
4153 SYMBOL_INIT_DEMANGLED_NAME (s
, ¤t_objfile
->symbol_obstack
);
4157 /* Create a new type with printname NAME */
4159 static struct type
*
4160 new_type (char *name
)
4164 t
= alloc_type (current_objfile
);
4165 TYPE_NAME (t
) = name
;
4166 TYPE_CPLUS_SPECIFIC (t
) = (struct cplus_struct_type
*) &cplus_struct_default
;
4170 /* Read ECOFF debugging information from a BFD section. This is
4171 called from elfread.c. It parses the section into a
4172 ecoff_debug_info struct, and then lets the rest of the file handle
4176 elfmdebug_build_psymtabs (struct objfile
*objfile
,
4177 const struct ecoff_debug_swap
*swap
, asection
*sec
)
4179 bfd
*abfd
= objfile
->obfd
;
4180 struct ecoff_debug_info
*info
;
4182 info
= ((struct ecoff_debug_info
*)
4183 obstack_alloc (&objfile
->psymbol_obstack
,
4184 sizeof (struct ecoff_debug_info
)));
4186 if (!(*swap
->read_debug_info
) (abfd
, sec
, info
))
4187 error ("Error reading ECOFF debugging information: %s",
4188 bfd_errmsg (bfd_get_error ()));
4190 mdebug_build_psymtabs (objfile
, swap
, info
);
4194 /* Things used for calling functions in the inferior.
4195 These functions are exported to our companion
4196 mips-tdep.c file and are here because they play
4197 with the symbol-table explicitly. */
4199 /* Sigtramp: make sure we have all the necessary information
4200 about the signal trampoline code. Since the official code
4201 from MIPS does not do so, we make up that information ourselves.
4202 If they fix the library (unlikely) this code will neutralize itself. */
4204 /* FIXME: This function is called only by mips-tdep.c. It needs to be
4205 here because it calls functions defined in this file, but perhaps
4206 this could be handled in a better way. Only compile it in when
4207 tm-mips.h is included. */
4212 fixup_sigtramp (void)
4216 struct block
*b
, *b0
= NULL
;
4218 sigtramp_address
= -1;
4220 /* We have to handle the following cases here:
4221 a) The Mips library has a sigtramp label within sigvec.
4222 b) Irix has a _sigtramp which we want to use, but it also has sigvec. */
4223 s
= lookup_symbol ("sigvec", 0, VAR_NAMESPACE
, 0, NULL
);
4226 b0
= SYMBOL_BLOCK_VALUE (s
);
4227 s
= lookup_symbol ("sigtramp", b0
, VAR_NAMESPACE
, 0, NULL
);
4231 /* No sigvec or no sigtramp inside sigvec, try _sigtramp. */
4232 s
= lookup_symbol ("_sigtramp", 0, VAR_NAMESPACE
, 0, NULL
);
4235 /* But maybe this program uses its own version of sigvec */
4239 /* Did we or MIPSco fix the library ? */
4240 if (SYMBOL_CLASS (s
) == LOC_BLOCK
)
4242 sigtramp_address
= BLOCK_START (SYMBOL_BLOCK_VALUE (s
));
4243 sigtramp_end
= BLOCK_END (SYMBOL_BLOCK_VALUE (s
));
4247 sigtramp_address
= SYMBOL_VALUE (s
);
4248 sigtramp_end
= sigtramp_address
+ 0x88; /* black magic */
4250 /* But what symtab does it live in ? */
4251 st
= find_pc_symtab (SYMBOL_VALUE (s
));
4254 * Ok, there goes the fix: turn it into a procedure, with all the
4255 * needed info. Note we make it a nested procedure of sigvec,
4256 * which is the way the (assembly) code is actually written.
4258 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
4259 SYMBOL_CLASS (s
) = LOC_BLOCK
;
4260 SYMBOL_TYPE (s
) = init_type (TYPE_CODE_FUNC
, 4, 0, (char *) NULL
,
4262 TYPE_TARGET_TYPE (SYMBOL_TYPE (s
)) = mdebug_type_void
;
4264 /* Need a block to allocate MIPS_EFI_SYMBOL_NAME in */
4266 SYMBOL_BLOCK_VALUE (s
) = b
;
4267 BLOCK_START (b
) = sigtramp_address
;
4268 BLOCK_END (b
) = sigtramp_end
;
4269 BLOCK_FUNCTION (b
) = s
;
4270 BLOCK_SUPERBLOCK (b
) = BLOCK_SUPERBLOCK (b0
);
4274 /* Make a MIPS_EFI_SYMBOL_NAME entry for it */
4276 struct mips_extra_func_info
*e
=
4277 ((struct mips_extra_func_info
*)
4278 xzalloc (sizeof (struct mips_extra_func_info
)));
4280 e
->numargs
= 0; /* the kernel thinks otherwise */
4281 e
->pdr
.frameoffset
= 32;
4282 e
->pdr
.framereg
= SP_REGNUM
;
4283 /* Note that setting pcreg is no longer strictly necessary as
4284 mips_frame_saved_pc is now aware of signal handler frames. */
4285 e
->pdr
.pcreg
= PC_REGNUM
;
4286 e
->pdr
.regmask
= -2;
4287 /* Offset to saved r31, in the sigtramp case the saved registers
4288 are above the frame in the sigcontext.
4289 We have 4 alignment bytes, 12 bytes for onstack, mask and pc,
4290 32 * 4 bytes for the general registers, 12 bytes for mdhi, mdlo, ownedfp
4291 and 32 * 4 bytes for the floating point registers. */
4292 e
->pdr
.regoffset
= 4 + 12 + 31 * 4;
4293 e
->pdr
.fregmask
= -1;
4294 /* Offset to saved f30 (first saved *double* register). */
4295 e
->pdr
.fregoffset
= 4 + 12 + 32 * 4 + 12 + 30 * 4;
4296 e
->pdr
.isym
= (long) s
;
4297 e
->pdr
.adr
= sigtramp_address
;
4299 current_objfile
= st
->objfile
; /* Keep new_symbol happy */
4300 s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
4301 SYMBOL_VALUE (s
) = (long) e
;
4302 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
4303 SYMBOL_CLASS (s
) = LOC_CONST
;
4304 SYMBOL_TYPE (s
) = mdebug_type_void
;
4305 current_objfile
= NULL
;
4308 BLOCK_SYM (b
, BLOCK_NSYMS (b
)++) = s
;
4311 #endif /* TM_MIPS_H */
4314 _initialize_mdebugread (void)
4317 init_type (TYPE_CODE_VOID
, 1,
4319 "void", (struct objfile
*) NULL
);
4321 init_type (TYPE_CODE_INT
, 1,
4323 "char", (struct objfile
*) NULL
);
4324 mdebug_type_unsigned_char
=
4325 init_type (TYPE_CODE_INT
, 1,
4327 "unsigned char", (struct objfile
*) NULL
);
4329 init_type (TYPE_CODE_INT
, 2,
4331 "short", (struct objfile
*) NULL
);
4332 mdebug_type_unsigned_short
=
4333 init_type (TYPE_CODE_INT
, 2,
4335 "unsigned short", (struct objfile
*) NULL
);
4336 mdebug_type_int_32
=
4337 init_type (TYPE_CODE_INT
, 4,
4339 "int", (struct objfile
*) NULL
);
4340 mdebug_type_unsigned_int_32
=
4341 init_type (TYPE_CODE_INT
, 4,
4343 "unsigned int", (struct objfile
*) NULL
);
4344 mdebug_type_int_64
=
4345 init_type (TYPE_CODE_INT
, 8,
4347 "int", (struct objfile
*) NULL
);
4348 mdebug_type_unsigned_int_64
=
4349 init_type (TYPE_CODE_INT
, 8,
4351 "unsigned int", (struct objfile
*) NULL
);
4352 mdebug_type_long_32
=
4353 init_type (TYPE_CODE_INT
, 4,
4355 "long", (struct objfile
*) NULL
);
4356 mdebug_type_unsigned_long_32
=
4357 init_type (TYPE_CODE_INT
, 4,
4359 "unsigned long", (struct objfile
*) NULL
);
4360 mdebug_type_long_64
=
4361 init_type (TYPE_CODE_INT
, 8,
4363 "long", (struct objfile
*) NULL
);
4364 mdebug_type_unsigned_long_64
=
4365 init_type (TYPE_CODE_INT
, 8,
4367 "unsigned long", (struct objfile
*) NULL
);
4368 mdebug_type_long_long_64
=
4369 init_type (TYPE_CODE_INT
, 8,
4371 "long long", (struct objfile
*) NULL
);
4372 mdebug_type_unsigned_long_long_64
=
4373 init_type (TYPE_CODE_INT
, 8,
4375 "unsigned long long", (struct objfile
*) NULL
);
4376 mdebug_type_adr_32
=
4377 init_type (TYPE_CODE_PTR
, 4,
4379 "adr_32", (struct objfile
*) NULL
);
4380 TYPE_TARGET_TYPE (mdebug_type_adr_32
) = mdebug_type_void
;
4381 mdebug_type_adr_64
=
4382 init_type (TYPE_CODE_PTR
, 8,
4384 "adr_64", (struct objfile
*) NULL
);
4385 TYPE_TARGET_TYPE (mdebug_type_adr_64
) = mdebug_type_void
;
4387 init_type (TYPE_CODE_FLT
, TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
4389 "float", (struct objfile
*) NULL
);
4390 mdebug_type_double
=
4391 init_type (TYPE_CODE_FLT
, TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
4393 "double", (struct objfile
*) NULL
);
4394 mdebug_type_complex
=
4395 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
4397 "complex", (struct objfile
*) NULL
);
4398 TYPE_TARGET_TYPE (mdebug_type_complex
) = mdebug_type_float
;
4399 mdebug_type_double_complex
=
4400 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
4402 "double complex", (struct objfile
*) NULL
);
4403 TYPE_TARGET_TYPE (mdebug_type_double_complex
) = mdebug_type_double
;
4405 /* Is a "string" the way btString means it the same as TYPE_CODE_STRING?
4407 mdebug_type_string
=
4408 init_type (TYPE_CODE_STRING
,
4409 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
4411 (struct objfile
*) NULL
);
4413 /* We use TYPE_CODE_INT to print these as integers. Does this do any
4414 good? Would we be better off with TYPE_CODE_ERROR? Should
4415 TYPE_CODE_ERROR print things in hex if it knows the size? */
4416 mdebug_type_fixed_dec
=
4417 init_type (TYPE_CODE_INT
,
4418 TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
4420 (struct objfile
*) NULL
);
4422 mdebug_type_float_dec
=
4423 init_type (TYPE_CODE_ERROR
,
4424 TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
4425 0, "floating decimal",
4426 (struct objfile
*) NULL
);
4428 nodebug_func_symbol_type
= init_type (TYPE_CODE_FUNC
, 1, 0,
4429 "<function, no debug info>", NULL
);
4430 TYPE_TARGET_TYPE (nodebug_func_symbol_type
) = mdebug_type_int
;
4431 nodebug_var_symbol_type
=
4432 init_type (TYPE_CODE_INT
, TARGET_INT_BIT
/ HOST_CHAR_BIT
, 0,
4433 "<variable, no debug info>", NULL
);