1 /* Read a symbol table in ECOFF format (Third-Eye).
2 Copyright 1986, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 1998
3 Free Software Foundation, Inc.
4 Original version contributed by Alessandro Forin (af@cs.cmu.edu) at
5 CMU. Major work by Per Bothner, John Gilmore and Ian Lance Taylor
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
25 /* This module provides the function mdebug_build_psymtabs. It reads
26 ECOFF debugging information into partial symbol tables. The
27 debugging information is read from two structures. A struct
28 ecoff_debug_swap includes the sizes of each ECOFF structure and
29 swapping routines; these are fixed for a particular target. A
30 struct ecoff_debug_info points to the debugging information for a
31 particular object file.
33 ECOFF symbol tables are mostly written in the byte order of the
34 target machine. However, one section of the table (the auxiliary
35 symbol information) is written in the host byte order. There is a
36 bit in the other symbol info which describes which host byte order
37 was used. ECOFF thereby takes the trophy from Intel `b.out' for
38 the most brain-dead adaptation of a file format to byte order.
40 This module can read all four of the known byte-order combinations,
41 on any type of host. */
51 #include "stabsread.h"
52 #include "complaints.h"
55 /* These are needed if the tm.h file does not contain the necessary
56 mips specific definitions. */
58 #ifndef MIPS_EFI_SYMBOL_NAME
59 #define MIPS_EFI_SYMBOL_NAME "__GDB_EFI_INFO__"
60 extern void ecoff_relocate_efi (struct symbol
*, CORE_ADDR
);
62 #include "coff/symconst.h"
63 typedef struct mips_extra_func_info
68 *mips_extra_func_info_t
;
75 #include <sys/types.h>
79 #include "gdb_string.h"
81 #include "gdb-stabs.h"
85 #include "coff/ecoff.h" /* COFF-like aspects of ecoff files */
87 #include "libaout.h" /* Private BFD a.out information. */
88 #include "aout/aout64.h"
89 #include "aout/stab_gnu.h" /* STABS information */
91 #include "expression.h"
92 #include "language.h" /* Needed inside partial-stab.h */
94 extern void _initialize_mdebugread (void);
96 /* Provide a default mapping from a ecoff register number to a gdb REGNUM. */
97 #ifndef ECOFF_REG_TO_REGNUM
98 #define ECOFF_REG_TO_REGNUM(num) (num)
101 /* Provide a way to test if we have both ECOFF and ELF symbol tables.
102 We use this define in order to know whether we should override a
103 symbol's ECOFF section with its ELF section. This is necessary in
104 case the symbol's ELF section could not be represented in ECOFF. */
105 #define ECOFF_IN_ELF(bfd) (bfd_get_flavour (bfd) == bfd_target_elf_flavour \
106 && bfd_get_section_by_name (bfd, ".mdebug") != NULL)
109 /* We put a pointer to this structure in the read_symtab_private field
114 /* Index of the FDR that this psymtab represents. */
116 /* The BFD that the psymtab was created from. */
118 const struct ecoff_debug_swap
*debug_swap
;
119 struct ecoff_debug_info
*debug_info
;
120 struct mdebug_pending
**pending_list
;
121 /* Pointer to external symbols for this file. */
123 /* Size of extern_tab. */
125 enum language pst_language
;
128 #define PST_PRIVATE(p) ((struct symloc *)(p)->read_symtab_private)
129 #define FDR_IDX(p) (PST_PRIVATE(p)->fdr_idx)
130 #define CUR_BFD(p) (PST_PRIVATE(p)->cur_bfd)
131 #define DEBUG_SWAP(p) (PST_PRIVATE(p)->debug_swap)
132 #define DEBUG_INFO(p) (PST_PRIVATE(p)->debug_info)
133 #define PENDING_LIST(p) (PST_PRIVATE(p)->pending_list)
135 #define SC_IS_TEXT(sc) ((sc) == scText \
136 || (sc) == scRConst \
139 #define SC_IS_DATA(sc) ((sc) == scData \
144 #define SC_IS_COMMON(sc) ((sc) == scCommon || (sc) == scSCommon)
145 #define SC_IS_BSS(sc) ((sc) == scBss || (sc) == scSBss)
146 #define SC_IS_UNDEF(sc) ((sc) == scUndefined || (sc) == scSUndefined)
149 /* Things we import explicitly from other modules */
151 extern int info_verbose
;
153 /* Various complaints about symbol reading that don't abort the process */
155 static struct complaint bad_file_number_complaint
=
156 {"bad file number %d", 0, 0};
158 static struct complaint index_complaint
=
159 {"bad aux index at symbol %s", 0, 0};
161 static struct complaint aux_index_complaint
=
162 {"bad proc end in aux found from symbol %s", 0, 0};
164 static struct complaint block_index_complaint
=
165 {"bad aux index at block symbol %s", 0, 0};
167 static struct complaint unknown_ext_complaint
=
168 {"unknown external symbol %s", 0, 0};
170 static struct complaint unknown_sym_complaint
=
171 {"unknown local symbol %s", 0, 0};
173 static struct complaint unknown_st_complaint
=
174 {"with type %d", 0, 0};
176 static struct complaint block_overflow_complaint
=
177 {"block containing %s overfilled", 0, 0};
179 static struct complaint basic_type_complaint
=
180 {"cannot map ECOFF basic type 0x%x for %s", 0, 0};
182 static struct complaint unknown_type_qual_complaint
=
183 {"unknown type qualifier 0x%x", 0, 0};
185 static struct complaint array_index_type_complaint
=
186 {"illegal array index type for %s, assuming int", 0, 0};
188 static struct complaint bad_tag_guess_complaint
=
189 {"guessed tag type of %s incorrectly", 0, 0};
191 static struct complaint block_member_complaint
=
192 {"declaration block contains unhandled symbol type %d", 0, 0};
194 static struct complaint stEnd_complaint
=
195 {"stEnd with storage class %d not handled", 0, 0};
197 static struct complaint unknown_mdebug_symtype_complaint
=
198 {"unknown symbol type 0x%x", 0, 0};
200 static struct complaint stab_unknown_complaint
=
201 {"unknown stabs symbol %s", 0, 0};
203 static struct complaint pdr_for_nonsymbol_complaint
=
204 {"PDR for %s, but no symbol", 0, 0};
206 static struct complaint pdr_static_symbol_complaint
=
207 {"can't handle PDR for static proc at 0x%lx", 0, 0};
209 static struct complaint bad_setjmp_pdr_complaint
=
210 {"fixing bad setjmp PDR from libc", 0, 0};
212 static struct complaint bad_fbitfield_complaint
=
213 {"can't handle TIR fBitfield for %s", 0, 0};
215 static struct complaint bad_continued_complaint
=
216 {"illegal TIR continued for %s", 0, 0};
218 static struct complaint bad_rfd_entry_complaint
=
219 {"bad rfd entry for %s: file %d, index %d", 0, 0};
221 static struct complaint unexpected_type_code_complaint
=
222 {"unexpected type code for %s", 0, 0};
224 static struct complaint unable_to_cross_ref_complaint
=
225 {"unable to cross ref btTypedef for %s", 0, 0};
227 static struct complaint bad_indirect_xref_complaint
=
228 {"unable to cross ref btIndirect for %s", 0, 0};
230 static struct complaint illegal_forward_tq0_complaint
=
231 {"illegal tq0 in forward typedef for %s", 0, 0};
233 static struct complaint illegal_forward_bt_complaint
=
234 {"illegal bt %d in forward typedef for %s", 0, 0};
236 static struct complaint bad_linetable_guess_complaint
=
237 {"guessed size of linetable for %s incorrectly", 0, 0};
239 static struct complaint bad_ext_ifd_complaint
=
240 {"bad ifd for external symbol: %d (max %d)", 0, 0};
242 static struct complaint bad_ext_iss_complaint
=
243 {"bad iss for external symbol: %ld (max %ld)", 0, 0};
245 /* Macros and extra defs */
247 /* Puns: hard to find whether -g was used and how */
249 #define MIN_GLEVEL GLEVEL_0
250 #define compare_glevel(a,b) \
251 (((a) == GLEVEL_3) ? ((b) < GLEVEL_3) : \
252 ((b) == GLEVEL_3) ? -1 : (int)((b) - (a)))
254 /* Things that really are local to this module */
256 /* Remember what we deduced to be the source language of this psymtab. */
258 static enum language psymtab_language
= language_unknown
;
264 /* How to parse debugging information for CUR_BFD. */
266 static const struct ecoff_debug_swap
*debug_swap
;
268 /* Pointers to debugging information for CUR_BFD. */
270 static struct ecoff_debug_info
*debug_info
;
272 /* Pointer to current file decriptor record, and its index */
277 /* Index of current symbol */
281 /* Note how much "debuggable" this image is. We would like
282 to see at least one FDR with full symbols */
284 static int max_gdbinfo
;
285 static int max_glevel
;
287 /* When examining .o files, report on undefined symbols */
289 static int n_undef_symbols
, n_undef_labels
, n_undef_vars
, n_undef_procs
;
291 /* Pseudo symbol to use when putting stabs into the symbol table. */
293 static char stabs_symbol
[] = STABS_SYMBOL
;
295 /* Types corresponding to mdebug format bt* basic types. */
297 static struct type
*mdebug_type_void
;
298 static struct type
*mdebug_type_char
;
299 static struct type
*mdebug_type_short
;
300 static struct type
*mdebug_type_int_32
;
301 #define mdebug_type_int mdebug_type_int_32
302 static struct type
*mdebug_type_int_64
;
303 static struct type
*mdebug_type_long_32
;
304 static struct type
*mdebug_type_long_64
;
305 static struct type
*mdebug_type_long_long_64
;
306 static struct type
*mdebug_type_unsigned_char
;
307 static struct type
*mdebug_type_unsigned_short
;
308 static struct type
*mdebug_type_unsigned_int_32
;
309 static struct type
*mdebug_type_unsigned_int_64
;
310 static struct type
*mdebug_type_unsigned_long_32
;
311 static struct type
*mdebug_type_unsigned_long_64
;
312 static struct type
*mdebug_type_unsigned_long_long_64
;
313 static struct type
*mdebug_type_adr_32
;
314 static struct type
*mdebug_type_adr_64
;
315 static struct type
*mdebug_type_float
;
316 static struct type
*mdebug_type_double
;
317 static struct type
*mdebug_type_complex
;
318 static struct type
*mdebug_type_double_complex
;
319 static struct type
*mdebug_type_fixed_dec
;
320 static struct type
*mdebug_type_float_dec
;
321 static struct type
*mdebug_type_string
;
323 /* Types for symbols from files compiled without debugging info. */
325 static struct type
*nodebug_func_symbol_type
;
326 static struct type
*nodebug_var_symbol_type
;
328 /* Nonzero if we have seen ecoff debugging info for a file. */
330 static int found_ecoff_debugging_info
;
332 /* Forward declarations */
334 static void add_pending (FDR
*, char *, struct type
*);
336 static struct mdebug_pending
*is_pending_symbol (FDR
*, char *);
338 static void pop_parse_stack (void);
340 static void push_parse_stack (void);
342 static char *fdr_name (FDR
*);
344 static void mdebug_psymtab_to_symtab (struct partial_symtab
*);
347 upgrade_type (int, struct type
**, int, union aux_ext
*, int, char *);
349 static void parse_partial_symbols (struct objfile
*);
351 static FDR
* get_rfd (int, int);
353 static int has_opaque_xref (FDR
*, SYMR
*);
356 cross_ref (int, union aux_ext
*, struct type
**, enum type_code
,
357 char **, int, char *);
359 static struct symbol
*new_symbol (char *);
361 static struct type
*new_type (char *);
363 static struct block
*new_block (int);
365 static struct symtab
*new_symtab (char *, int, int, struct objfile
*);
367 static struct linetable
*new_linetable (int);
369 static struct blockvector
*new_bvect (int);
372 parse_symbol (SYMR
*, union aux_ext
*, char *, int, struct section_offsets
*,
375 static struct type
*parse_type (int, union aux_ext
*, unsigned int, int *,
378 static struct symbol
*mylookup_symbol (char *, struct block
*, namespace_enum
,
381 static struct block
*shrink_block (struct block
*, struct symtab
*);
383 static PTR
xzalloc (unsigned int);
385 static void sort_blocks (struct symtab
*);
387 static int compare_blocks (const void *, const void *);
389 static struct partial_symtab
*new_psymtab (char *, struct objfile
*);
391 static void psymtab_to_symtab_1 (struct partial_symtab
*, char *);
393 static void add_block (struct block
*, struct symtab
*);
395 static void add_symbol (struct symbol
*, struct block
*);
397 static int add_line (struct linetable
*, int, CORE_ADDR
, int);
399 static struct linetable
*shrink_linetable (struct linetable
*);
402 handle_psymbol_enumerators (struct objfile
*, FDR
*, int, CORE_ADDR
);
404 static char *mdebug_next_symbol_text (struct objfile
*);
406 /* Address bounds for the signal trampoline in inferior, if any */
408 CORE_ADDR sigtramp_address
, sigtramp_end
;
410 /* Allocate zeroed memory */
413 xzalloc (unsigned int size
)
415 PTR p
= xmalloc (size
);
421 /* Exported procedure: Builds a symtab from the PST partial one.
422 Restores the environment in effect when PST was created, delegates
423 most of the work to an ancillary procedure, and sorts
424 and reorders the symtab list at the end */
427 mdebug_psymtab_to_symtab (struct partial_symtab
*pst
)
435 printf_filtered ("Reading in symbols for %s...", pst
->filename
);
436 gdb_flush (gdb_stdout
);
439 next_symbol_text_func
= mdebug_next_symbol_text
;
441 psymtab_to_symtab_1 (pst
, pst
->filename
);
443 /* Match with global symbols. This only needs to be done once,
444 after all of the symtabs and dependencies have been read in. */
445 scan_file_globals (pst
->objfile
);
448 printf_filtered ("done.\n");
451 /* File-level interface functions */
453 /* Find a file descriptor given its index RF relative to a file CF */
456 get_rfd (int cf
, int rf
)
462 fdrs
= debug_info
->fdr
;
464 /* Object files do not have the RFD table, all refs are absolute */
467 (*debug_swap
->swap_rfd_in
) (cur_bfd
,
468 ((char *) debug_info
->external_rfd
470 * debug_swap
->external_rfd_size
)),
475 /* Return a safer print NAME for a file descriptor */
481 return "<stripped file>";
484 return debug_info
->ss
+ f
->issBase
+ f
->rss
;
488 /* Read in and parse the symtab of the file OBJFILE. Symbols from
489 different sections are relocated via the SECTION_OFFSETS. */
492 mdebug_build_psymtabs (struct objfile
*objfile
,
493 const struct ecoff_debug_swap
*swap
,
494 struct ecoff_debug_info
*info
)
496 cur_bfd
= objfile
->obfd
;
500 /* Make sure all the FDR information is swapped in. */
501 if (info
->fdr
== (FDR
*) NULL
)
507 info
->fdr
= (FDR
*) obstack_alloc (&objfile
->psymbol_obstack
,
508 (info
->symbolic_header
.ifdMax
510 fdr_src
= info
->external_fdr
;
512 + info
->symbolic_header
.ifdMax
* swap
->external_fdr_size
);
514 for (; fdr_src
< fdr_end
; fdr_src
+= swap
->external_fdr_size
, fdr_ptr
++)
515 (*swap
->swap_fdr_in
) (objfile
->obfd
, fdr_src
, fdr_ptr
);
518 parse_partial_symbols (objfile
);
521 /* Check to make sure file was compiled with -g. If not, warn the
522 user of this limitation. */
523 if (compare_glevel (max_glevel
, GLEVEL_2
) < 0)
525 if (max_gdbinfo
== 0)
526 printf_unfiltered ("\n%s not compiled with -g, debugging support is limited.\n",
528 printf_unfiltered ("You should compile with -g2 or -g3 for best debugging support.\n");
529 gdb_flush (gdb_stdout
);
534 /* Local utilities */
536 /* Map of FDR indexes to partial symtabs */
540 struct partial_symtab
*pst
; /* the psymtab proper */
541 long n_globals
; /* exported globals (external symbols) */
542 long globals_offset
; /* cumulative */
546 /* Utility stack, used to nest procedures and blocks properly.
547 It is a doubly linked list, to avoid too many alloc/free.
548 Since we might need it quite a few times it is NOT deallocated
551 static struct parse_stack
553 struct parse_stack
*next
, *prev
;
554 struct symtab
*cur_st
; /* Current symtab. */
555 struct block
*cur_block
; /* Block in it. */
557 /* What are we parsing. stFile, or stBlock are for files and
558 blocks. stProc or stStaticProc means we have seen the start of a
559 procedure, but not the start of the block within in. When we see
560 the start of that block, we change it to stNil, without pushing a
561 new block, i.e. stNil means both a procedure and a block. */
565 int maxsyms
; /* Max symbols in this block. */
566 struct type
*cur_type
; /* Type we parse fields for. */
567 int cur_field
; /* Field number in cur_type. */
568 CORE_ADDR procadr
; /* Start addres of this procedure */
569 int numargs
; /* Its argument count */
572 *top_stack
; /* Top stack ptr */
575 /* Enter a new lexical context */
578 push_parse_stack (void)
580 struct parse_stack
*new;
582 /* Reuse frames if possible */
583 if (top_stack
&& top_stack
->prev
)
584 new = top_stack
->prev
;
586 new = (struct parse_stack
*) xzalloc (sizeof (struct parse_stack
));
587 /* Initialize new frame with previous content */
590 register struct parse_stack
*prev
= new->prev
;
593 top_stack
->prev
= new;
595 new->next
= top_stack
;
600 /* Exit a lexical context */
603 pop_parse_stack (void)
608 top_stack
= top_stack
->next
;
612 /* Cross-references might be to things we haven't looked at
613 yet, e.g. type references. To avoid too many type
614 duplications we keep a quick fixup table, an array
615 of lists of references indexed by file descriptor */
617 struct mdebug_pending
619 struct mdebug_pending
*next
; /* link */
620 char *s
; /* the unswapped symbol */
621 struct type
*t
; /* its partial type descriptor */
625 /* The pending information is kept for an entire object file, and used
626 to be in the sym_private field. I took it out when I split
627 mdebugread from mipsread, because this might not be the only type
628 of symbols read from an object file. Instead, we allocate the
629 pending information table when we create the partial symbols, and
630 we store a pointer to the single table in each psymtab. */
632 static struct mdebug_pending
**pending_list
;
634 /* Check whether we already saw symbol SH in file FH */
636 static struct mdebug_pending
*
637 is_pending_symbol (FDR
*fh
, char *sh
)
639 int f_idx
= fh
- debug_info
->fdr
;
640 register struct mdebug_pending
*p
;
642 /* Linear search is ok, list is typically no more than 10 deep */
643 for (p
= pending_list
[f_idx
]; p
; p
= p
->next
)
649 /* Add a new symbol SH of type T */
652 add_pending (FDR
*fh
, char *sh
, struct type
*t
)
654 int f_idx
= fh
- debug_info
->fdr
;
655 struct mdebug_pending
*p
= is_pending_symbol (fh
, sh
);
657 /* Make sure we do not make duplicates */
660 p
= ((struct mdebug_pending
*)
661 obstack_alloc (¤t_objfile
->psymbol_obstack
,
662 sizeof (struct mdebug_pending
)));
665 p
->next
= pending_list
[f_idx
];
666 pending_list
[f_idx
] = p
;
671 /* Parsing Routines proper. */
673 /* Parse a single symbol. Mostly just make up a GDB symbol for it.
674 For blocks, procedures and types we open a new lexical context.
675 This is basically just a big switch on the symbol's type. Argument
676 AX is the base pointer of aux symbols for this file (fh->iauxBase).
677 EXT_SH points to the unswapped symbol, which is needed for struct,
678 union, etc., types; it is NULL for an EXTR. BIGEND says whether
679 aux symbols are big-endian or little-endian. Return count of
680 SYMR's handled (normally one). */
683 parse_symbol (SYMR
*sh
, union aux_ext
*ax
, char *ext_sh
, int bigend
,
684 struct section_offsets
*section_offsets
, struct objfile
*objfile
)
686 const bfd_size_type external_sym_size
= debug_swap
->external_sym_size
;
687 void (*const swap_sym_in
) (bfd
*, PTR
, SYMR
*) = debug_swap
->swap_sym_in
;
691 struct mdebug_pending
*pend
;
695 enum address_class
class;
697 long svalue
= sh
->value
;
700 if (ext_sh
== (char *) NULL
)
701 name
= debug_info
->ssext
+ sh
->iss
;
703 name
= debug_info
->ss
+ cur_fdr
->issBase
+ sh
->iss
;
709 /* Do not relocate relative values.
710 The value of a stEnd symbol is the displacement from the
711 corresponding start symbol value.
712 The value of a stBlock symbol is the displacement from the
713 procedure address. */
714 if (sh
->st
!= stEnd
&& sh
->st
!= stBlock
)
715 sh
->value
+= ANOFFSET (section_offsets
, SECT_OFF_TEXT (objfile
));
722 sh
->value
+= ANOFFSET (section_offsets
, SECT_OFF_DATA (objfile
));
726 sh
->value
+= ANOFFSET (section_offsets
, SECT_OFF_BSS (objfile
));
735 case stGlobal
: /* external symbol, goes into global block */
737 b
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack
->cur_st
),
739 s
= new_symbol (name
);
740 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
743 case stStatic
: /* static data, goes into current block. */
745 b
= top_stack
->cur_block
;
746 s
= new_symbol (name
);
747 if (SC_IS_COMMON (sh
->sc
))
749 /* It is a FORTRAN common block. At least for SGI Fortran the
750 address is not in the symbol; we need to fix it later in
751 scan_file_globals. */
752 int bucket
= hashname (SYMBOL_NAME (s
));
753 SYMBOL_VALUE_CHAIN (s
) = global_sym_chain
[bucket
];
754 global_sym_chain
[bucket
] = s
;
757 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
760 case stLocal
: /* local variable, goes into current block */
761 if (sh
->sc
== scRegister
)
763 class = LOC_REGISTER
;
764 svalue
= ECOFF_REG_TO_REGNUM (svalue
);
768 b
= top_stack
->cur_block
;
769 s
= new_symbol (name
);
770 SYMBOL_VALUE (s
) = svalue
;
772 data
: /* Common code for symbols describing data */
773 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
774 SYMBOL_CLASS (s
) = class;
777 /* Type could be missing if file is compiled without debugging info. */
778 if (SC_IS_UNDEF (sh
->sc
)
779 || sh
->sc
== scNil
|| sh
->index
== indexNil
)
780 SYMBOL_TYPE (s
) = nodebug_var_symbol_type
;
782 SYMBOL_TYPE (s
) = parse_type (cur_fd
, ax
, sh
->index
, 0, bigend
, name
);
783 /* Value of a data symbol is its memory address */
786 case stParam
: /* arg to procedure, goes into current block */
788 found_ecoff_debugging_info
= 1;
789 top_stack
->numargs
++;
791 /* Special GNU C++ name. */
792 if (is_cplus_marker (name
[0]) && name
[1] == 't' && name
[2] == 0)
793 name
= "this"; /* FIXME, not alloc'd in obstack */
794 s
= new_symbol (name
);
796 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
800 /* Pass by value in register. */
801 SYMBOL_CLASS (s
) = LOC_REGPARM
;
802 svalue
= ECOFF_REG_TO_REGNUM (svalue
);
805 /* Pass by reference on stack. */
806 SYMBOL_CLASS (s
) = LOC_REF_ARG
;
809 /* Pass by reference in register. */
810 SYMBOL_CLASS (s
) = LOC_REGPARM_ADDR
;
811 svalue
= ECOFF_REG_TO_REGNUM (svalue
);
814 /* Pass by value on stack. */
815 SYMBOL_CLASS (s
) = LOC_ARG
;
818 SYMBOL_VALUE (s
) = svalue
;
819 SYMBOL_TYPE (s
) = parse_type (cur_fd
, ax
, sh
->index
, 0, bigend
, name
);
820 add_symbol (s
, top_stack
->cur_block
);
823 case stLabel
: /* label, goes into current block */
824 s
= new_symbol (name
);
825 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
; /* so that it can be used */
826 SYMBOL_CLASS (s
) = LOC_LABEL
; /* but not misused */
827 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
828 SYMBOL_TYPE (s
) = mdebug_type_int
;
829 add_symbol (s
, top_stack
->cur_block
);
832 case stProc
: /* Procedure, usually goes into global block */
833 case stStaticProc
: /* Static procedure, goes into current block */
834 s
= new_symbol (name
);
835 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
836 SYMBOL_CLASS (s
) = LOC_BLOCK
;
837 /* Type of the return value */
838 if (SC_IS_UNDEF (sh
->sc
) || sh
->sc
== scNil
)
842 t
= parse_type (cur_fd
, ax
, sh
->index
+ 1, 0, bigend
, name
);
843 if (STREQ (name
, "malloc") && t
->code
== TYPE_CODE_VOID
)
845 /* I don't know why, but, at least under Alpha GNU/Linux,
846 when linking against a malloc without debugging
847 symbols, its read as a function returning void---this
848 is bad because it means we cannot call functions with
849 string arguments interactively; i.e., "call
850 printf("howdy\n")" would fail with the error message
851 "program has no memory available". To avoid this, we
852 patch up the type and make it void*
853 instead. (davidm@azstarnet.com)
855 t
= make_pointer_type (t
, NULL
);
858 b
= top_stack
->cur_block
;
859 if (sh
->st
== stProc
)
861 struct blockvector
*bv
= BLOCKVECTOR (top_stack
->cur_st
);
862 /* The next test should normally be true, but provides a
863 hook for nested functions (which we don't want to make
865 if (b
== BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
))
866 b
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
867 /* Irix 5 sometimes has duplicate names for the same
868 function. We want to add such names up at the global
869 level, not as a nested function. */
870 else if (sh
->value
== top_stack
->procadr
)
871 b
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
875 /* Make a type for the procedure itself */
876 SYMBOL_TYPE (s
) = lookup_function_type (t
);
878 /* Create and enter a new lexical context */
879 b
= new_block (top_stack
->maxsyms
);
880 SYMBOL_BLOCK_VALUE (s
) = b
;
881 BLOCK_FUNCTION (b
) = s
;
882 BLOCK_START (b
) = BLOCK_END (b
) = sh
->value
;
883 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
884 add_block (b
, top_stack
->cur_st
);
886 /* Not if we only have partial info */
887 if (SC_IS_UNDEF (sh
->sc
) || sh
->sc
== scNil
)
891 top_stack
->cur_block
= b
;
892 top_stack
->blocktype
= sh
->st
;
893 top_stack
->cur_type
= SYMBOL_TYPE (s
);
894 top_stack
->cur_field
= -1;
895 top_stack
->procadr
= sh
->value
;
896 top_stack
->numargs
= 0;
899 /* Beginning of code for structure, union, and enum definitions.
900 They all share a common set of local variables, defined here. */
902 enum type_code type_code
;
908 case stStruct
: /* Start a block defining a struct type */
909 type_code
= TYPE_CODE_STRUCT
;
910 goto structured_common
;
912 case stUnion
: /* Start a block defining a union type */
913 type_code
= TYPE_CODE_UNION
;
914 goto structured_common
;
916 case stEnum
: /* Start a block defining an enum type */
917 type_code
= TYPE_CODE_ENUM
;
918 goto structured_common
;
920 case stBlock
: /* Either a lexical block, or some type */
921 if (sh
->sc
!= scInfo
&& !SC_IS_COMMON (sh
->sc
))
922 goto case_stBlock_code
; /* Lexical block */
924 type_code
= TYPE_CODE_UNDEF
; /* We have a type. */
926 /* Common code for handling struct, union, enum, and/or as-yet-
927 unknown-type blocks of info about structured data. `type_code'
928 has been set to the proper TYPE_CODE, if we know it. */
930 found_ecoff_debugging_info
= 1;
932 top_stack
->blocktype
= stBlock
;
934 /* First count the number of fields and the highest value. */
937 for (ext_tsym
= ext_sh
+ external_sym_size
;
939 ext_tsym
+= external_sym_size
)
943 (*swap_sym_in
) (cur_bfd
, ext_tsym
, &tsym
);
951 if (nfields
== 0 && type_code
== TYPE_CODE_UNDEF
)
953 /* If the type of the member is Nil (or Void),
954 without qualifiers, assume the tag is an
956 Alpha cc -migrate enums are recognized by a zero
957 index and a zero symbol value.
958 DU 4.0 cc enums are recognized by a member type of
959 btEnum without qualifiers and a zero symbol value. */
960 if (tsym
.index
== indexNil
961 || (tsym
.index
== 0 && sh
->value
== 0))
962 type_code
= TYPE_CODE_ENUM
;
965 (*debug_swap
->swap_tir_in
) (bigend
,
966 &ax
[tsym
.index
].a_ti
,
968 if ((tir
.bt
== btNil
|| tir
.bt
== btVoid
969 || (tir
.bt
== btEnum
&& sh
->value
== 0))
971 type_code
= TYPE_CODE_ENUM
;
975 if (tsym
.value
> max_value
)
976 max_value
= tsym
.value
;
985 /* This is a no-op; is it trying to tell us something
986 we should be checking? */
987 if (tsym
.sc
== scVariant
); /*UNIMPLEMENTED */
991 /* This is something like a struct within a
992 struct. Skip over the fields of the inner
993 struct. The -1 is because the for loop will
994 increment ext_tsym. */
995 ext_tsym
= ((char *) debug_info
->external_sym
996 + ((cur_fdr
->isymBase
+ tsym
.index
- 1)
997 * external_sym_size
));
1003 /* mips cc puts out a typedef for struct x if it is not yet
1004 defined when it encounters
1005 struct y { struct x *xp; };
1010 /* Irix5 cc puts out a stIndirect for struct x if it is not
1011 yet defined when it encounters
1012 struct y { struct x *xp; };
1017 complain (&block_member_complaint
, tsym
.st
);
1022 /* In an stBlock, there is no way to distinguish structs,
1023 unions, and enums at this point. This is a bug in the
1024 original design (that has been fixed with the recent
1025 addition of the stStruct, stUnion, and stEnum symbol
1026 types.) The way you can tell is if/when you see a variable
1027 or field of that type. In that case the variable's type
1028 (in the AUX table) says if the type is struct, union, or
1029 enum, and points back to the stBlock here. So you can
1030 patch the tag kind up later - but only if there actually is
1031 a variable or field of that type.
1033 So until we know for sure, we will guess at this point.
1035 If the first member has index==indexNil or a void type,
1036 assume we have an enumeration.
1037 Otherwise, if there is more than one member, and all
1038 the members have offset 0, assume we have a union.
1039 Otherwise, assume we have a struct.
1041 The heuristic could guess wrong in the case of of an
1042 enumeration with no members or a union with one (or zero)
1043 members, or when all except the last field of a struct have
1044 width zero. These are uncommon and/or illegal situations,
1045 and in any case guessing wrong probably doesn't matter
1048 But if we later do find out we were wrong, we fixup the tag
1049 kind. Members of an enumeration must be handled
1050 differently from struct/union fields, and that is harder to
1051 patch up, but luckily we shouldn't need to. (If there are
1052 any enumeration members, we can tell for sure it's an enum
1055 if (type_code
== TYPE_CODE_UNDEF
)
1057 if (nfields
> 1 && max_value
== 0)
1058 type_code
= TYPE_CODE_UNION
;
1060 type_code
= TYPE_CODE_STRUCT
;
1063 /* Create a new type or use the pending type. */
1064 pend
= is_pending_symbol (cur_fdr
, ext_sh
);
1065 if (pend
== (struct mdebug_pending
*) NULL
)
1067 t
= new_type (NULL
);
1068 add_pending (cur_fdr
, ext_sh
, t
);
1073 /* Do not set the tag name if it is a compiler generated tag name
1074 (.Fxx or .xxfake or empty) for unnamed struct/union/enums.
1075 Alpha cc puts out an sh->iss of zero for those. */
1076 if (sh
->iss
== 0 || name
[0] == '.' || name
[0] == '\0')
1077 TYPE_TAG_NAME (t
) = NULL
;
1079 TYPE_TAG_NAME (t
) = obconcat (¤t_objfile
->symbol_obstack
,
1082 TYPE_CODE (t
) = type_code
;
1083 TYPE_LENGTH (t
) = sh
->value
;
1084 TYPE_NFIELDS (t
) = nfields
;
1085 TYPE_FIELDS (t
) = f
= ((struct field
*)
1087 nfields
* sizeof (struct field
)));
1089 if (type_code
== TYPE_CODE_ENUM
)
1091 int unsigned_enum
= 1;
1093 /* This is a non-empty enum. */
1095 /* DEC c89 has the number of enumerators in the sh.value field,
1096 not the type length, so we have to compensate for that
1097 incompatibility quirk.
1098 This might do the wrong thing for an enum with one or two
1099 enumerators and gcc -gcoff -fshort-enums, but these cases
1100 are hopefully rare enough.
1101 Alpha cc -migrate has a sh.value field of zero, we adjust
1103 if (TYPE_LENGTH (t
) == TYPE_NFIELDS (t
)
1104 || TYPE_LENGTH (t
) == 0)
1105 TYPE_LENGTH (t
) = TARGET_INT_BIT
/ HOST_CHAR_BIT
;
1106 for (ext_tsym
= ext_sh
+ external_sym_size
;
1108 ext_tsym
+= external_sym_size
)
1111 struct symbol
*enum_sym
;
1113 (*swap_sym_in
) (cur_bfd
, ext_tsym
, &tsym
);
1115 if (tsym
.st
!= stMember
)
1118 FIELD_BITPOS (*f
) = tsym
.value
;
1119 FIELD_TYPE (*f
) = t
;
1120 FIELD_NAME (*f
) = debug_info
->ss
+ cur_fdr
->issBase
+ tsym
.iss
;
1121 FIELD_BITSIZE (*f
) = 0;
1123 enum_sym
= ((struct symbol
*)
1124 obstack_alloc (¤t_objfile
->symbol_obstack
,
1125 sizeof (struct symbol
)));
1126 memset ((PTR
) enum_sym
, 0, sizeof (struct symbol
));
1127 SYMBOL_NAME (enum_sym
) =
1128 obsavestring (f
->name
, strlen (f
->name
),
1129 ¤t_objfile
->symbol_obstack
);
1130 SYMBOL_CLASS (enum_sym
) = LOC_CONST
;
1131 SYMBOL_TYPE (enum_sym
) = t
;
1132 SYMBOL_NAMESPACE (enum_sym
) = VAR_NAMESPACE
;
1133 SYMBOL_VALUE (enum_sym
) = tsym
.value
;
1134 if (SYMBOL_VALUE (enum_sym
) < 0)
1136 add_symbol (enum_sym
, top_stack
->cur_block
);
1138 /* Skip the stMembers that we've handled. */
1143 TYPE_FLAGS (t
) |= TYPE_FLAG_UNSIGNED
;
1145 /* make this the current type */
1146 top_stack
->cur_type
= t
;
1147 top_stack
->cur_field
= 0;
1149 /* Do not create a symbol for alpha cc unnamed structs. */
1153 /* gcc puts out an empty struct for an opaque struct definitions,
1154 do not create a symbol for it either. */
1155 if (TYPE_NFIELDS (t
) == 0)
1157 TYPE_FLAGS (t
) |= TYPE_FLAG_STUB
;
1161 s
= new_symbol (name
);
1162 SYMBOL_NAMESPACE (s
) = STRUCT_NAMESPACE
;
1163 SYMBOL_CLASS (s
) = LOC_TYPEDEF
;
1164 SYMBOL_VALUE (s
) = 0;
1165 SYMBOL_TYPE (s
) = t
;
1166 add_symbol (s
, top_stack
->cur_block
);
1169 /* End of local variables shared by struct, union, enum, and
1170 block (as yet unknown struct/union/enum) processing. */
1174 found_ecoff_debugging_info
= 1;
1175 /* beginnning of (code) block. Value of symbol
1176 is the displacement from procedure start */
1177 push_parse_stack ();
1179 /* Do not start a new block if this is the outermost block of a
1180 procedure. This allows the LOC_BLOCK symbol to point to the
1181 block with the local variables, so funcname::var works. */
1182 if (top_stack
->blocktype
== stProc
1183 || top_stack
->blocktype
== stStaticProc
)
1185 top_stack
->blocktype
= stNil
;
1189 top_stack
->blocktype
= stBlock
;
1190 b
= new_block (top_stack
->maxsyms
);
1191 BLOCK_START (b
) = sh
->value
+ top_stack
->procadr
;
1192 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
1193 top_stack
->cur_block
= b
;
1194 add_block (b
, top_stack
->cur_st
);
1197 case stEnd
: /* end (of anything) */
1198 if (sh
->sc
== scInfo
|| SC_IS_COMMON (sh
->sc
))
1200 /* Finished with type */
1201 top_stack
->cur_type
= 0;
1203 else if (sh
->sc
== scText
&&
1204 (top_stack
->blocktype
== stProc
||
1205 top_stack
->blocktype
== stStaticProc
))
1207 /* Finished with procedure */
1208 struct blockvector
*bv
= BLOCKVECTOR (top_stack
->cur_st
);
1209 struct mips_extra_func_info
*e
;
1211 struct type
*ftype
= top_stack
->cur_type
;
1214 BLOCK_END (top_stack
->cur_block
) += sh
->value
; /* size */
1216 /* Make up special symbol to contain procedure specific info */
1217 s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
1218 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
1219 SYMBOL_CLASS (s
) = LOC_CONST
;
1220 SYMBOL_TYPE (s
) = mdebug_type_void
;
1221 e
= ((struct mips_extra_func_info
*)
1222 obstack_alloc (¤t_objfile
->symbol_obstack
,
1223 sizeof (struct mips_extra_func_info
)));
1224 memset ((PTR
) e
, 0, sizeof (struct mips_extra_func_info
));
1225 SYMBOL_VALUE (s
) = (long) e
;
1226 e
->numargs
= top_stack
->numargs
;
1227 e
->pdr
.framereg
= -1;
1228 add_symbol (s
, top_stack
->cur_block
);
1230 /* Reallocate symbols, saving memory */
1231 b
= shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
1233 /* f77 emits proc-level with address bounds==[0,0],
1234 So look for such child blocks, and patch them. */
1235 for (i
= 0; i
< BLOCKVECTOR_NBLOCKS (bv
); i
++)
1237 struct block
*b_bad
= BLOCKVECTOR_BLOCK (bv
, i
);
1238 if (BLOCK_SUPERBLOCK (b_bad
) == b
1239 && BLOCK_START (b_bad
) == top_stack
->procadr
1240 && BLOCK_END (b_bad
) == top_stack
->procadr
)
1242 BLOCK_START (b_bad
) = BLOCK_START (b
);
1243 BLOCK_END (b_bad
) = BLOCK_END (b
);
1247 if (TYPE_NFIELDS (ftype
) <= 0)
1249 /* No parameter type information is recorded with the function's
1250 type. Set that from the type of the parameter symbols. */
1251 int nparams
= top_stack
->numargs
;
1257 TYPE_NFIELDS (ftype
) = nparams
;
1258 TYPE_FIELDS (ftype
) = (struct field
*)
1259 TYPE_ALLOC (ftype
, nparams
* sizeof (struct field
));
1261 for (i
= iparams
= 0; iparams
< nparams
; i
++)
1263 sym
= BLOCK_SYM (b
, i
);
1264 switch (SYMBOL_CLASS (sym
))
1269 case LOC_REGPARM_ADDR
:
1270 TYPE_FIELD_TYPE (ftype
, iparams
) = SYMBOL_TYPE (sym
);
1280 else if (sh
->sc
== scText
&& top_stack
->blocktype
== stBlock
)
1282 /* End of (code) block. The value of the symbol is the
1283 displacement from the procedure`s start address of the
1284 end of this block. */
1285 BLOCK_END (top_stack
->cur_block
) = sh
->value
+ top_stack
->procadr
;
1286 shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
1288 else if (sh
->sc
== scText
&& top_stack
->blocktype
== stNil
)
1290 /* End of outermost block. Pop parse stack and ignore. The
1291 following stEnd of stProc will take care of the block. */
1294 else if (sh
->sc
== scText
&& top_stack
->blocktype
== stFile
)
1296 /* End of file. Pop parse stack and ignore. Higher
1297 level code deals with this. */
1301 complain (&stEnd_complaint
, sh
->sc
);
1303 pop_parse_stack (); /* restore previous lexical context */
1306 case stMember
: /* member of struct or union */
1307 f
= &TYPE_FIELDS (top_stack
->cur_type
)[top_stack
->cur_field
++];
1308 FIELD_NAME (*f
) = name
;
1309 FIELD_BITPOS (*f
) = sh
->value
;
1311 FIELD_TYPE (*f
) = parse_type (cur_fd
, ax
, sh
->index
, &bitsize
, bigend
, name
);
1312 FIELD_BITSIZE (*f
) = bitsize
;
1315 case stIndirect
: /* forward declaration on Irix5 */
1316 /* Forward declarations from Irix5 cc are handled by cross_ref,
1320 case stTypedef
: /* type definition */
1321 found_ecoff_debugging_info
= 1;
1323 /* Typedefs for forward declarations and opaque structs from alpha cc
1324 are handled by cross_ref, skip them. */
1328 /* Parse the type or use the pending type. */
1329 pend
= is_pending_symbol (cur_fdr
, ext_sh
);
1330 if (pend
== (struct mdebug_pending
*) NULL
)
1332 t
= parse_type (cur_fd
, ax
, sh
->index
, (int *) NULL
, bigend
, name
);
1333 add_pending (cur_fdr
, ext_sh
, t
);
1338 /* mips cc puts out a typedef with the name of the struct for forward
1339 declarations. These should not go into the symbol table and
1340 TYPE_NAME should not be set for them.
1341 They can't be distinguished from an intentional typedef to
1342 the same name however:
1344 struct x { int ix; int jx; };
1348 struct xx {int ixx; int jxx; };
1349 generates a cross referencing stTypedef for x and xx.
1350 The user visible effect of this is that the type of a pointer
1351 to struct foo sometimes is given as `foo *' instead of `struct foo *'.
1352 The problem is fixed with alpha cc and Irix5 cc. */
1354 /* However if the typedef cross references to an opaque aggregate, it
1355 is safe to omit it from the symbol table. */
1357 if (has_opaque_xref (cur_fdr
, sh
))
1359 s
= new_symbol (name
);
1360 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
1361 SYMBOL_CLASS (s
) = LOC_TYPEDEF
;
1362 SYMBOL_BLOCK_VALUE (s
) = top_stack
->cur_block
;
1363 SYMBOL_TYPE (s
) = t
;
1364 add_symbol (s
, top_stack
->cur_block
);
1366 /* Incomplete definitions of structs should not get a name. */
1367 if (TYPE_NAME (SYMBOL_TYPE (s
)) == NULL
1368 && (TYPE_NFIELDS (SYMBOL_TYPE (s
)) != 0
1369 || (TYPE_CODE (SYMBOL_TYPE (s
)) != TYPE_CODE_STRUCT
1370 && TYPE_CODE (SYMBOL_TYPE (s
)) != TYPE_CODE_UNION
)))
1372 if (TYPE_CODE (SYMBOL_TYPE (s
)) == TYPE_CODE_PTR
1373 || TYPE_CODE (SYMBOL_TYPE (s
)) == TYPE_CODE_FUNC
)
1375 /* If we are giving a name to a type such as "pointer to
1376 foo" or "function returning foo", we better not set
1377 the TYPE_NAME. If the program contains "typedef char
1378 *caddr_t;", we don't want all variables of type char
1379 * to print as caddr_t. This is not just a
1380 consequence of GDB's type management; CC and GCC (at
1381 least through version 2.4) both output variables of
1382 either type char * or caddr_t with the type
1383 refering to the stTypedef symbol for caddr_t. If a future
1384 compiler cleans this up it GDB is not ready for it
1385 yet, but if it becomes ready we somehow need to
1386 disable this check (without breaking the PCC/GCC2.4
1391 Fortunately, this check seems not to be necessary
1392 for anything except pointers or functions. */
1395 TYPE_NAME (SYMBOL_TYPE (s
)) = SYMBOL_NAME (s
);
1399 case stFile
: /* file name */
1400 push_parse_stack ();
1401 top_stack
->blocktype
= sh
->st
;
1404 /* I`ve never seen these for C */
1406 break; /* register relocation */
1408 break; /* forwarding address */
1410 break; /* constant */
1412 complain (&unknown_mdebug_symtype_complaint
, sh
->st
);
1419 /* Parse the type information provided in the raw AX entries for
1420 the symbol SH. Return the bitfield size in BS, in case.
1421 We must byte-swap the AX entries before we use them; BIGEND says whether
1422 they are big-endian or little-endian (from fh->fBigendian). */
1424 static struct type
*
1425 parse_type (int fd
, union aux_ext
*ax
, unsigned int aux_index
, int *bs
,
1426 int bigend
, char *sym_name
)
1428 /* Null entries in this map are treated specially */
1429 static struct type
**map_bt
[] =
1431 &mdebug_type_void
, /* btNil */
1432 &mdebug_type_adr_32
, /* btAdr */
1433 &mdebug_type_char
, /* btChar */
1434 &mdebug_type_unsigned_char
, /* btUChar */
1435 &mdebug_type_short
, /* btShort */
1436 &mdebug_type_unsigned_short
, /* btUShort */
1437 &mdebug_type_int_32
, /* btInt */
1438 &mdebug_type_unsigned_int_32
, /* btUInt */
1439 &mdebug_type_long_32
, /* btLong */
1440 &mdebug_type_unsigned_long_32
, /* btULong */
1441 &mdebug_type_float
, /* btFloat */
1442 &mdebug_type_double
, /* btDouble */
1449 &mdebug_type_complex
, /* btComplex */
1450 &mdebug_type_double_complex
, /* btDComplex */
1452 &mdebug_type_fixed_dec
, /* btFixedDec */
1453 &mdebug_type_float_dec
, /* btFloatDec */
1454 &mdebug_type_string
, /* btString */
1457 &mdebug_type_void
, /* btVoid */
1458 0, /* DEC C++: Pointer to member */
1459 0, /* DEC C++: Virtual function table */
1460 0, /* DEC C++: Class (Record) */
1461 &mdebug_type_long_64
, /* btLong64 */
1462 &mdebug_type_unsigned_long_64
, /* btULong64 */
1463 &mdebug_type_long_long_64
, /* btLongLong64 */
1464 &mdebug_type_unsigned_long_long_64
, /* btULongLong64 */
1465 &mdebug_type_adr_64
, /* btAdr64 */
1466 &mdebug_type_int_64
, /* btInt64 */
1467 &mdebug_type_unsigned_int_64
, /* btUInt64 */
1471 struct type
*tp
= 0;
1472 enum type_code type_code
= TYPE_CODE_UNDEF
;
1474 /* Handle undefined types, they have indexNil. */
1475 if (aux_index
== indexNil
)
1476 return mdebug_type_int
;
1478 /* Handle corrupt aux indices. */
1479 if (aux_index
>= (debug_info
->fdr
+ fd
)->caux
)
1481 complain (&index_complaint
, sym_name
);
1482 return mdebug_type_int
;
1486 /* Use aux as a type information record, map its basic type. */
1487 (*debug_swap
->swap_tir_in
) (bigend
, &ax
->a_ti
, t
);
1488 if (t
->bt
>= (sizeof (map_bt
) / sizeof (*map_bt
)))
1490 complain (&basic_type_complaint
, t
->bt
, sym_name
);
1491 return mdebug_type_int
;
1495 tp
= *map_bt
[t
->bt
];
1500 /* Cannot use builtin types -- build our own */
1504 type_code
= TYPE_CODE_STRUCT
;
1507 type_code
= TYPE_CODE_UNION
;
1510 type_code
= TYPE_CODE_ENUM
;
1513 type_code
= TYPE_CODE_RANGE
;
1516 type_code
= TYPE_CODE_SET
;
1519 /* alpha cc -migrate uses this for typedefs. The true type will
1520 be obtained by crossreferencing below. */
1521 type_code
= TYPE_CODE_ERROR
;
1524 /* alpha cc uses this for typedefs. The true type will be
1525 obtained by crossreferencing below. */
1526 type_code
= TYPE_CODE_ERROR
;
1529 complain (&basic_type_complaint
, t
->bt
, sym_name
);
1530 return mdebug_type_int
;
1534 /* Move on to next aux */
1539 int width
= AUX_GET_WIDTH (bigend
, ax
);
1541 /* Inhibit core dumps with some cfront generated objects that
1543 if (bs
== (int *) NULL
)
1545 /* Alpha cc -migrate encodes char and unsigned char types
1546 as short and unsigned short types with a field width of 8.
1547 Enum types also have a field width which we ignore for now. */
1548 if (t
->bt
== btShort
&& width
== 8)
1549 tp
= mdebug_type_char
;
1550 else if (t
->bt
== btUShort
&& width
== 8)
1551 tp
= mdebug_type_unsigned_char
;
1552 else if (t
->bt
== btEnum
)
1555 complain (&bad_fbitfield_complaint
, sym_name
);
1562 /* A btIndirect entry cross references to an aux entry containing
1564 if (t
->bt
== btIndirect
)
1571 (*debug_swap
->swap_rndx_in
) (bigend
, &ax
->a_rndx
, rn
);
1573 if (rn
->rfd
== 0xfff)
1575 rf
= AUX_GET_ISYM (bigend
, ax
);
1583 complain (&bad_indirect_xref_complaint
, sym_name
);
1584 return mdebug_type_int
;
1586 xref_fh
= get_rfd (fd
, rf
);
1587 xref_fd
= xref_fh
- debug_info
->fdr
;
1588 tp
= parse_type (xref_fd
, debug_info
->external_aux
+ xref_fh
->iauxBase
,
1589 rn
->index
, (int *) NULL
, xref_fh
->fBigendian
, sym_name
);
1592 /* All these types really point to some (common) MIPS type
1593 definition, and only the type-qualifiers fully identify
1594 them. We'll make the same effort at sharing. */
1595 if (t
->bt
== btStruct
||
1599 /* btSet (I think) implies that the name is a tag name, not a typedef
1600 name. This apparently is a MIPS extension for C sets. */
1605 /* Try to cross reference this type, build new type on failure. */
1606 ax
+= cross_ref (fd
, ax
, &tp
, type_code
, &name
, bigend
, sym_name
);
1607 if (tp
== (struct type
*) NULL
)
1608 tp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
1610 /* DEC c89 produces cross references to qualified aggregate types,
1611 dereference them. */
1612 while (TYPE_CODE (tp
) == TYPE_CODE_PTR
1613 || TYPE_CODE (tp
) == TYPE_CODE_ARRAY
)
1614 tp
= tp
->target_type
;
1616 /* Make sure that TYPE_CODE(tp) has an expected type code.
1617 Any type may be returned from cross_ref if file indirect entries
1619 if (TYPE_CODE (tp
) != TYPE_CODE_STRUCT
1620 && TYPE_CODE (tp
) != TYPE_CODE_UNION
1621 && TYPE_CODE (tp
) != TYPE_CODE_ENUM
)
1623 complain (&unexpected_type_code_complaint
, sym_name
);
1628 /* Usually, TYPE_CODE(tp) is already type_code. The main
1629 exception is if we guessed wrong re struct/union/enum.
1630 But for struct vs. union a wrong guess is harmless, so
1631 don't complain(). */
1632 if ((TYPE_CODE (tp
) == TYPE_CODE_ENUM
1633 && type_code
!= TYPE_CODE_ENUM
)
1634 || (TYPE_CODE (tp
) != TYPE_CODE_ENUM
1635 && type_code
== TYPE_CODE_ENUM
))
1637 complain (&bad_tag_guess_complaint
, sym_name
);
1640 if (TYPE_CODE (tp
) != type_code
)
1642 TYPE_CODE (tp
) = type_code
;
1645 /* Do not set the tag name if it is a compiler generated tag name
1646 (.Fxx or .xxfake or empty) for unnamed struct/union/enums. */
1647 if (name
[0] == '.' || name
[0] == '\0')
1648 TYPE_TAG_NAME (tp
) = NULL
;
1649 else if (TYPE_TAG_NAME (tp
) == NULL
1650 || !STREQ (TYPE_TAG_NAME (tp
), name
))
1651 TYPE_TAG_NAME (tp
) = obsavestring (name
, strlen (name
),
1652 ¤t_objfile
->type_obstack
);
1656 /* All these types really point to some (common) MIPS type
1657 definition, and only the type-qualifiers fully identify
1658 them. We'll make the same effort at sharing.
1659 FIXME: We are not doing any guessing on range types. */
1660 if (t
->bt
== btRange
)
1664 /* Try to cross reference this type, build new type on failure. */
1665 ax
+= cross_ref (fd
, ax
, &tp
, type_code
, &name
, bigend
, sym_name
);
1666 if (tp
== (struct type
*) NULL
)
1667 tp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
1669 /* Make sure that TYPE_CODE(tp) has an expected type code.
1670 Any type may be returned from cross_ref if file indirect entries
1672 if (TYPE_CODE (tp
) != TYPE_CODE_RANGE
)
1674 complain (&unexpected_type_code_complaint
, sym_name
);
1678 /* Usually, TYPE_CODE(tp) is already type_code. The main
1679 exception is if we guessed wrong re struct/union/enum. */
1680 if (TYPE_CODE (tp
) != type_code
)
1682 complain (&bad_tag_guess_complaint
, sym_name
);
1683 TYPE_CODE (tp
) = type_code
;
1685 if (TYPE_NAME (tp
) == NULL
|| !STREQ (TYPE_NAME (tp
), name
))
1686 TYPE_NAME (tp
) = obsavestring (name
, strlen (name
),
1687 ¤t_objfile
->type_obstack
);
1690 if (t
->bt
== btTypedef
)
1694 /* Try to cross reference this type, it should succeed. */
1695 ax
+= cross_ref (fd
, ax
, &tp
, type_code
, &name
, bigend
, sym_name
);
1696 if (tp
== (struct type
*) NULL
)
1698 complain (&unable_to_cross_ref_complaint
, sym_name
);
1699 tp
= mdebug_type_int
;
1703 /* Deal with range types */
1704 if (t
->bt
== btRange
)
1706 TYPE_NFIELDS (tp
) = 2;
1707 TYPE_FIELDS (tp
) = ((struct field
*)
1708 TYPE_ALLOC (tp
, 2 * sizeof (struct field
)));
1709 TYPE_FIELD_NAME (tp
, 0) = obsavestring ("Low", strlen ("Low"),
1710 ¤t_objfile
->type_obstack
);
1711 TYPE_FIELD_BITPOS (tp
, 0) = AUX_GET_DNLOW (bigend
, ax
);
1713 TYPE_FIELD_NAME (tp
, 1) = obsavestring ("High", strlen ("High"),
1714 ¤t_objfile
->type_obstack
);
1715 TYPE_FIELD_BITPOS (tp
, 1) = AUX_GET_DNHIGH (bigend
, ax
);
1719 /* Parse all the type qualifiers now. If there are more
1720 than 6 the game will continue in the next aux */
1724 #define PARSE_TQ(tq) \
1725 if (t->tq != tqNil) \
1726 ax += upgrade_type(fd, &tp, t->tq, ax, bigend, sym_name); \
1738 /* mips cc 2.x and gcc never put out continued aux entries. */
1742 (*debug_swap
->swap_tir_in
) (bigend
, &ax
->a_ti
, t
);
1746 /* Complain for illegal continuations due to corrupt aux entries. */
1748 complain (&bad_continued_complaint
, sym_name
);
1753 /* Make up a complex type from a basic one. Type is passed by
1754 reference in TPP and side-effected as necessary. The type
1755 qualifier TQ says how to handle the aux symbols at AX for
1756 the symbol SX we are currently analyzing. BIGEND says whether
1757 aux symbols are big-endian or little-endian.
1758 Returns the number of aux symbols we parsed. */
1761 upgrade_type (int fd
, struct type
**tpp
, int tq
, union aux_ext
*ax
, int bigend
,
1767 /* Used in array processing */
1778 t
= lookup_pointer_type (*tpp
);
1783 t
= lookup_function_type (*tpp
);
1790 /* Determine and record the domain type (type of index) */
1791 (*debug_swap
->swap_rndx_in
) (bigend
, &ax
->a_rndx
, &rndx
);
1797 rf
= AUX_GET_ISYM (bigend
, ax
);
1800 fh
= get_rfd (fd
, rf
);
1802 indx
= parse_type (fh
- debug_info
->fdr
,
1803 debug_info
->external_aux
+ fh
->iauxBase
,
1804 id
, (int *) NULL
, bigend
, sym_name
);
1806 /* The bounds type should be an integer type, but might be anything
1807 else due to corrupt aux entries. */
1808 if (TYPE_CODE (indx
) != TYPE_CODE_INT
)
1810 complain (&array_index_type_complaint
, sym_name
);
1811 indx
= mdebug_type_int
;
1814 /* Get the bounds, and create the array type. */
1816 lower
= AUX_GET_DNLOW (bigend
, ax
);
1818 upper
= AUX_GET_DNHIGH (bigend
, ax
);
1820 rf
= AUX_GET_WIDTH (bigend
, ax
); /* bit size of array element */
1822 range
= create_range_type ((struct type
*) NULL
, indx
,
1825 t
= create_array_type ((struct type
*) NULL
, *tpp
, range
);
1827 /* We used to fill in the supplied array element bitsize
1828 here if the TYPE_LENGTH of the target type was zero.
1829 This happens for a `pointer to an array of anonymous structs',
1830 but in this case the array element bitsize is also zero,
1831 so nothing is gained.
1832 And we used to check the TYPE_LENGTH of the target type against
1833 the supplied array element bitsize.
1834 gcc causes a mismatch for `pointer to array of object',
1835 since the sdb directives it uses do not have a way of
1836 specifying the bitsize, but it does no harm (the
1837 TYPE_LENGTH should be correct) and we should be able to
1838 ignore the erroneous bitsize from the auxiliary entry safely.
1839 dbx seems to ignore it too. */
1841 /* TYPE_FLAG_TARGET_STUB now takes care of the zero TYPE_LENGTH
1843 if (TYPE_LENGTH (*tpp
) == 0)
1845 TYPE_FLAGS (t
) |= TYPE_FLAG_TARGET_STUB
;
1852 /* Volatile -- currently ignored */
1856 /* Const -- currently ignored */
1860 complain (&unknown_type_qual_complaint
, tq
);
1866 /* Parse a procedure descriptor record PR. Note that the procedure is
1867 parsed _after_ the local symbols, now we just insert the extra
1868 information we need into a MIPS_EFI_SYMBOL_NAME symbol that has
1869 already been placed in the procedure's main block. Note also that
1870 images that have been partially stripped (ld -x) have been deprived
1871 of local symbols, and we have to cope with them here. FIRST_OFF is
1872 the offset of the first procedure for this FDR; we adjust the
1873 address by this amount, but I don't know why. SEARCH_SYMTAB is the symtab
1874 to look for the function which contains the MIPS_EFI_SYMBOL_NAME symbol
1875 in question, or NULL to use top_stack->cur_block. */
1877 static void parse_procedure (PDR
*, struct symtab
*, struct partial_symtab
*);
1880 parse_procedure (PDR
*pr
, struct symtab
*search_symtab
,
1881 struct partial_symtab
*pst
)
1883 struct symbol
*s
, *i
;
1885 struct mips_extra_func_info
*e
;
1888 /* Simple rule to find files linked "-x" */
1889 if (cur_fdr
->rss
== -1)
1893 /* Static procedure at address pr->adr. Sigh. */
1894 /* FIXME-32x64. assuming pr->adr fits in long. */
1895 complain (&pdr_static_symbol_complaint
, (unsigned long) pr
->adr
);
1903 (*debug_swap
->swap_ext_in
) (cur_bfd
,
1904 ((char *) debug_info
->external_ext
1906 * debug_swap
->external_ext_size
)),
1908 sh_name
= debug_info
->ssext
+ she
.asym
.iss
;
1916 (*debug_swap
->swap_sym_in
) (cur_bfd
,
1917 ((char *) debug_info
->external_sym
1918 + ((cur_fdr
->isymBase
+ pr
->isym
)
1919 * debug_swap
->external_sym_size
)),
1921 sh_name
= debug_info
->ss
+ cur_fdr
->issBase
+ sh
.iss
;
1924 if (search_symtab
!= NULL
)
1927 /* This loses both in the case mentioned (want a static, find a global),
1928 but also if we are looking up a non-mangled name which happens to
1929 match the name of a mangled function. */
1930 /* We have to save the cur_fdr across the call to lookup_symbol.
1931 If the pdr is for a static function and if a global function with
1932 the same name exists, lookup_symbol will eventually read in the symtab
1933 for the global function and clobber cur_fdr. */
1934 FDR
*save_cur_fdr
= cur_fdr
;
1935 s
= lookup_symbol (sh_name
, NULL
, VAR_NAMESPACE
, 0, NULL
);
1936 cur_fdr
= save_cur_fdr
;
1940 BLOCKVECTOR_BLOCK (BLOCKVECTOR (search_symtab
), STATIC_BLOCK
),
1946 s
= mylookup_symbol (sh_name
, top_stack
->cur_block
,
1947 VAR_NAMESPACE
, LOC_BLOCK
);
1951 b
= SYMBOL_BLOCK_VALUE (s
);
1955 complain (&pdr_for_nonsymbol_complaint
, sh_name
);
1959 /* FIXME -- delete. We can't do symbol allocation now; it's all done. */
1960 s
= new_symbol (sh_name
);
1961 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
1962 SYMBOL_CLASS (s
) = LOC_BLOCK
;
1963 /* Donno its type, hope int is ok */
1964 SYMBOL_TYPE (s
) = lookup_function_type (mdebug_type_int
);
1965 add_symbol (s
, top_stack
->cur_block
);
1966 /* Wont have symbols for this one */
1968 SYMBOL_BLOCK_VALUE (s
) = b
;
1969 BLOCK_FUNCTION (b
) = s
;
1970 BLOCK_START (b
) = pr
->adr
;
1971 /* BOUND used to be the end of procedure's text, but the
1972 argument is no longer passed in. */
1973 BLOCK_END (b
) = bound
;
1974 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
1975 add_block (b
, top_stack
->cur_st
);
1979 i
= mylookup_symbol (MIPS_EFI_SYMBOL_NAME
, b
, LABEL_NAMESPACE
, LOC_CONST
);
1983 e
= (struct mips_extra_func_info
*) SYMBOL_VALUE (i
);
1985 e
->pdr
.isym
= (long) s
;
1987 /* GDB expects the absolute function start address for the
1988 procedure descriptor in e->pdr.adr.
1989 As the address in the procedure descriptor is usually relative,
1990 we would have to relocate e->pdr.adr with cur_fdr->adr and
1991 ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (pst->objfile)).
1992 Unfortunately cur_fdr->adr and e->pdr.adr are both absolute
1993 in shared libraries on some systems, and on other systems
1994 e->pdr.adr is sometimes offset by a bogus value.
1995 To work around these problems, we replace e->pdr.adr with
1996 the start address of the function. */
1997 e
->pdr
.adr
= BLOCK_START (b
);
1999 /* Correct incorrect setjmp procedure descriptor from the library
2000 to make backtrace through setjmp work. */
2001 if (e
->pdr
.pcreg
== 0 && STREQ (sh_name
, "setjmp"))
2003 complain (&bad_setjmp_pdr_complaint
, 0);
2004 e
->pdr
.pcreg
= RA_REGNUM
;
2005 e
->pdr
.regmask
= 0x80000000;
2006 e
->pdr
.regoffset
= -4;
2010 /* It would be reasonable that functions that have been compiled
2011 without debugging info have a btNil type for their return value,
2012 and functions that are void and are compiled with debugging info
2014 gcc and DEC f77 put out btNil types for both cases, so btNil is mapped
2015 to TYPE_CODE_VOID in parse_type to get the `compiled with debugging info'
2017 The glevel field in cur_fdr could be used to determine the presence
2018 of debugging info, but GCC doesn't always pass the -g switch settings
2019 to the assembler and GAS doesn't set the glevel field from the -g switch
2021 To work around these problems, the return value type of a TYPE_CODE_VOID
2022 function is adjusted accordingly if no debugging info was found in the
2023 compilation unit. */
2025 if (processing_gcc_compilation
== 0
2026 && found_ecoff_debugging_info
== 0
2027 && TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (s
))) == TYPE_CODE_VOID
)
2028 SYMBOL_TYPE (s
) = nodebug_func_symbol_type
;
2031 /* Relocate the extra function info pointed to by the symbol table. */
2034 ecoff_relocate_efi (struct symbol
*sym
, CORE_ADDR delta
)
2036 struct mips_extra_func_info
*e
;
2038 e
= (struct mips_extra_func_info
*) SYMBOL_VALUE (sym
);
2040 e
->pdr
.adr
+= delta
;
2043 /* Parse the external symbol ES. Just call parse_symbol() after
2044 making sure we know where the aux are for it.
2045 BIGEND says whether aux entries are big-endian or little-endian.
2047 This routine clobbers top_stack->cur_block and ->cur_st. */
2049 static void parse_external (EXTR
*, int, struct section_offsets
*,
2053 parse_external (EXTR
*es
, int bigend
, struct section_offsets
*section_offsets
,
2054 struct objfile
*objfile
)
2058 if (es
->ifd
!= ifdNil
)
2061 cur_fdr
= debug_info
->fdr
+ cur_fd
;
2062 ax
= debug_info
->external_aux
+ cur_fdr
->iauxBase
;
2066 cur_fdr
= debug_info
->fdr
;
2070 /* Reading .o files */
2071 if (SC_IS_UNDEF (es
->asym
.sc
) || es
->asym
.sc
== scNil
)
2074 switch (es
->asym
.st
)
2077 /* These are generated for static symbols in .o files,
2098 /* FIXME: Turn this into a complaint? */
2100 printf_filtered ("Warning: %s `%s' is undefined (in %s)\n",
2101 what
, debug_info
->ssext
+ es
->asym
.iss
,
2102 fdr_name (cur_fdr
));
2106 switch (es
->asym
.st
)
2110 /* There is no need to parse the external procedure symbols.
2111 If they are from objects compiled without -g, their index will
2112 be indexNil, and the symbol definition from the minimal symbol
2113 is preferrable (yielding a function returning int instead of int).
2114 If the index points to a local procedure symbol, the local
2115 symbol already provides the correct type.
2116 Note that the index of the external procedure symbol points
2117 to the local procedure symbol in the local symbol table, and
2118 _not_ to the auxiliary symbol info. */
2122 /* Global common symbols are resolved by the runtime loader,
2124 if (SC_IS_COMMON (es
->asym
.sc
))
2127 /* Note that the case of a symbol with indexNil must be handled
2128 anyways by parse_symbol(). */
2129 parse_symbol (&es
->asym
, ax
, (char *) NULL
, bigend
, section_offsets
, objfile
);
2136 /* Parse the line number info for file descriptor FH into
2137 GDB's linetable LT. MIPS' encoding requires a little bit
2138 of magic to get things out. Note also that MIPS' line
2139 numbers can go back and forth, apparently we can live
2140 with that and do not need to reorder our linetables */
2142 static void parse_lines (FDR
*, PDR
*, struct linetable
*, int,
2143 struct partial_symtab
*, CORE_ADDR
);
2146 parse_lines (FDR
*fh
, PDR
*pr
, struct linetable
*lt
, int maxlines
,
2147 struct partial_symtab
*pst
, CORE_ADDR lowest_pdr_addr
)
2149 unsigned char *base
;
2151 int delta
, count
, lineno
= 0;
2153 if (fh
->cbLine
== 0)
2156 /* Scan by procedure descriptors */
2158 for (j
= 0; j
< fh
->cpd
; j
++, pr
++)
2162 unsigned char *halt
;
2164 /* No code for this one */
2165 if (pr
->iline
== ilineNil
||
2166 pr
->lnLow
== -1 || pr
->lnHigh
== -1)
2169 /* Determine start and end address of compressed line bytes for
2171 base
= debug_info
->line
+ fh
->cbLineOffset
;
2172 if (j
!= (fh
->cpd
- 1))
2173 halt
= base
+ pr
[1].cbLineOffset
;
2175 halt
= base
+ fh
->cbLine
;
2176 base
+= pr
->cbLineOffset
;
2178 adr
= pst
->textlow
+ pr
->adr
- lowest_pdr_addr
;
2180 l
= adr
>> 2; /* in words */
2181 for (lineno
= pr
->lnLow
; base
< halt
;)
2183 count
= *base
& 0x0f;
2184 delta
= *base
++ >> 4;
2189 delta
= (base
[0] << 8) | base
[1];
2190 if (delta
>= 0x8000)
2194 lineno
+= delta
; /* first delta is 0 */
2196 /* Complain if the line table overflows. Could happen
2197 with corrupt binaries. */
2198 if (lt
->nitems
>= maxlines
)
2200 complain (&bad_linetable_guess_complaint
, fdr_name (fh
));
2203 k
= add_line (lt
, lineno
, l
, k
);
2209 /* Master parsing procedure for first-pass reading of file symbols
2210 into a partial_symtab. */
2213 parse_partial_symbols (struct objfile
*objfile
)
2215 const bfd_size_type external_sym_size
= debug_swap
->external_sym_size
;
2216 const bfd_size_type external_rfd_size
= debug_swap
->external_rfd_size
;
2217 const bfd_size_type external_ext_size
= debug_swap
->external_ext_size
;
2218 void (*const swap_ext_in
) (bfd
*, PTR
, EXTR
*) = debug_swap
->swap_ext_in
;
2219 void (*const swap_sym_in
) (bfd
*, PTR
, SYMR
*) = debug_swap
->swap_sym_in
;
2220 void (*const swap_rfd_in
) (bfd
*, PTR
, RFDT
*) = debug_swap
->swap_rfd_in
;
2222 HDRR
*hdr
= &debug_info
->symbolic_header
;
2223 /* Running pointers */
2228 register EXTR
*ext_in
;
2231 struct partial_symtab
*pst
;
2232 int textlow_not_set
= 1;
2233 int past_first_source_file
= 0;
2235 /* List of current psymtab's include files */
2236 char **psymtab_include_list
;
2237 int includes_allocated
;
2240 struct pst_map
*fdr_to_pst
;
2241 /* Index within current psymtab dependency list */
2242 struct partial_symtab
**dependency_list
;
2243 int dependencies_used
, dependencies_allocated
;
2244 struct cleanup
*old_chain
;
2246 enum language prev_language
;
2247 asection
*text_sect
;
2248 int relocatable
= 0;
2250 /* Irix 5.2 shared libraries have a fh->adr field of zero, but
2251 the shared libraries are prelinked at a high memory address.
2252 We have to adjust the start address of the object file for this case,
2253 by setting it to the start address of the first procedure in the file.
2254 But we should do no adjustments if we are debugging a .o file, where
2255 the text section (and fh->adr) really starts at zero. */
2256 text_sect
= bfd_get_section_by_name (cur_bfd
, ".text");
2257 if (text_sect
!= NULL
2258 && (bfd_get_section_flags (cur_bfd
, text_sect
) & SEC_RELOC
))
2261 extern_tab
= (EXTR
*) obstack_alloc (&objfile
->psymbol_obstack
,
2262 sizeof (EXTR
) * hdr
->iextMax
);
2264 includes_allocated
= 30;
2266 psymtab_include_list
= (char **) alloca (includes_allocated
*
2268 next_symbol_text_func
= mdebug_next_symbol_text
;
2270 dependencies_allocated
= 30;
2271 dependencies_used
= 0;
2273 (struct partial_symtab
**) alloca (dependencies_allocated
*
2274 sizeof (struct partial_symtab
*));
2276 last_source_file
= NULL
;
2281 * Only parse the Local and External symbols, and the Relative FDR.
2282 * Fixup enough of the loader symtab to be able to use it.
2283 * Allocate space only for the file's portions we need to
2288 max_glevel
= MIN_GLEVEL
;
2290 /* Allocate the map FDR -> PST.
2291 Minor hack: -O3 images might claim some global data belongs
2292 to FDR -1. We`ll go along with that */
2293 fdr_to_pst
= (struct pst_map
*) xzalloc ((hdr
->ifdMax
+ 1) * sizeof *fdr_to_pst
);
2294 old_chain
= make_cleanup (free
, fdr_to_pst
);
2297 struct partial_symtab
*pst
= new_psymtab ("", objfile
);
2298 fdr_to_pst
[-1].pst
= pst
;
2302 /* Allocate the global pending list. */
2304 ((struct mdebug_pending
**)
2305 obstack_alloc (&objfile
->psymbol_obstack
,
2306 hdr
->ifdMax
* sizeof (struct mdebug_pending
*)));
2307 memset ((PTR
) pending_list
, 0,
2308 hdr
->ifdMax
* sizeof (struct mdebug_pending
*));
2310 /* Pass 0 over external syms: swap them in. */
2311 ext_block
= (EXTR
*) xmalloc (hdr
->iextMax
* sizeof (EXTR
));
2312 make_cleanup (free
, ext_block
);
2314 ext_out
= (char *) debug_info
->external_ext
;
2315 ext_out_end
= ext_out
+ hdr
->iextMax
* external_ext_size
;
2317 for (; ext_out
< ext_out_end
; ext_out
+= external_ext_size
, ext_in
++)
2318 (*swap_ext_in
) (cur_bfd
, ext_out
, ext_in
);
2320 /* Pass 1 over external syms: Presize and partition the list */
2322 ext_in_end
= ext_in
+ hdr
->iextMax
;
2323 for (; ext_in
< ext_in_end
; ext_in
++)
2325 /* See calls to complain below. */
2326 if (ext_in
->ifd
>= -1
2327 && ext_in
->ifd
< hdr
->ifdMax
2328 && ext_in
->asym
.iss
>= 0
2329 && ext_in
->asym
.iss
< hdr
->issExtMax
)
2330 fdr_to_pst
[ext_in
->ifd
].n_globals
++;
2333 /* Pass 1.5 over files: partition out global symbol space */
2335 for (f_idx
= -1; f_idx
< hdr
->ifdMax
; f_idx
++)
2337 fdr_to_pst
[f_idx
].globals_offset
= s_idx
;
2338 s_idx
+= fdr_to_pst
[f_idx
].n_globals
;
2339 fdr_to_pst
[f_idx
].n_globals
= 0;
2344 For ECOFF in ELF, we skip the creation of the minimal symbols.
2345 The ECOFF symbols should be a subset of the Elf symbols, and the
2346 section information of the elf symbols will be more accurate.
2347 FIXME! What about Irix 5's native linker?
2349 By default, Elf sections which don't exist in ECOFF
2350 get put in ECOFF's absolute section by the gnu linker.
2351 Since absolute sections don't get relocated, we
2352 end up calculating an address different from that of
2353 the symbol's minimal symbol (created earlier from the
2356 To fix this, either :
2357 1) don't create the duplicate symbol
2358 (assumes ECOFF symtab is a subset of the ELF symtab;
2359 assumes no side-effects result from ignoring ECOFF symbol)
2360 2) create it, only if lookup for existing symbol in ELF's minimal
2363 assumes no side-effects result from ignoring ECOFF symbol)
2364 3) create it, but lookup ELF's minimal symbol and use it's section
2365 during relocation, then modify "uniqify" phase to merge and
2366 eliminate the duplicate symbol
2367 (highly inefficient)
2369 I've implemented #1 here...
2370 Skip the creation of the minimal symbols based on the ECOFF
2373 /* Pass 2 over external syms: fill in external symbols */
2375 ext_in_end
= ext_in
+ hdr
->iextMax
;
2376 for (; ext_in
< ext_in_end
; ext_in
++)
2378 enum minimal_symbol_type ms_type
= mst_text
;
2379 CORE_ADDR svalue
= ext_in
->asym
.value
;
2381 /* The Irix 5 native tools seem to sometimes generate bogus
2382 external symbols. */
2383 if (ext_in
->ifd
< -1 || ext_in
->ifd
>= hdr
->ifdMax
)
2385 complain (&bad_ext_ifd_complaint
, ext_in
->ifd
, hdr
->ifdMax
);
2388 if (ext_in
->asym
.iss
< 0 || ext_in
->asym
.iss
>= hdr
->issExtMax
)
2390 complain (&bad_ext_iss_complaint
, ext_in
->asym
.iss
,
2395 extern_tab
[fdr_to_pst
[ext_in
->ifd
].globals_offset
2396 + fdr_to_pst
[ext_in
->ifd
].n_globals
++] = *ext_in
;
2399 if (SC_IS_UNDEF (ext_in
->asym
.sc
) || ext_in
->asym
.sc
== scNil
)
2403 /* Pass 3 over files, over local syms: fill in static symbols */
2404 name
= debug_info
->ssext
+ ext_in
->asym
.iss
;
2406 /* Process ECOFF Symbol Types and Storage Classes */
2407 switch (ext_in
->asym
.st
)
2410 /* Beginnning of Procedure */
2411 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2414 /* Load time only static procs */
2415 ms_type
= mst_file_text
;
2416 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2419 /* External symbol */
2420 if (SC_IS_COMMON (ext_in
->asym
.sc
))
2422 /* The value of a common symbol is its size, not its address.
2426 else if (SC_IS_DATA (ext_in
->asym
.sc
))
2429 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
2431 else if (SC_IS_BSS (ext_in
->asym
.sc
))
2434 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
2441 if (SC_IS_TEXT (ext_in
->asym
.sc
))
2443 ms_type
= mst_file_text
;
2444 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2446 else if (SC_IS_DATA (ext_in
->asym
.sc
))
2448 ms_type
= mst_file_data
;
2449 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
2451 else if (SC_IS_BSS (ext_in
->asym
.sc
))
2453 ms_type
= mst_file_bss
;
2454 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
2461 /* The alpha has the section start addresses in stLocal symbols
2462 whose name starts with a `.'. Skip those but complain for all
2463 other stLocal symbols.
2464 Irix6 puts the section start addresses in stNil symbols, skip
2470 ms_type
= mst_unknown
;
2471 complain (&unknown_ext_complaint
, name
);
2473 if (!ECOFF_IN_ELF (cur_bfd
))
2474 prim_record_minimal_symbol (name
, svalue
, ms_type
, objfile
);
2477 /* Pass 3 over files, over local syms: fill in static symbols */
2478 for (f_idx
= 0; f_idx
< hdr
->ifdMax
; f_idx
++)
2480 struct partial_symtab
*save_pst
;
2484 cur_fdr
= fh
= debug_info
->fdr
+ f_idx
;
2488 fdr_to_pst
[f_idx
].pst
= NULL
;
2492 /* Determine the start address for this object file from the
2493 file header and relocate it, except for Irix 5.2 zero fh->adr. */
2497 if (relocatable
|| textlow
!= 0)
2498 textlow
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2502 pst
= start_psymtab_common (objfile
, objfile
->section_offsets
,
2505 objfile
->global_psymbols
.next
,
2506 objfile
->static_psymbols
.next
);
2507 pst
->read_symtab_private
= ((char *)
2508 obstack_alloc (&objfile
->psymbol_obstack
,
2509 sizeof (struct symloc
)));
2510 memset ((PTR
) pst
->read_symtab_private
, 0, sizeof (struct symloc
));
2513 FDR_IDX (pst
) = f_idx
;
2514 CUR_BFD (pst
) = cur_bfd
;
2515 DEBUG_SWAP (pst
) = debug_swap
;
2516 DEBUG_INFO (pst
) = debug_info
;
2517 PENDING_LIST (pst
) = pending_list
;
2519 /* The way to turn this into a symtab is to call... */
2520 pst
->read_symtab
= mdebug_psymtab_to_symtab
;
2522 /* Set up language for the pst.
2523 The language from the FDR is used if it is unambigious (e.g. cfront
2524 with native cc and g++ will set the language to C).
2525 Otherwise we have to deduce the language from the filename.
2526 Native ecoff has every header file in a separate FDR, so
2527 deduce_language_from_filename will return language_unknown for
2528 a header file, which is not what we want.
2529 But the FDRs for the header files are after the FDR for the source
2530 file, so we can assign the language of the source file to the
2531 following header files. Then we save the language in the private
2532 pst data so that we can reuse it when building symtabs. */
2533 prev_language
= psymtab_language
;
2537 case langCplusplusV2
:
2538 psymtab_language
= language_cplus
;
2541 psymtab_language
= deduce_language_from_filename (fdr_name (fh
));
2544 if (psymtab_language
== language_unknown
)
2545 psymtab_language
= prev_language
;
2546 PST_PRIVATE (pst
)->pst_language
= psymtab_language
;
2548 pst
->texthigh
= pst
->textlow
;
2550 /* For stabs-in-ecoff files, the second symbol must be @stab.
2551 This symbol is emitted by mips-tfile to signal that the
2552 current object file uses encapsulated stabs instead of mips
2553 ecoff for local symbols. (It is the second symbol because
2554 the first symbol is the stFile used to signal the start of a
2556 processing_gcc_compilation
= 0;
2559 (*swap_sym_in
) (cur_bfd
,
2560 ((char *) debug_info
->external_sym
2561 + (fh
->isymBase
+ 1) * external_sym_size
),
2563 if (STREQ (debug_info
->ss
+ fh
->issBase
+ sh
.iss
, stabs_symbol
))
2564 processing_gcc_compilation
= 2;
2567 if (processing_gcc_compilation
!= 0)
2569 for (cur_sdx
= 2; cur_sdx
< fh
->csym
; cur_sdx
++)
2574 (*swap_sym_in
) (cur_bfd
,
2575 (((char *) debug_info
->external_sym
)
2576 + (fh
->isymBase
+ cur_sdx
) * external_sym_size
),
2578 type_code
= ECOFF_UNMARK_STAB (sh
.index
);
2579 if (!ECOFF_IS_STAB (&sh
))
2581 if (sh
.st
== stProc
|| sh
.st
== stStaticProc
)
2586 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2587 if (sh
.st
== stStaticProc
)
2589 namestring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2590 prim_record_minimal_symbol_and_info (namestring
,
2594 SECT_OFF_TEXT (objfile
),
2598 procaddr
= sh
.value
;
2600 isym
= AUX_GET_ISYM (fh
->fBigendian
,
2601 (debug_info
->external_aux
2604 (*swap_sym_in
) (cur_bfd
,
2605 ((char *) debug_info
->external_sym
2606 + ((fh
->isymBase
+ isym
- 1)
2607 * external_sym_size
)),
2611 CORE_ADDR high
= procaddr
+ sh
.value
;
2613 /* Kludge for Irix 5.2 zero fh->adr. */
2615 && (pst
->textlow
== 0 || procaddr
< pst
->textlow
))
2616 pst
->textlow
= procaddr
;
2617 if (high
> pst
->texthigh
)
2618 pst
->texthigh
= high
;
2621 else if (sh
.st
== stStatic
)
2636 namestring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2637 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
2638 prim_record_minimal_symbol_and_info (namestring
,
2642 SECT_OFF_DATA (objfile
),
2648 /* FIXME! Shouldn't this use cases for bss,
2649 then have the default be abs? */
2650 namestring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2651 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
2652 prim_record_minimal_symbol_and_info (namestring
,
2656 SECT_OFF_BSS (objfile
),
2664 /* Handle stabs continuation */
2666 char *stabstring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2667 int len
= strlen (stabstring
);
2668 while (stabstring
[len
- 1] == '\\')
2671 char *stabstring1
= stabstring
;
2675 /* Ignore continuation char from 1st string */
2678 /* Read next stabstring */
2680 (*swap_sym_in
) (cur_bfd
,
2681 (((char *) debug_info
->external_sym
)
2682 + (fh
->isymBase
+ cur_sdx
)
2683 * external_sym_size
),
2685 stabstring2
= debug_info
->ss
+ fh
->issBase
+ sh2
.iss
;
2686 len2
= strlen (stabstring2
);
2688 /* Concatinate stabstring2 with stabstring1 */
2690 && stabstring
!= debug_info
->ss
+ fh
->issBase
+ sh
.iss
)
2691 stabstring
= xrealloc (stabstring
, len
+ len2
+ 1);
2693 stabstring
= xmalloc (len
+ len2
+ 1);
2694 strcpy (stabstring
, stabstring1
);
2695 strcpy (stabstring
+ len
, stabstring2
);
2699 #define SET_NAMESTRING() \
2700 namestring = stabstring
2701 #define CUR_SYMBOL_TYPE type_code
2702 #define CUR_SYMBOL_VALUE sh.value
2703 #define START_PSYMTAB(ofile,fname,low,symoff,global_syms,static_syms)\
2705 #define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps,textlow_not_set) (void)0
2706 #define HANDLE_RBRAC(val) \
2707 if ((val) > save_pst->texthigh) save_pst->texthigh = (val);
2708 #include "partial-stab.h"
2711 && stabstring
!= debug_info
->ss
+ fh
->issBase
+ sh
.iss
)
2714 /* end - Handle continuation */
2719 for (cur_sdx
= 0; cur_sdx
< fh
->csym
;)
2722 enum address_class
class;
2724 (*swap_sym_in
) (cur_bfd
,
2725 ((char *) debug_info
->external_sym
2726 + ((fh
->isymBase
+ cur_sdx
)
2727 * external_sym_size
)),
2730 if (ECOFF_IS_STAB (&sh
))
2736 /* Non absolute static symbols go into the minimal table. */
2737 if (SC_IS_UNDEF (sh
.sc
) || sh
.sc
== scNil
2738 || (sh
.index
== indexNil
2739 && (sh
.st
!= stStatic
|| sh
.sc
== scAbs
)))
2741 /* FIXME, premature? */
2746 name
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2752 /* The value of a stEnd symbol is the displacement from the
2753 corresponding start symbol value, do not relocate it. */
2755 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2762 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
2766 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
2777 prim_record_minimal_symbol_and_info (name
, sh
.value
,
2778 mst_file_text
, NULL
,
2779 SECT_OFF_TEXT (objfile
), NULL
,
2785 /* Usually there is a local and a global stProc symbol
2786 for a function. This means that the function name
2787 has already been entered into the mimimal symbol table
2788 while processing the global symbols in pass 2 above.
2789 One notable exception is the PROGRAM name from
2790 f77 compiled executables, it is only put out as
2791 local stProc symbol, and a global MAIN__ stProc symbol
2792 points to it. It doesn't matter though, as gdb is
2793 still able to find the PROGRAM name via the partial
2794 symbol table, and the MAIN__ symbol via the minimal
2796 if (sh
.st
== stProc
)
2797 add_psymbol_to_list (name
, strlen (name
),
2798 VAR_NAMESPACE
, LOC_BLOCK
,
2799 &objfile
->global_psymbols
,
2800 0, sh
.value
, psymtab_language
, objfile
);
2802 add_psymbol_to_list (name
, strlen (name
),
2803 VAR_NAMESPACE
, LOC_BLOCK
,
2804 &objfile
->static_psymbols
,
2805 0, sh
.value
, psymtab_language
, objfile
);
2807 /* Skip over procedure to next one. */
2808 if (sh
.index
>= hdr
->iauxMax
)
2810 /* Should not happen, but does when cross-compiling
2811 with the MIPS compiler. FIXME -- pull later. */
2812 complain (&index_complaint
, name
);
2813 new_sdx
= cur_sdx
+ 1; /* Don't skip at all */
2816 new_sdx
= AUX_GET_ISYM (fh
->fBigendian
,
2817 (debug_info
->external_aux
2820 procaddr
= sh
.value
;
2822 if (new_sdx
<= cur_sdx
)
2824 /* This should not happen either... FIXME. */
2825 complain (&aux_index_complaint
, name
);
2826 new_sdx
= cur_sdx
+ 1; /* Don't skip backward */
2830 (*swap_sym_in
) (cur_bfd
,
2831 ((char *) debug_info
->external_sym
2832 + ((fh
->isymBase
+ cur_sdx
- 1)
2833 * external_sym_size
)),
2838 /* Kludge for Irix 5.2 zero fh->adr. */
2840 && (pst
->textlow
== 0 || procaddr
< pst
->textlow
))
2841 pst
->textlow
= procaddr
;
2843 high
= procaddr
+ sh
.value
;
2844 if (high
> pst
->texthigh
)
2845 pst
->texthigh
= high
;
2848 case stStatic
: /* Variable */
2849 if (SC_IS_DATA (sh
.sc
))
2850 prim_record_minimal_symbol_and_info (name
, sh
.value
,
2851 mst_file_data
, NULL
,
2852 SECT_OFF_DATA (objfile
),
2856 prim_record_minimal_symbol_and_info (name
, sh
.value
,
2858 SECT_OFF_BSS (objfile
),
2864 case stIndirect
: /* Irix5 forward declaration */
2865 /* Skip forward declarations from Irix5 cc */
2868 case stTypedef
: /* Typedef */
2869 /* Skip typedefs for forward declarations and opaque
2870 structs from alpha and mips cc. */
2871 if (sh
.iss
== 0 || has_opaque_xref (fh
, &sh
))
2873 class = LOC_TYPEDEF
;
2876 case stConstant
: /* Constant decl */
2883 case stBlock
: /* { }, str, un, enum */
2884 /* Do not create a partial symbol for cc unnamed aggregates
2885 and gcc empty aggregates. */
2886 if ((sh
.sc
== scInfo
2887 || SC_IS_COMMON (sh
.sc
))
2889 && sh
.index
!= cur_sdx
+ 2)
2891 add_psymbol_to_list (name
, strlen (name
),
2892 STRUCT_NAMESPACE
, LOC_TYPEDEF
,
2893 &objfile
->static_psymbols
,
2895 psymtab_language
, objfile
);
2897 handle_psymbol_enumerators (objfile
, fh
, sh
.st
, sh
.value
);
2899 /* Skip over the block */
2901 if (new_sdx
<= cur_sdx
)
2903 /* This happens with the Ultrix kernel. */
2904 complain (&block_index_complaint
, name
);
2905 new_sdx
= cur_sdx
+ 1; /* Don't skip backward */
2910 case stFile
: /* File headers */
2911 case stLabel
: /* Labels */
2912 case stEnd
: /* Ends of files */
2915 case stLocal
: /* Local variables */
2916 /* Normally these are skipped because we skip over
2917 all blocks we see. However, these can occur
2918 as visible symbols in a .h file that contains code. */
2922 /* Both complaints are valid: one gives symbol name,
2923 the other the offending symbol type. */
2924 complain (&unknown_sym_complaint
, name
);
2925 complain (&unknown_st_complaint
, sh
.st
);
2929 /* Use this gdb symbol */
2930 add_psymbol_to_list (name
, strlen (name
),
2931 VAR_NAMESPACE
, class,
2932 &objfile
->static_psymbols
,
2933 0, sh
.value
, psymtab_language
, objfile
);
2935 cur_sdx
++; /* Go to next file symbol */
2938 /* Now do enter the external symbols. */
2939 ext_ptr
= &extern_tab
[fdr_to_pst
[f_idx
].globals_offset
];
2940 cur_sdx
= fdr_to_pst
[f_idx
].n_globals
;
2941 PST_PRIVATE (save_pst
)->extern_count
= cur_sdx
;
2942 PST_PRIVATE (save_pst
)->extern_tab
= ext_ptr
;
2943 for (; --cur_sdx
>= 0; ext_ptr
++)
2945 enum address_class
class;
2950 if (ext_ptr
->ifd
!= f_idx
)
2952 psh
= &ext_ptr
->asym
;
2954 /* Do not add undefined symbols to the partial symbol table. */
2955 if (SC_IS_UNDEF (psh
->sc
) || psh
->sc
== scNil
)
2958 svalue
= psh
->value
;
2963 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2970 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
2974 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
2981 /* These are generated for static symbols in .o files,
2986 /* External procedure symbols have been entered
2987 into the minimal symbol table in pass 2 above.
2988 Ignore them, as parse_external will ignore them too. */
2994 complain (&unknown_ext_complaint
,
2995 debug_info
->ssext
+ psh
->iss
);
2996 /* Fall through, pretend it's global. */
2998 /* Global common symbols are resolved by the runtime loader,
3000 if (SC_IS_COMMON (psh
->sc
))
3006 name
= debug_info
->ssext
+ psh
->iss
;
3007 add_psymbol_to_list (name
, strlen (name
),
3008 VAR_NAMESPACE
, class,
3009 &objfile
->global_psymbols
,
3011 psymtab_language
, objfile
);
3015 /* Link pst to FDR. end_psymtab returns NULL if the psymtab was
3016 empty and put on the free list. */
3017 fdr_to_pst
[f_idx
].pst
= end_psymtab (save_pst
,
3018 psymtab_include_list
, includes_used
,
3019 -1, save_pst
->texthigh
,
3020 dependency_list
, dependencies_used
, textlow_not_set
);
3022 dependencies_used
= 0;
3024 if (objfile
->ei
.entry_point
>= save_pst
->textlow
&&
3025 objfile
->ei
.entry_point
< save_pst
->texthigh
)
3027 objfile
->ei
.entry_file_lowpc
= save_pst
->textlow
;
3028 objfile
->ei
.entry_file_highpc
= save_pst
->texthigh
;
3031 /* The objfile has its functions reordered if this partial symbol
3032 table overlaps any other partial symbol table.
3033 We cannot assume a reordered objfile if a partial symbol table
3034 is contained within another partial symbol table, as partial symbol
3035 tables for include files with executable code are contained
3036 within the partial symbol table for the including source file,
3037 and we do not want to flag the objfile reordered for these cases.
3039 This strategy works well for Irix-5.2 shared libraries, but we
3040 might have to use a more elaborate (and slower) algorithm for
3042 save_pst
= fdr_to_pst
[f_idx
].pst
;
3043 if (save_pst
!= NULL
3044 && save_pst
->textlow
!= 0
3045 && !(objfile
->flags
& OBJF_REORDERED
))
3047 ALL_OBJFILE_PSYMTABS (objfile
, pst
)
3050 && save_pst
->textlow
>= pst
->textlow
3051 && save_pst
->textlow
< pst
->texthigh
3052 && save_pst
->texthigh
> pst
->texthigh
)
3054 objfile
->flags
|= OBJF_REORDERED
;
3061 /* Now scan the FDRs for dependencies */
3062 for (f_idx
= 0; f_idx
< hdr
->ifdMax
; f_idx
++)
3064 fh
= f_idx
+ debug_info
->fdr
;
3065 pst
= fdr_to_pst
[f_idx
].pst
;
3067 if (pst
== (struct partial_symtab
*) NULL
)
3070 /* This should catch stabs-in-ecoff. */
3074 /* Skip the first file indirect entry as it is a self dependency
3075 for source files or a reverse .h -> .c dependency for header files. */
3076 pst
->number_of_dependencies
= 0;
3078 ((struct partial_symtab
**)
3079 obstack_alloc (&objfile
->psymbol_obstack
,
3081 * sizeof (struct partial_symtab
*))));
3082 for (s_idx
= 1; s_idx
< fh
->crfd
; s_idx
++)
3086 (*swap_rfd_in
) (cur_bfd
,
3087 ((char *) debug_info
->external_rfd
3088 + (fh
->rfdBase
+ s_idx
) * external_rfd_size
),
3090 if (rh
< 0 || rh
>= hdr
->ifdMax
)
3092 complain (&bad_file_number_complaint
, rh
);
3096 /* Skip self dependencies of header files. */
3100 /* Do not add to dependeny list if psymtab was empty. */
3101 if (fdr_to_pst
[rh
].pst
== (struct partial_symtab
*) NULL
)
3103 pst
->dependencies
[pst
->number_of_dependencies
++] = fdr_to_pst
[rh
].pst
;
3107 /* Remove the dummy psymtab created for -O3 images above, if it is
3108 still empty, to enable the detection of stripped executables. */
3109 if (objfile
->psymtabs
->next
== NULL
3110 && objfile
->psymtabs
->number_of_dependencies
== 0
3111 && objfile
->psymtabs
->n_global_syms
== 0
3112 && objfile
->psymtabs
->n_static_syms
== 0)
3113 objfile
->psymtabs
= NULL
;
3114 do_cleanups (old_chain
);
3117 /* If the current psymbol has an enumerated type, we need to add
3118 all the the enum constants to the partial symbol table. */
3121 handle_psymbol_enumerators (struct objfile
*objfile
, FDR
*fh
, int stype
,
3124 const bfd_size_type external_sym_size
= debug_swap
->external_sym_size
;
3125 void (*const swap_sym_in
) (bfd
*, PTR
, SYMR
*) = debug_swap
->swap_sym_in
;
3126 char *ext_sym
= ((char *) debug_info
->external_sym
3127 + ((fh
->isymBase
+ cur_sdx
+ 1) * external_sym_size
));
3137 /* It is an enumerated type if the next symbol entry is a stMember
3138 and its auxiliary index is indexNil or its auxiliary entry
3139 is a plain btNil or btVoid.
3140 Alpha cc -migrate enums are recognized by a zero index and
3141 a zero symbol value.
3142 DU 4.0 cc enums are recognized by a member type of btEnum without
3143 qualifiers and a zero symbol value. */
3144 (*swap_sym_in
) (cur_bfd
, ext_sym
, &sh
);
3145 if (sh
.st
!= stMember
)
3148 if (sh
.index
== indexNil
3149 || (sh
.index
== 0 && svalue
== 0))
3151 (*debug_swap
->swap_tir_in
) (fh
->fBigendian
,
3152 &(debug_info
->external_aux
3153 + fh
->iauxBase
+ sh
.index
)->a_ti
,
3155 if ((tir
.bt
!= btNil
3157 && (tir
.bt
!= btEnum
|| svalue
!= 0))
3158 || tir
.tq0
!= tqNil
)
3170 (*swap_sym_in
) (cur_bfd
, ext_sym
, &sh
);
3171 if (sh
.st
!= stMember
)
3173 name
= debug_info
->ss
+ cur_fdr
->issBase
+ sh
.iss
;
3175 /* Note that the value doesn't matter for enum constants
3176 in psymtabs, just in symtabs. */
3177 add_psymbol_to_list (name
, strlen (name
),
3178 VAR_NAMESPACE
, LOC_CONST
,
3179 &objfile
->static_psymbols
, 0,
3180 (CORE_ADDR
) 0, psymtab_language
, objfile
);
3181 ext_sym
+= external_sym_size
;
3185 /* Get the next symbol. OBJFILE is unused. */
3188 mdebug_next_symbol_text (struct objfile
*objfile
)
3193 (*debug_swap
->swap_sym_in
) (cur_bfd
,
3194 ((char *) debug_info
->external_sym
3195 + ((cur_fdr
->isymBase
+ cur_sdx
)
3196 * debug_swap
->external_sym_size
)),
3198 return debug_info
->ss
+ cur_fdr
->issBase
+ sh
.iss
;
3201 /* Ancillary function to psymtab_to_symtab(). Does all the work
3202 for turning the partial symtab PST into a symtab, recurring
3203 first on all dependent psymtabs. The argument FILENAME is
3204 only passed so we can see in debug stack traces what file
3207 This function has a split personality, based on whether the
3208 symbol table contains ordinary ecoff symbols, or stabs-in-ecoff.
3209 The flow of control and even the memory allocation differs. FIXME. */
3212 psymtab_to_symtab_1 (struct partial_symtab
*pst
, char *filename
)
3214 bfd_size_type external_sym_size
;
3215 bfd_size_type external_pdr_size
;
3216 void (*swap_sym_in
) (bfd
*, PTR
, SYMR
*);
3217 void (*swap_pdr_in
) (bfd
*, PTR
, PDR
*);
3221 struct linetable
*lines
;
3222 CORE_ADDR lowest_pdr_addr
= 0;
3228 /* Read in all partial symbtabs on which this one is dependent.
3229 NOTE that we do have circular dependencies, sigh. We solved
3230 that by setting pst->readin before this point. */
3232 for (i
= 0; i
< pst
->number_of_dependencies
; i
++)
3233 if (!pst
->dependencies
[i
]->readin
)
3235 /* Inform about additional files to be read in. */
3238 fputs_filtered (" ", gdb_stdout
);
3240 fputs_filtered ("and ", gdb_stdout
);
3242 printf_filtered ("%s...",
3243 pst
->dependencies
[i
]->filename
);
3244 wrap_here (""); /* Flush output */
3245 gdb_flush (gdb_stdout
);
3247 /* We only pass the filename for debug purposes */
3248 psymtab_to_symtab_1 (pst
->dependencies
[i
],
3249 pst
->dependencies
[i
]->filename
);
3252 /* Do nothing if this is a dummy psymtab. */
3254 if (pst
->n_global_syms
== 0 && pst
->n_static_syms
== 0
3255 && pst
->textlow
== 0 && pst
->texthigh
== 0)
3258 /* Now read the symbols for this symtab */
3260 cur_bfd
= CUR_BFD (pst
);
3261 debug_swap
= DEBUG_SWAP (pst
);
3262 debug_info
= DEBUG_INFO (pst
);
3263 pending_list
= PENDING_LIST (pst
);
3264 external_sym_size
= debug_swap
->external_sym_size
;
3265 external_pdr_size
= debug_swap
->external_pdr_size
;
3266 swap_sym_in
= debug_swap
->swap_sym_in
;
3267 swap_pdr_in
= debug_swap
->swap_pdr_in
;
3268 current_objfile
= pst
->objfile
;
3269 cur_fd
= FDR_IDX (pst
);
3270 fh
= ((cur_fd
== -1)
3272 : debug_info
->fdr
+ cur_fd
);
3275 /* See comment in parse_partial_symbols about the @stabs sentinel. */
3276 processing_gcc_compilation
= 0;
3277 if (fh
!= (FDR
*) NULL
&& fh
->csym
>= 2)
3281 (*swap_sym_in
) (cur_bfd
,
3282 ((char *) debug_info
->external_sym
3283 + (fh
->isymBase
+ 1) * external_sym_size
),
3285 if (STREQ (debug_info
->ss
+ fh
->issBase
+ sh
.iss
,
3288 /* We indicate that this is a GCC compilation so that certain
3289 features will be enabled in stabsread/dbxread. */
3290 processing_gcc_compilation
= 2;
3294 if (processing_gcc_compilation
!= 0)
3297 /* This symbol table contains stabs-in-ecoff entries. */
3299 /* Parse local symbols first */
3301 if (fh
->csym
<= 2) /* FIXME, this blows psymtab->symtab ptr */
3303 current_objfile
= NULL
;
3306 for (cur_sdx
= 2; cur_sdx
< fh
->csym
; cur_sdx
++)
3312 (*swap_sym_in
) (cur_bfd
,
3313 (((char *) debug_info
->external_sym
)
3314 + (fh
->isymBase
+ cur_sdx
) * external_sym_size
),
3316 name
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
3318 /* XXX This is a hack. It will go away! */
3319 if (ECOFF_IS_STAB (&sh
) || (name
[0] == '#'))
3321 int type_code
= ECOFF_UNMARK_STAB (sh
.index
);
3323 /* We should never get non N_STAB symbols here, but they
3324 should be harmless, so keep process_one_symbol from
3325 complaining about them. */
3326 if (type_code
& N_STAB
)
3328 process_one_symbol (type_code
, 0, valu
, name
,
3329 pst
->section_offsets
, pst
->objfile
);
3331 /* Similarly a hack. */
3332 else if (name
[0] == '#')
3334 process_one_symbol (N_SLINE
, 0, valu
, name
,
3335 pst
->section_offsets
, pst
->objfile
);
3337 if (type_code
== N_FUN
)
3339 /* Make up special symbol to contain
3340 procedure specific info */
3341 struct mips_extra_func_info
*e
=
3342 ((struct mips_extra_func_info
*)
3343 obstack_alloc (¤t_objfile
->symbol_obstack
,
3344 sizeof (struct mips_extra_func_info
)));
3345 struct symbol
*s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
3347 memset ((PTR
) e
, 0, sizeof (struct mips_extra_func_info
));
3348 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
3349 SYMBOL_CLASS (s
) = LOC_CONST
;
3350 SYMBOL_TYPE (s
) = mdebug_type_void
;
3351 SYMBOL_VALUE (s
) = (long) e
;
3352 e
->pdr
.framereg
= -1;
3353 add_symbol_to_list (s
, &local_symbols
);
3356 else if (sh
.st
== stLabel
)
3358 if (sh
.index
== indexNil
)
3360 /* This is what the gcc2_compiled and __gnu_compiled_*
3361 show up as. So don't complain. */
3366 /* Handle encoded stab line number. */
3367 valu
+= ANOFFSET (pst
->section_offsets
, SECT_OFF_TEXT (pst
->objfile
));
3368 record_line (current_subfile
, sh
.index
, valu
);
3371 else if (sh
.st
== stProc
|| sh
.st
== stStaticProc
3372 || sh
.st
== stStatic
|| sh
.st
== stEnd
)
3373 /* These are generated by gcc-2.x, do not complain */
3376 complain (&stab_unknown_complaint
, name
);
3378 st
= end_symtab (pst
->texthigh
, pst
->objfile
, SECT_OFF_TEXT (pst
->objfile
));
3381 /* Sort the symbol table now, we are done adding symbols to it.
3382 We must do this before parse_procedure calls lookup_symbol. */
3383 sort_symtab_syms (st
);
3385 /* There used to be a call to sort_blocks here, but this should not
3386 be necessary for stabs symtabs. And as sort_blocks modifies the
3387 start address of the GLOBAL_BLOCK to the FIRST_LOCAL_BLOCK,
3388 it did the wrong thing if the first procedure in a file was
3389 generated via asm statements. */
3391 /* Fill in procedure info next. */
3395 struct cleanup
*old_chain
;
3401 pr_block
= (PDR
*) xmalloc (fh
->cpd
* sizeof (PDR
));
3402 old_chain
= make_cleanup (free
, pr_block
);
3404 pdr_ptr
= ((char *) debug_info
->external_pdr
3405 + fh
->ipdFirst
* external_pdr_size
);
3406 pdr_end
= pdr_ptr
+ fh
->cpd
* external_pdr_size
;
3410 pdr_ptr
+= external_pdr_size
, pdr_in
++)
3412 (*swap_pdr_in
) (cur_bfd
, pdr_ptr
, pdr_in
);
3414 /* Determine lowest PDR address, the PDRs are not always
3416 if (pdr_in
== pr_block
)
3417 lowest_pdr_addr
= pdr_in
->adr
;
3418 else if (pdr_in
->adr
< lowest_pdr_addr
)
3419 lowest_pdr_addr
= pdr_in
->adr
;
3423 pdr_in_end
= pdr_in
+ fh
->cpd
;
3424 for (; pdr_in
< pdr_in_end
; pdr_in
++)
3425 parse_procedure (pdr_in
, st
, pst
);
3427 do_cleanups (old_chain
);
3432 /* This symbol table contains ordinary ecoff entries. */
3438 /* How many symbols will we need */
3439 /* FIXME, this does not count enum values. */
3440 f_max
= pst
->n_global_syms
+ pst
->n_static_syms
;
3444 st
= new_symtab ("unknown", f_max
, 0, pst
->objfile
);
3448 f_max
+= fh
->csym
+ fh
->cpd
;
3449 maxlines
= 2 * fh
->cline
;
3450 st
= new_symtab (pst
->filename
, 2 * f_max
, maxlines
, pst
->objfile
);
3452 /* The proper language was already determined when building
3453 the psymtab, use it. */
3454 st
->language
= PST_PRIVATE (pst
)->pst_language
;
3457 psymtab_language
= st
->language
;
3459 lines
= LINETABLE (st
);
3461 /* Get a new lexical context */
3463 push_parse_stack ();
3464 top_stack
->cur_st
= st
;
3465 top_stack
->cur_block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (st
),
3467 BLOCK_START (top_stack
->cur_block
) = pst
->textlow
;
3468 BLOCK_END (top_stack
->cur_block
) = 0;
3469 top_stack
->blocktype
= stFile
;
3470 top_stack
->maxsyms
= 2 * f_max
;
3471 top_stack
->cur_type
= 0;
3472 top_stack
->procadr
= 0;
3473 top_stack
->numargs
= 0;
3474 found_ecoff_debugging_info
= 0;
3481 /* Parse local symbols first */
3482 sym_ptr
= ((char *) debug_info
->external_sym
3483 + fh
->isymBase
* external_sym_size
);
3484 sym_end
= sym_ptr
+ fh
->csym
* external_sym_size
;
3485 while (sym_ptr
< sym_end
)
3490 (*swap_sym_in
) (cur_bfd
, sym_ptr
, &sh
);
3491 c
= parse_symbol (&sh
,
3492 debug_info
->external_aux
+ fh
->iauxBase
,
3493 sym_ptr
, fh
->fBigendian
, pst
->section_offsets
, pst
->objfile
);
3494 sym_ptr
+= c
* external_sym_size
;
3497 /* Linenumbers. At the end, check if we can save memory.
3498 parse_lines has to look ahead an arbitrary number of PDR
3499 structures, so we swap them all first. */
3503 struct cleanup
*old_chain
;
3509 pr_block
= (PDR
*) xmalloc (fh
->cpd
* sizeof (PDR
));
3511 old_chain
= make_cleanup (free
, pr_block
);
3513 pdr_ptr
= ((char *) debug_info
->external_pdr
3514 + fh
->ipdFirst
* external_pdr_size
);
3515 pdr_end
= pdr_ptr
+ fh
->cpd
* external_pdr_size
;
3519 pdr_ptr
+= external_pdr_size
, pdr_in
++)
3521 (*swap_pdr_in
) (cur_bfd
, pdr_ptr
, pdr_in
);
3523 /* Determine lowest PDR address, the PDRs are not always
3525 if (pdr_in
== pr_block
)
3526 lowest_pdr_addr
= pdr_in
->adr
;
3527 else if (pdr_in
->adr
< lowest_pdr_addr
)
3528 lowest_pdr_addr
= pdr_in
->adr
;
3531 parse_lines (fh
, pr_block
, lines
, maxlines
, pst
, lowest_pdr_addr
);
3532 if (lines
->nitems
< fh
->cline
)
3533 lines
= shrink_linetable (lines
);
3535 /* Fill in procedure info next. */
3537 pdr_in_end
= pdr_in
+ fh
->cpd
;
3538 for (; pdr_in
< pdr_in_end
; pdr_in
++)
3539 parse_procedure (pdr_in
, 0, pst
);
3541 do_cleanups (old_chain
);
3545 LINETABLE (st
) = lines
;
3547 /* .. and our share of externals.
3548 XXX use the global list to speed up things here. how?
3549 FIXME, Maybe quit once we have found the right number of ext's? */
3550 top_stack
->cur_st
= st
;
3551 top_stack
->cur_block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack
->cur_st
),
3553 top_stack
->blocktype
= stFile
;
3555 = (debug_info
->symbolic_header
.isymMax
3556 + debug_info
->symbolic_header
.ipdMax
3557 + debug_info
->symbolic_header
.iextMax
);
3559 ext_ptr
= PST_PRIVATE (pst
)->extern_tab
;
3560 for (i
= PST_PRIVATE (pst
)->extern_count
; --i
>= 0; ext_ptr
++)
3561 parse_external (ext_ptr
, fh
->fBigendian
, pst
->section_offsets
, pst
->objfile
);
3563 /* If there are undefined symbols, tell the user.
3564 The alpha has an undefined symbol for every symbol that is
3565 from a shared library, so tell the user only if verbose is on. */
3566 if (info_verbose
&& n_undef_symbols
)
3568 printf_filtered ("File %s contains %d unresolved references:",
3569 st
->filename
, n_undef_symbols
);
3570 printf_filtered ("\n\t%4d variables\n\t%4d procedures\n\t%4d labels\n",
3571 n_undef_vars
, n_undef_procs
, n_undef_labels
);
3572 n_undef_symbols
= n_undef_labels
= n_undef_vars
= n_undef_procs
= 0;
3579 /* Sort the symbol table now, we are done adding symbols to it. */
3580 sort_symtab_syms (st
);
3585 /* Now link the psymtab and the symtab. */
3588 current_objfile
= NULL
;
3591 /* Ancillary parsing procedures. */
3593 /* Return 1 if the symbol pointed to by SH has a cross reference
3594 to an opaque aggregate type, else 0. */
3597 has_opaque_xref (FDR
*fh
, SYMR
*sh
)
3604 if (sh
->index
== indexNil
)
3607 ax
= debug_info
->external_aux
+ fh
->iauxBase
+ sh
->index
;
3608 (*debug_swap
->swap_tir_in
) (fh
->fBigendian
, &ax
->a_ti
, &tir
);
3609 if (tir
.bt
!= btStruct
&& tir
.bt
!= btUnion
&& tir
.bt
!= btEnum
)
3613 (*debug_swap
->swap_rndx_in
) (fh
->fBigendian
, &ax
->a_rndx
, rn
);
3614 if (rn
->rfd
== 0xfff)
3615 rf
= AUX_GET_ISYM (fh
->fBigendian
, ax
+ 1);
3623 /* Lookup the type at relative index RN. Return it in TPP
3624 if found and in any event come up with its name PNAME.
3625 BIGEND says whether aux symbols are big-endian or not (from fh->fBigendian).
3626 Return value says how many aux symbols we ate. */
3629 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. */
3630 char **pname
, int bigend
, char *sym_name
)
3639 struct mdebug_pending
*pend
;
3641 *tpp
= (struct type
*) NULL
;
3643 (*debug_swap
->swap_rndx_in
) (bigend
, &ax
->a_rndx
, rn
);
3645 /* Escape index means 'the next one' */
3646 if (rn
->rfd
== 0xfff)
3649 rf
= AUX_GET_ISYM (bigend
, ax
+ 1);
3656 /* mips cc uses a rf of -1 for opaque struct definitions.
3657 Set TYPE_FLAG_STUB for these types so that check_typedef will
3658 resolve them if the struct gets defined in another compilation unit. */
3661 *pname
= "<undefined>";
3662 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
3663 TYPE_FLAGS (*tpp
) |= TYPE_FLAG_STUB
;
3667 /* mips cc uses an escaped rn->index of 0 for struct return types
3668 of procedures that were compiled without -g. These will always remain
3670 if (rn
->rfd
== 0xfff && rn
->index
== 0)
3672 *pname
= "<undefined>";
3676 /* Find the relative file descriptor and the symbol in it. */
3677 fh
= get_rfd (fd
, rf
);
3678 xref_fd
= fh
- debug_info
->fdr
;
3680 if (rn
->index
>= fh
->csym
)
3682 /* File indirect entry is corrupt. */
3683 *pname
= "<illegal>";
3684 complain (&bad_rfd_entry_complaint
,
3685 sym_name
, xref_fd
, rn
->index
);
3689 /* If we have processed this symbol then we left a forwarding
3690 pointer to the type in the pending list. If not, we`ll put
3691 it in a list of pending types, to be processed later when
3692 the file will be. In any event, we collect the name for the
3695 esh
= ((char *) debug_info
->external_sym
3696 + ((fh
->isymBase
+ rn
->index
)
3697 * debug_swap
->external_sym_size
));
3698 (*debug_swap
->swap_sym_in
) (cur_bfd
, esh
, &sh
);
3700 /* Make sure that this type of cross reference can be handled. */
3701 if ((sh
.sc
!= scInfo
3702 || (sh
.st
!= stBlock
&& sh
.st
!= stTypedef
&& sh
.st
!= stIndirect
3703 && sh
.st
!= stStruct
&& sh
.st
!= stUnion
3704 && sh
.st
!= stEnum
))
3705 && (sh
.st
!= stBlock
|| !SC_IS_COMMON (sh
.sc
)))
3707 /* File indirect entry is corrupt. */
3708 *pname
= "<illegal>";
3709 complain (&bad_rfd_entry_complaint
,
3710 sym_name
, xref_fd
, rn
->index
);
3714 *pname
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
3716 pend
= is_pending_symbol (fh
, esh
);
3721 /* We have not yet seen this type. */
3723 if ((sh
.iss
== 0 && sh
.st
== stTypedef
) || sh
.st
== stIndirect
)
3727 /* alpha cc puts out a stTypedef with a sh.iss of zero for
3729 a) forward declarations of structs/unions/enums which are not
3730 defined in this compilation unit.
3731 For these the type will be void. This is a bad design decision
3732 as cross referencing across compilation units is impossible
3733 due to the missing name.
3734 b) forward declarations of structs/unions/enums/typedefs which
3735 are defined later in this file or in another file in the same
3736 compilation unit. Irix5 cc uses a stIndirect symbol for this.
3737 Simply cross reference those again to get the true type.
3738 The forward references are not entered in the pending list and
3739 in the symbol table. */
3741 (*debug_swap
->swap_tir_in
) (bigend
,
3742 &(debug_info
->external_aux
3743 + fh
->iauxBase
+ sh
.index
)->a_ti
,
3745 if (tir
.tq0
!= tqNil
)
3746 complain (&illegal_forward_tq0_complaint
, sym_name
);
3750 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
,
3752 *pname
= "<undefined>";
3759 (debug_info
->external_aux
3760 + fh
->iauxBase
+ sh
.index
+ 1),
3761 tpp
, type_code
, pname
,
3762 fh
->fBigendian
, sym_name
);
3766 /* Follow a forward typedef. This might recursively
3767 call cross_ref till we get a non typedef'ed type.
3768 FIXME: This is not correct behaviour, but gdb currently
3769 cannot handle typedefs without type copying. Type
3770 copying is impossible as we might have mutual forward
3771 references between two files and the copied type would not
3772 get filled in when we later parse its definition. */
3773 *tpp
= parse_type (xref_fd
,
3774 debug_info
->external_aux
+ fh
->iauxBase
,
3778 debug_info
->ss
+ fh
->issBase
+ sh
.iss
);
3779 add_pending (fh
, esh
, *tpp
);
3783 complain (&illegal_forward_bt_complaint
, tir
.bt
, sym_name
);
3784 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
,
3790 else if (sh
.st
== stTypedef
)
3792 /* Parse the type for a normal typedef. This might recursively call
3793 cross_ref till we get a non typedef'ed type.
3794 FIXME: This is not correct behaviour, but gdb currently
3795 cannot handle typedefs without type copying. But type copying is
3796 impossible as we might have mutual forward references between
3797 two files and the copied type would not get filled in when
3798 we later parse its definition. */
3799 *tpp
= parse_type (xref_fd
,
3800 debug_info
->external_aux
+ fh
->iauxBase
,
3804 debug_info
->ss
+ fh
->issBase
+ sh
.iss
);
3808 /* Cross reference to a struct/union/enum which is defined
3809 in another file in the same compilation unit but that file
3810 has not been parsed yet.
3811 Initialize the type only, it will be filled in when
3812 it's definition is parsed. */
3813 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
3815 add_pending (fh
, esh
, *tpp
);
3818 /* We used one auxent normally, two if we got a "next one" rf. */
3823 /* Quick&dirty lookup procedure, to avoid the MI ones that require
3824 keeping the symtab sorted */
3826 static struct symbol
*
3827 mylookup_symbol (char *name
, register struct block
*block
,
3828 namespace_enum
namespace, enum address_class
class)
3830 register int bot
, top
, inc
;
3831 register struct symbol
*sym
;
3834 top
= BLOCK_NSYMS (block
);
3838 sym
= BLOCK_SYM (block
, bot
);
3839 if (SYMBOL_NAME (sym
)[0] == inc
3840 && SYMBOL_NAMESPACE (sym
) == namespace
3841 && SYMBOL_CLASS (sym
) == class
3842 && strcmp (SYMBOL_NAME (sym
), name
) == 0)
3846 block
= BLOCK_SUPERBLOCK (block
);
3848 return mylookup_symbol (name
, block
, namespace, class);
3853 /* Add a new symbol S to a block B.
3854 Infrequently, we will need to reallocate the block to make it bigger.
3855 We only detect this case when adding to top_stack->cur_block, since
3856 that's the only time we know how big the block is. FIXME. */
3859 add_symbol (struct symbol
*s
, struct block
*b
)
3861 int nsyms
= BLOCK_NSYMS (b
)++;
3862 struct block
*origb
;
3863 struct parse_stack
*stackp
;
3865 if (b
== top_stack
->cur_block
&&
3866 nsyms
>= top_stack
->maxsyms
)
3868 complain (&block_overflow_complaint
, SYMBOL_NAME (s
));
3869 /* In this case shrink_block is actually grow_block, since
3870 BLOCK_NSYMS(b) is larger than its current size. */
3872 b
= shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
3874 /* Now run through the stack replacing pointers to the
3875 original block. shrink_block has already done this
3876 for the blockvector and BLOCK_FUNCTION. */
3877 for (stackp
= top_stack
; stackp
; stackp
= stackp
->next
)
3879 if (stackp
->cur_block
== origb
)
3881 stackp
->cur_block
= b
;
3882 stackp
->maxsyms
= BLOCK_NSYMS (b
);
3886 BLOCK_SYM (b
, nsyms
) = s
;
3889 /* Add a new block B to a symtab S */
3892 add_block (struct block
*b
, struct symtab
*s
)
3894 struct blockvector
*bv
= BLOCKVECTOR (s
);
3896 bv
= (struct blockvector
*) xrealloc ((PTR
) bv
,
3897 (sizeof (struct blockvector
)
3898 + BLOCKVECTOR_NBLOCKS (bv
)
3899 * sizeof (bv
->block
)));
3900 if (bv
!= BLOCKVECTOR (s
))
3901 BLOCKVECTOR (s
) = bv
;
3903 BLOCKVECTOR_BLOCK (bv
, BLOCKVECTOR_NBLOCKS (bv
)++) = b
;
3906 /* Add a new linenumber entry (LINENO,ADR) to a linevector LT.
3907 MIPS' linenumber encoding might need more than one byte
3908 to describe it, LAST is used to detect these continuation lines.
3910 Combining lines with the same line number seems like a bad idea.
3911 E.g: There could be a line number entry with the same line number after the
3912 prologue and GDB should not ignore it (this is a better way to find
3913 a prologue than mips_skip_prologue).
3914 But due to the compressed line table format there are line number entries
3915 for the same line which are needed to bridge the gap to the next
3916 line number entry. These entries have a bogus address info with them
3917 and we are unable to tell them from intended duplicate line number
3919 This is another reason why -ggdb debugging format is preferable. */
3922 add_line (struct linetable
*lt
, int lineno
, CORE_ADDR adr
, int last
)
3924 /* DEC c89 sometimes produces zero linenos which confuse gdb.
3925 Change them to something sensible. */
3929 last
= -2; /* make sure we record first line */
3931 if (last
== lineno
) /* skip continuation lines */
3934 lt
->item
[lt
->nitems
].line
= lineno
;
3935 lt
->item
[lt
->nitems
++].pc
= adr
<< 2;
3939 /* Sorting and reordering procedures */
3941 /* Blocks with a smaller low bound should come first */
3944 compare_blocks (const PTR arg1
, const PTR arg2
)
3946 register int addr_diff
;
3947 struct block
**b1
= (struct block
**) arg1
;
3948 struct block
**b2
= (struct block
**) arg2
;
3950 addr_diff
= (BLOCK_START ((*b1
))) - (BLOCK_START ((*b2
)));
3952 return (BLOCK_END ((*b2
))) - (BLOCK_END ((*b1
)));
3956 /* Sort the blocks of a symtab S.
3957 Reorder the blocks in the blockvector by code-address,
3958 as required by some MI search routines */
3961 sort_blocks (struct symtab
*s
)
3963 struct blockvector
*bv
= BLOCKVECTOR (s
);
3965 if (BLOCKVECTOR_NBLOCKS (bv
) <= 2)
3968 if (BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) == 0)
3969 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) = 0;
3970 if (BLOCK_END (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) == 0)
3971 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) = 0;
3975 * This is very unfortunate: normally all functions are compiled in
3976 * the order they are found, but if the file is compiled -O3 things
3977 * are very different. It would be nice to find a reliable test
3978 * to detect -O3 images in advance.
3980 if (BLOCKVECTOR_NBLOCKS (bv
) > 3)
3981 qsort (&BLOCKVECTOR_BLOCK (bv
, FIRST_LOCAL_BLOCK
),
3982 BLOCKVECTOR_NBLOCKS (bv
) - FIRST_LOCAL_BLOCK
,
3983 sizeof (struct block
*),
3987 register CORE_ADDR high
= 0;
3988 register int i
, j
= BLOCKVECTOR_NBLOCKS (bv
);
3990 for (i
= FIRST_LOCAL_BLOCK
; i
< j
; i
++)
3991 if (high
< BLOCK_END (BLOCKVECTOR_BLOCK (bv
, i
)))
3992 high
= BLOCK_END (BLOCKVECTOR_BLOCK (bv
, i
));
3993 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) = high
;
3996 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) =
3997 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, FIRST_LOCAL_BLOCK
));
3999 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) =
4000 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
));
4001 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) =
4002 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
));
4006 /* Constructor/restructor/destructor procedures */
4008 /* Allocate a new symtab for NAME. Needs an estimate of how many symbols
4009 MAXSYMS and linenumbers MAXLINES we'll put in it */
4011 static struct symtab
*
4012 new_symtab (char *name
, int maxsyms
, int maxlines
, struct objfile
*objfile
)
4014 struct symtab
*s
= allocate_symtab (name
, objfile
);
4016 LINETABLE (s
) = new_linetable (maxlines
);
4018 /* All symtabs must have at least two blocks */
4019 BLOCKVECTOR (s
) = new_bvect (2);
4020 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), GLOBAL_BLOCK
) = new_block (maxsyms
);
4021 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), STATIC_BLOCK
) = new_block (maxsyms
);
4022 BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), STATIC_BLOCK
)) =
4023 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), GLOBAL_BLOCK
);
4025 s
->free_code
= free_linetable
;
4026 s
->debugformat
= obsavestring ("ECOFF", 5,
4027 &objfile
->symbol_obstack
);
4031 /* Allocate a new partial_symtab NAME */
4033 static struct partial_symtab
*
4034 new_psymtab (char *name
, struct objfile
*objfile
)
4036 struct partial_symtab
*psymtab
;
4038 psymtab
= allocate_psymtab (name
, objfile
);
4039 psymtab
->section_offsets
= objfile
->section_offsets
;
4041 /* Keep a backpointer to the file's symbols */
4043 psymtab
->read_symtab_private
= ((char *)
4044 obstack_alloc (&objfile
->psymbol_obstack
,
4045 sizeof (struct symloc
)));
4046 memset ((PTR
) psymtab
->read_symtab_private
, 0, sizeof (struct symloc
));
4047 CUR_BFD (psymtab
) = cur_bfd
;
4048 DEBUG_SWAP (psymtab
) = debug_swap
;
4049 DEBUG_INFO (psymtab
) = debug_info
;
4050 PENDING_LIST (psymtab
) = pending_list
;
4052 /* The way to turn this into a symtab is to call... */
4053 psymtab
->read_symtab
= mdebug_psymtab_to_symtab
;
4058 /* Allocate a linetable array of the given SIZE. Since the struct
4059 already includes one item, we subtract one when calculating the
4060 proper size to allocate. */
4062 static struct linetable
*
4063 new_linetable (int size
)
4065 struct linetable
*l
;
4067 size
= (size
- 1) * sizeof (l
->item
) + sizeof (struct linetable
);
4068 l
= (struct linetable
*) xmalloc (size
);
4073 /* Oops, too big. Shrink it. This was important with the 2.4 linetables,
4074 I am not so sure about the 3.4 ones.
4076 Since the struct linetable already includes one item, we subtract one when
4077 calculating the proper size to allocate. */
4079 static struct linetable
*
4080 shrink_linetable (struct linetable
*lt
)
4083 return (struct linetable
*) xrealloc ((PTR
) lt
,
4084 (sizeof (struct linetable
)
4086 * sizeof (lt
->item
))));
4089 /* Allocate and zero a new blockvector of NBLOCKS blocks. */
4091 static struct blockvector
*
4092 new_bvect (int nblocks
)
4094 struct blockvector
*bv
;
4097 size
= sizeof (struct blockvector
) + nblocks
* sizeof (struct block
*);
4098 bv
= (struct blockvector
*) xzalloc (size
);
4100 BLOCKVECTOR_NBLOCKS (bv
) = nblocks
;
4105 /* Allocate and zero a new block of MAXSYMS symbols */
4107 static struct block
*
4108 new_block (int maxsyms
)
4110 int size
= sizeof (struct block
) + (maxsyms
- 1) * sizeof (struct symbol
*);
4112 return (struct block
*) xzalloc (size
);
4115 /* Ooops, too big. Shrink block B in symtab S to its minimal size.
4116 Shrink_block can also be used by add_symbol to grow a block. */
4118 static struct block
*
4119 shrink_block (struct block
*b
, struct symtab
*s
)
4122 struct blockvector
*bv
= BLOCKVECTOR (s
);
4125 /* Just reallocate it and fix references to the old one */
4127 new = (struct block
*) xrealloc ((PTR
) b
,
4128 (sizeof (struct block
)
4129 + ((BLOCK_NSYMS (b
) - 1)
4130 * sizeof (struct symbol
*))));
4132 /* Should chase pointers to old one. Fortunately, that`s just
4133 the block`s function and inferior blocks */
4134 if (BLOCK_FUNCTION (new) && SYMBOL_BLOCK_VALUE (BLOCK_FUNCTION (new)) == b
)
4135 SYMBOL_BLOCK_VALUE (BLOCK_FUNCTION (new)) = new;
4136 for (i
= 0; i
< BLOCKVECTOR_NBLOCKS (bv
); i
++)
4137 if (BLOCKVECTOR_BLOCK (bv
, i
) == b
)
4138 BLOCKVECTOR_BLOCK (bv
, i
) = new;
4139 else if (BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv
, i
)) == b
)
4140 BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv
, i
)) = new;
4144 /* Create a new symbol with printname NAME */
4146 static struct symbol
*
4147 new_symbol (char *name
)
4149 struct symbol
*s
= ((struct symbol
*)
4150 obstack_alloc (¤t_objfile
->symbol_obstack
,
4151 sizeof (struct symbol
)));
4153 memset ((PTR
) s
, 0, sizeof (*s
));
4154 SYMBOL_NAME (s
) = obsavestring (name
, strlen (name
),
4155 ¤t_objfile
->symbol_obstack
);
4156 SYMBOL_LANGUAGE (s
) = psymtab_language
;
4157 SYMBOL_INIT_DEMANGLED_NAME (s
, ¤t_objfile
->symbol_obstack
);
4161 /* Create a new type with printname NAME */
4163 static struct type
*
4164 new_type (char *name
)
4168 t
= alloc_type (current_objfile
);
4169 TYPE_NAME (t
) = name
;
4170 TYPE_CPLUS_SPECIFIC (t
) = (struct cplus_struct_type
*) &cplus_struct_default
;
4174 /* Read ECOFF debugging information from a BFD section. This is
4175 called from elfread.c. It parses the section into a
4176 ecoff_debug_info struct, and then lets the rest of the file handle
4180 elfmdebug_build_psymtabs (struct objfile
*objfile
,
4181 const struct ecoff_debug_swap
*swap
, asection
*sec
)
4183 bfd
*abfd
= objfile
->obfd
;
4184 struct ecoff_debug_info
*info
;
4186 info
= ((struct ecoff_debug_info
*)
4187 obstack_alloc (&objfile
->psymbol_obstack
,
4188 sizeof (struct ecoff_debug_info
)));
4190 if (!(*swap
->read_debug_info
) (abfd
, sec
, info
))
4191 error ("Error reading ECOFF debugging information: %s",
4192 bfd_errmsg (bfd_get_error ()));
4194 mdebug_build_psymtabs (objfile
, swap
, info
);
4198 /* Things used for calling functions in the inferior.
4199 These functions are exported to our companion
4200 mips-tdep.c file and are here because they play
4201 with the symbol-table explicitly. */
4203 /* Sigtramp: make sure we have all the necessary information
4204 about the signal trampoline code. Since the official code
4205 from MIPS does not do so, we make up that information ourselves.
4206 If they fix the library (unlikely) this code will neutralize itself. */
4208 /* FIXME: This function is called only by mips-tdep.c. It needs to be
4209 here because it calls functions defined in this file, but perhaps
4210 this could be handled in a better way. Only compile it in when
4211 tm-mips.h is included. */
4216 fixup_sigtramp (void)
4220 struct block
*b
, *b0
= NULL
;
4222 sigtramp_address
= -1;
4224 /* We have to handle the following cases here:
4225 a) The Mips library has a sigtramp label within sigvec.
4226 b) Irix has a _sigtramp which we want to use, but it also has sigvec. */
4227 s
= lookup_symbol ("sigvec", 0, VAR_NAMESPACE
, 0, NULL
);
4230 b0
= SYMBOL_BLOCK_VALUE (s
);
4231 s
= lookup_symbol ("sigtramp", b0
, VAR_NAMESPACE
, 0, NULL
);
4235 /* No sigvec or no sigtramp inside sigvec, try _sigtramp. */
4236 s
= lookup_symbol ("_sigtramp", 0, VAR_NAMESPACE
, 0, NULL
);
4239 /* But maybe this program uses its own version of sigvec */
4243 /* Did we or MIPSco fix the library ? */
4244 if (SYMBOL_CLASS (s
) == LOC_BLOCK
)
4246 sigtramp_address
= BLOCK_START (SYMBOL_BLOCK_VALUE (s
));
4247 sigtramp_end
= BLOCK_END (SYMBOL_BLOCK_VALUE (s
));
4251 sigtramp_address
= SYMBOL_VALUE (s
);
4252 sigtramp_end
= sigtramp_address
+ 0x88; /* black magic */
4254 /* But what symtab does it live in ? */
4255 st
= find_pc_symtab (SYMBOL_VALUE (s
));
4258 * Ok, there goes the fix: turn it into a procedure, with all the
4259 * needed info. Note we make it a nested procedure of sigvec,
4260 * which is the way the (assembly) code is actually written.
4262 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
4263 SYMBOL_CLASS (s
) = LOC_BLOCK
;
4264 SYMBOL_TYPE (s
) = init_type (TYPE_CODE_FUNC
, 4, 0, (char *) NULL
,
4266 TYPE_TARGET_TYPE (SYMBOL_TYPE (s
)) = mdebug_type_void
;
4268 /* Need a block to allocate MIPS_EFI_SYMBOL_NAME in */
4270 SYMBOL_BLOCK_VALUE (s
) = b
;
4271 BLOCK_START (b
) = sigtramp_address
;
4272 BLOCK_END (b
) = sigtramp_end
;
4273 BLOCK_FUNCTION (b
) = s
;
4274 BLOCK_SUPERBLOCK (b
) = BLOCK_SUPERBLOCK (b0
);
4278 /* Make a MIPS_EFI_SYMBOL_NAME entry for it */
4280 struct mips_extra_func_info
*e
=
4281 ((struct mips_extra_func_info
*)
4282 xzalloc (sizeof (struct mips_extra_func_info
)));
4284 e
->numargs
= 0; /* the kernel thinks otherwise */
4285 e
->pdr
.frameoffset
= 32;
4286 e
->pdr
.framereg
= SP_REGNUM
;
4287 /* Note that setting pcreg is no longer strictly necessary as
4288 mips_frame_saved_pc is now aware of signal handler frames. */
4289 e
->pdr
.pcreg
= PC_REGNUM
;
4290 e
->pdr
.regmask
= -2;
4291 /* Offset to saved r31, in the sigtramp case the saved registers
4292 are above the frame in the sigcontext.
4293 We have 4 alignment bytes, 12 bytes for onstack, mask and pc,
4294 32 * 4 bytes for the general registers, 12 bytes for mdhi, mdlo, ownedfp
4295 and 32 * 4 bytes for the floating point registers. */
4296 e
->pdr
.regoffset
= 4 + 12 + 31 * 4;
4297 e
->pdr
.fregmask
= -1;
4298 /* Offset to saved f30 (first saved *double* register). */
4299 e
->pdr
.fregoffset
= 4 + 12 + 32 * 4 + 12 + 30 * 4;
4300 e
->pdr
.isym
= (long) s
;
4301 e
->pdr
.adr
= sigtramp_address
;
4303 current_objfile
= st
->objfile
; /* Keep new_symbol happy */
4304 s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
4305 SYMBOL_VALUE (s
) = (long) e
;
4306 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
4307 SYMBOL_CLASS (s
) = LOC_CONST
;
4308 SYMBOL_TYPE (s
) = mdebug_type_void
;
4309 current_objfile
= NULL
;
4312 BLOCK_SYM (b
, BLOCK_NSYMS (b
)++) = s
;
4315 #endif /* TM_MIPS_H */
4318 _initialize_mdebugread (void)
4321 init_type (TYPE_CODE_VOID
, 1,
4323 "void", (struct objfile
*) NULL
);
4325 init_type (TYPE_CODE_INT
, 1,
4327 "char", (struct objfile
*) NULL
);
4328 mdebug_type_unsigned_char
=
4329 init_type (TYPE_CODE_INT
, 1,
4331 "unsigned char", (struct objfile
*) NULL
);
4333 init_type (TYPE_CODE_INT
, 2,
4335 "short", (struct objfile
*) NULL
);
4336 mdebug_type_unsigned_short
=
4337 init_type (TYPE_CODE_INT
, 2,
4339 "unsigned short", (struct objfile
*) NULL
);
4340 mdebug_type_int_32
=
4341 init_type (TYPE_CODE_INT
, 4,
4343 "int", (struct objfile
*) NULL
);
4344 mdebug_type_unsigned_int_32
=
4345 init_type (TYPE_CODE_INT
, 4,
4347 "unsigned int", (struct objfile
*) NULL
);
4348 mdebug_type_int_64
=
4349 init_type (TYPE_CODE_INT
, 8,
4351 "int", (struct objfile
*) NULL
);
4352 mdebug_type_unsigned_int_64
=
4353 init_type (TYPE_CODE_INT
, 8,
4355 "unsigned int", (struct objfile
*) NULL
);
4356 mdebug_type_long_32
=
4357 init_type (TYPE_CODE_INT
, 4,
4359 "long", (struct objfile
*) NULL
);
4360 mdebug_type_unsigned_long_32
=
4361 init_type (TYPE_CODE_INT
, 4,
4363 "unsigned long", (struct objfile
*) NULL
);
4364 mdebug_type_long_64
=
4365 init_type (TYPE_CODE_INT
, 8,
4367 "long", (struct objfile
*) NULL
);
4368 mdebug_type_unsigned_long_64
=
4369 init_type (TYPE_CODE_INT
, 8,
4371 "unsigned long", (struct objfile
*) NULL
);
4372 mdebug_type_long_long_64
=
4373 init_type (TYPE_CODE_INT
, 8,
4375 "long long", (struct objfile
*) NULL
);
4376 mdebug_type_unsigned_long_long_64
=
4377 init_type (TYPE_CODE_INT
, 8,
4379 "unsigned long long", (struct objfile
*) NULL
);
4380 mdebug_type_adr_32
=
4381 init_type (TYPE_CODE_PTR
, 4,
4383 "adr_32", (struct objfile
*) NULL
);
4384 TYPE_TARGET_TYPE (mdebug_type_adr_32
) = mdebug_type_void
;
4385 mdebug_type_adr_64
=
4386 init_type (TYPE_CODE_PTR
, 8,
4388 "adr_64", (struct objfile
*) NULL
);
4389 TYPE_TARGET_TYPE (mdebug_type_adr_64
) = mdebug_type_void
;
4391 init_type (TYPE_CODE_FLT
, TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
4393 "float", (struct objfile
*) NULL
);
4394 mdebug_type_double
=
4395 init_type (TYPE_CODE_FLT
, TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
4397 "double", (struct objfile
*) NULL
);
4398 mdebug_type_complex
=
4399 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
4401 "complex", (struct objfile
*) NULL
);
4402 TYPE_TARGET_TYPE (mdebug_type_complex
) = mdebug_type_float
;
4403 mdebug_type_double_complex
=
4404 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
4406 "double complex", (struct objfile
*) NULL
);
4407 TYPE_TARGET_TYPE (mdebug_type_double_complex
) = mdebug_type_double
;
4409 /* Is a "string" the way btString means it the same as TYPE_CODE_STRING?
4411 mdebug_type_string
=
4412 init_type (TYPE_CODE_STRING
,
4413 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
4415 (struct objfile
*) NULL
);
4417 /* We use TYPE_CODE_INT to print these as integers. Does this do any
4418 good? Would we be better off with TYPE_CODE_ERROR? Should
4419 TYPE_CODE_ERROR print things in hex if it knows the size? */
4420 mdebug_type_fixed_dec
=
4421 init_type (TYPE_CODE_INT
,
4422 TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
4424 (struct objfile
*) NULL
);
4426 mdebug_type_float_dec
=
4427 init_type (TYPE_CODE_ERROR
,
4428 TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
4429 0, "floating decimal",
4430 (struct objfile
*) NULL
);
4432 nodebug_func_symbol_type
= init_type (TYPE_CODE_FUNC
, 1, 0,
4433 "<function, no debug info>", NULL
);
4434 TYPE_TARGET_TYPE (nodebug_func_symbol_type
) = mdebug_type_int
;
4435 nodebug_var_symbol_type
=
4436 init_type (TYPE_CODE_INT
, TARGET_INT_BIT
/ HOST_CHAR_BIT
, 0,
4437 "<variable, no debug info>", NULL
);