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 */
416 PTR p
= xmalloc (size
);
422 /* Exported procedure: Builds a symtab from the PST partial one.
423 Restores the environment in effect when PST was created, delegates
424 most of the work to an ancillary procedure, and sorts
425 and reorders the symtab list at the end */
428 mdebug_psymtab_to_symtab (pst
)
429 struct partial_symtab
*pst
;
437 printf_filtered ("Reading in symbols for %s...", pst
->filename
);
438 gdb_flush (gdb_stdout
);
441 next_symbol_text_func
= mdebug_next_symbol_text
;
443 psymtab_to_symtab_1 (pst
, pst
->filename
);
445 /* Match with global symbols. This only needs to be done once,
446 after all of the symtabs and dependencies have been read in. */
447 scan_file_globals (pst
->objfile
);
450 printf_filtered ("done.\n");
453 /* File-level interface functions */
455 /* Find a file descriptor given its index RF relative to a file CF */
465 fdrs
= debug_info
->fdr
;
467 /* Object files do not have the RFD table, all refs are absolute */
470 (*debug_swap
->swap_rfd_in
) (cur_bfd
,
471 ((char *) debug_info
->external_rfd
473 * debug_swap
->external_rfd_size
)),
478 /* Return a safer print NAME for a file descriptor */
485 return "<stripped file>";
488 return debug_info
->ss
+ f
->issBase
+ f
->rss
;
492 /* Read in and parse the symtab of the file OBJFILE. Symbols from
493 different sections are relocated via the SECTION_OFFSETS. */
496 mdebug_build_psymtabs (objfile
, swap
, info
)
497 struct objfile
*objfile
;
498 const struct ecoff_debug_swap
*swap
;
499 struct ecoff_debug_info
*info
;
501 cur_bfd
= objfile
->obfd
;
505 /* Make sure all the FDR information is swapped in. */
506 if (info
->fdr
== (FDR
*) NULL
)
512 info
->fdr
= (FDR
*) obstack_alloc (&objfile
->psymbol_obstack
,
513 (info
->symbolic_header
.ifdMax
515 fdr_src
= info
->external_fdr
;
517 + info
->symbolic_header
.ifdMax
* swap
->external_fdr_size
);
519 for (; fdr_src
< fdr_end
; fdr_src
+= swap
->external_fdr_size
, fdr_ptr
++)
520 (*swap
->swap_fdr_in
) (objfile
->obfd
, fdr_src
, fdr_ptr
);
523 parse_partial_symbols (objfile
);
526 /* Check to make sure file was compiled with -g. If not, warn the
527 user of this limitation. */
528 if (compare_glevel (max_glevel
, GLEVEL_2
) < 0)
530 if (max_gdbinfo
== 0)
531 printf_unfiltered ("\n%s not compiled with -g, debugging support is limited.\n",
533 printf_unfiltered ("You should compile with -g2 or -g3 for best debugging support.\n");
534 gdb_flush (gdb_stdout
);
539 /* Local utilities */
541 /* Map of FDR indexes to partial symtabs */
545 struct partial_symtab
*pst
; /* the psymtab proper */
546 long n_globals
; /* exported globals (external symbols) */
547 long globals_offset
; /* cumulative */
551 /* Utility stack, used to nest procedures and blocks properly.
552 It is a doubly linked list, to avoid too many alloc/free.
553 Since we might need it quite a few times it is NOT deallocated
556 static struct parse_stack
558 struct parse_stack
*next
, *prev
;
559 struct symtab
*cur_st
; /* Current symtab. */
560 struct block
*cur_block
; /* Block in it. */
562 /* What are we parsing. stFile, or stBlock are for files and
563 blocks. stProc or stStaticProc means we have seen the start of a
564 procedure, but not the start of the block within in. When we see
565 the start of that block, we change it to stNil, without pushing a
566 new block, i.e. stNil means both a procedure and a block. */
570 int maxsyms
; /* Max symbols in this block. */
571 struct type
*cur_type
; /* Type we parse fields for. */
572 int cur_field
; /* Field number in cur_type. */
573 CORE_ADDR procadr
; /* Start addres of this procedure */
574 int numargs
; /* Its argument count */
577 *top_stack
; /* Top stack ptr */
580 /* Enter a new lexical context */
585 struct parse_stack
*new;
587 /* Reuse frames if possible */
588 if (top_stack
&& top_stack
->prev
)
589 new = top_stack
->prev
;
591 new = (struct parse_stack
*) xzalloc (sizeof (struct parse_stack
));
592 /* Initialize new frame with previous content */
595 register struct parse_stack
*prev
= new->prev
;
598 top_stack
->prev
= new;
600 new->next
= top_stack
;
605 /* Exit a lexical context */
613 top_stack
= top_stack
->next
;
617 /* Cross-references might be to things we haven't looked at
618 yet, e.g. type references. To avoid too many type
619 duplications we keep a quick fixup table, an array
620 of lists of references indexed by file descriptor */
622 struct mdebug_pending
624 struct mdebug_pending
*next
; /* link */
625 char *s
; /* the unswapped symbol */
626 struct type
*t
; /* its partial type descriptor */
630 /* The pending information is kept for an entire object file, and used
631 to be in the sym_private field. I took it out when I split
632 mdebugread from mipsread, because this might not be the only type
633 of symbols read from an object file. Instead, we allocate the
634 pending information table when we create the partial symbols, and
635 we store a pointer to the single table in each psymtab. */
637 static struct mdebug_pending
**pending_list
;
639 /* Check whether we already saw symbol SH in file FH */
641 static struct mdebug_pending
*
642 is_pending_symbol (fh
, sh
)
646 int f_idx
= fh
- debug_info
->fdr
;
647 register struct mdebug_pending
*p
;
649 /* Linear search is ok, list is typically no more than 10 deep */
650 for (p
= pending_list
[f_idx
]; p
; p
= p
->next
)
656 /* Add a new symbol SH of type T */
659 add_pending (fh
, sh
, t
)
664 int f_idx
= fh
- debug_info
->fdr
;
665 struct mdebug_pending
*p
= is_pending_symbol (fh
, sh
);
667 /* Make sure we do not make duplicates */
670 p
= ((struct mdebug_pending
*)
671 obstack_alloc (¤t_objfile
->psymbol_obstack
,
672 sizeof (struct mdebug_pending
)));
675 p
->next
= pending_list
[f_idx
];
676 pending_list
[f_idx
] = p
;
681 /* Parsing Routines proper. */
683 /* Parse a single symbol. Mostly just make up a GDB symbol for it.
684 For blocks, procedures and types we open a new lexical context.
685 This is basically just a big switch on the symbol's type. Argument
686 AX is the base pointer of aux symbols for this file (fh->iauxBase).
687 EXT_SH points to the unswapped symbol, which is needed for struct,
688 union, etc., types; it is NULL for an EXTR. BIGEND says whether
689 aux symbols are big-endian or little-endian. Return count of
690 SYMR's handled (normally one). */
693 parse_symbol (sh
, ax
, ext_sh
, bigend
, section_offsets
, objfile
)
698 struct section_offsets
*section_offsets
;
699 struct objfile
*objfile
;
701 const bfd_size_type external_sym_size
= debug_swap
->external_sym_size
;
702 void (*const swap_sym_in
) (bfd
*, PTR
, SYMR
*) = debug_swap
->swap_sym_in
;
706 struct mdebug_pending
*pend
;
710 enum address_class
class;
712 long svalue
= sh
->value
;
715 if (ext_sh
== (char *) NULL
)
716 name
= debug_info
->ssext
+ sh
->iss
;
718 name
= debug_info
->ss
+ cur_fdr
->issBase
+ sh
->iss
;
724 /* Do not relocate relative values.
725 The value of a stEnd symbol is the displacement from the
726 corresponding start symbol value.
727 The value of a stBlock symbol is the displacement from the
728 procedure address. */
729 if (sh
->st
!= stEnd
&& sh
->st
!= stBlock
)
730 sh
->value
+= ANOFFSET (section_offsets
, SECT_OFF_TEXT (objfile
));
737 sh
->value
+= ANOFFSET (section_offsets
, SECT_OFF_DATA (objfile
));
741 sh
->value
+= ANOFFSET (section_offsets
, SECT_OFF_BSS (objfile
));
750 case stGlobal
: /* external symbol, goes into global block */
752 b
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack
->cur_st
),
754 s
= new_symbol (name
);
755 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
758 case stStatic
: /* static data, goes into current block. */
760 b
= top_stack
->cur_block
;
761 s
= new_symbol (name
);
762 if (SC_IS_COMMON (sh
->sc
))
764 /* It is a FORTRAN common block. At least for SGI Fortran the
765 address is not in the symbol; we need to fix it later in
766 scan_file_globals. */
767 int bucket
= hashname (SYMBOL_NAME (s
));
768 SYMBOL_VALUE_CHAIN (s
) = global_sym_chain
[bucket
];
769 global_sym_chain
[bucket
] = s
;
772 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
775 case stLocal
: /* local variable, goes into current block */
776 if (sh
->sc
== scRegister
)
778 class = LOC_REGISTER
;
779 svalue
= ECOFF_REG_TO_REGNUM (svalue
);
783 b
= top_stack
->cur_block
;
784 s
= new_symbol (name
);
785 SYMBOL_VALUE (s
) = svalue
;
787 data
: /* Common code for symbols describing data */
788 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
789 SYMBOL_CLASS (s
) = class;
792 /* Type could be missing if file is compiled without debugging info. */
793 if (SC_IS_UNDEF (sh
->sc
)
794 || sh
->sc
== scNil
|| sh
->index
== indexNil
)
795 SYMBOL_TYPE (s
) = nodebug_var_symbol_type
;
797 SYMBOL_TYPE (s
) = parse_type (cur_fd
, ax
, sh
->index
, 0, bigend
, name
);
798 /* Value of a data symbol is its memory address */
801 case stParam
: /* arg to procedure, goes into current block */
803 found_ecoff_debugging_info
= 1;
804 top_stack
->numargs
++;
806 /* Special GNU C++ name. */
807 if (is_cplus_marker (name
[0]) && name
[1] == 't' && name
[2] == 0)
808 name
= "this"; /* FIXME, not alloc'd in obstack */
809 s
= new_symbol (name
);
811 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
815 /* Pass by value in register. */
816 SYMBOL_CLASS (s
) = LOC_REGPARM
;
817 svalue
= ECOFF_REG_TO_REGNUM (svalue
);
820 /* Pass by reference on stack. */
821 SYMBOL_CLASS (s
) = LOC_REF_ARG
;
824 /* Pass by reference in register. */
825 SYMBOL_CLASS (s
) = LOC_REGPARM_ADDR
;
826 svalue
= ECOFF_REG_TO_REGNUM (svalue
);
829 /* Pass by value on stack. */
830 SYMBOL_CLASS (s
) = LOC_ARG
;
833 SYMBOL_VALUE (s
) = svalue
;
834 SYMBOL_TYPE (s
) = parse_type (cur_fd
, ax
, sh
->index
, 0, bigend
, name
);
835 add_symbol (s
, top_stack
->cur_block
);
838 case stLabel
: /* label, goes into current block */
839 s
= new_symbol (name
);
840 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
; /* so that it can be used */
841 SYMBOL_CLASS (s
) = LOC_LABEL
; /* but not misused */
842 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
843 SYMBOL_TYPE (s
) = mdebug_type_int
;
844 add_symbol (s
, top_stack
->cur_block
);
847 case stProc
: /* Procedure, usually goes into global block */
848 case stStaticProc
: /* Static procedure, goes into current block */
849 s
= new_symbol (name
);
850 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
851 SYMBOL_CLASS (s
) = LOC_BLOCK
;
852 /* Type of the return value */
853 if (SC_IS_UNDEF (sh
->sc
) || sh
->sc
== scNil
)
857 t
= parse_type (cur_fd
, ax
, sh
->index
+ 1, 0, bigend
, name
);
858 if (STREQ (name
, "malloc") && t
->code
== TYPE_CODE_VOID
)
860 /* I don't know why, but, at least under Alpha GNU/Linux,
861 when linking against a malloc without debugging
862 symbols, its read as a function returning void---this
863 is bad because it means we cannot call functions with
864 string arguments interactively; i.e., "call
865 printf("howdy\n")" would fail with the error message
866 "program has no memory available". To avoid this, we
867 patch up the type and make it void*
868 instead. (davidm@azstarnet.com)
870 t
= make_pointer_type (t
, NULL
);
873 b
= top_stack
->cur_block
;
874 if (sh
->st
== stProc
)
876 struct blockvector
*bv
= BLOCKVECTOR (top_stack
->cur_st
);
877 /* The next test should normally be true, but provides a
878 hook for nested functions (which we don't want to make
880 if (b
== BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
))
881 b
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
882 /* Irix 5 sometimes has duplicate names for the same
883 function. We want to add such names up at the global
884 level, not as a nested function. */
885 else if (sh
->value
== top_stack
->procadr
)
886 b
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
890 /* Make a type for the procedure itself */
891 SYMBOL_TYPE (s
) = lookup_function_type (t
);
893 /* Create and enter a new lexical context */
894 b
= new_block (top_stack
->maxsyms
);
895 SYMBOL_BLOCK_VALUE (s
) = b
;
896 BLOCK_FUNCTION (b
) = s
;
897 BLOCK_START (b
) = BLOCK_END (b
) = sh
->value
;
898 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
899 add_block (b
, top_stack
->cur_st
);
901 /* Not if we only have partial info */
902 if (SC_IS_UNDEF (sh
->sc
) || sh
->sc
== scNil
)
906 top_stack
->cur_block
= b
;
907 top_stack
->blocktype
= sh
->st
;
908 top_stack
->cur_type
= SYMBOL_TYPE (s
);
909 top_stack
->cur_field
= -1;
910 top_stack
->procadr
= sh
->value
;
911 top_stack
->numargs
= 0;
914 /* Beginning of code for structure, union, and enum definitions.
915 They all share a common set of local variables, defined here. */
917 enum type_code type_code
;
923 case stStruct
: /* Start a block defining a struct type */
924 type_code
= TYPE_CODE_STRUCT
;
925 goto structured_common
;
927 case stUnion
: /* Start a block defining a union type */
928 type_code
= TYPE_CODE_UNION
;
929 goto structured_common
;
931 case stEnum
: /* Start a block defining an enum type */
932 type_code
= TYPE_CODE_ENUM
;
933 goto structured_common
;
935 case stBlock
: /* Either a lexical block, or some type */
936 if (sh
->sc
!= scInfo
&& !SC_IS_COMMON (sh
->sc
))
937 goto case_stBlock_code
; /* Lexical block */
939 type_code
= TYPE_CODE_UNDEF
; /* We have a type. */
941 /* Common code for handling struct, union, enum, and/or as-yet-
942 unknown-type blocks of info about structured data. `type_code'
943 has been set to the proper TYPE_CODE, if we know it. */
945 found_ecoff_debugging_info
= 1;
947 top_stack
->blocktype
= stBlock
;
949 /* First count the number of fields and the highest value. */
952 for (ext_tsym
= ext_sh
+ external_sym_size
;
954 ext_tsym
+= external_sym_size
)
958 (*swap_sym_in
) (cur_bfd
, ext_tsym
, &tsym
);
966 if (nfields
== 0 && type_code
== TYPE_CODE_UNDEF
)
968 /* If the type of the member is Nil (or Void),
969 without qualifiers, assume the tag is an
971 Alpha cc -migrate enums are recognized by a zero
972 index and a zero symbol value.
973 DU 4.0 cc enums are recognized by a member type of
974 btEnum without qualifiers and a zero symbol value. */
975 if (tsym
.index
== indexNil
976 || (tsym
.index
== 0 && sh
->value
== 0))
977 type_code
= TYPE_CODE_ENUM
;
980 (*debug_swap
->swap_tir_in
) (bigend
,
981 &ax
[tsym
.index
].a_ti
,
983 if ((tir
.bt
== btNil
|| tir
.bt
== btVoid
984 || (tir
.bt
== btEnum
&& sh
->value
== 0))
986 type_code
= TYPE_CODE_ENUM
;
990 if (tsym
.value
> max_value
)
991 max_value
= tsym
.value
;
1000 /* This is a no-op; is it trying to tell us something
1001 we should be checking? */
1002 if (tsym
.sc
== scVariant
); /*UNIMPLEMENTED */
1004 if (tsym
.index
!= 0)
1006 /* This is something like a struct within a
1007 struct. Skip over the fields of the inner
1008 struct. The -1 is because the for loop will
1009 increment ext_tsym. */
1010 ext_tsym
= ((char *) debug_info
->external_sym
1011 + ((cur_fdr
->isymBase
+ tsym
.index
- 1)
1012 * external_sym_size
));
1018 /* mips cc puts out a typedef for struct x if it is not yet
1019 defined when it encounters
1020 struct y { struct x *xp; };
1025 /* Irix5 cc puts out a stIndirect for struct x if it is not
1026 yet defined when it encounters
1027 struct y { struct x *xp; };
1032 complain (&block_member_complaint
, tsym
.st
);
1037 /* In an stBlock, there is no way to distinguish structs,
1038 unions, and enums at this point. This is a bug in the
1039 original design (that has been fixed with the recent
1040 addition of the stStruct, stUnion, and stEnum symbol
1041 types.) The way you can tell is if/when you see a variable
1042 or field of that type. In that case the variable's type
1043 (in the AUX table) says if the type is struct, union, or
1044 enum, and points back to the stBlock here. So you can
1045 patch the tag kind up later - but only if there actually is
1046 a variable or field of that type.
1048 So until we know for sure, we will guess at this point.
1050 If the first member has index==indexNil or a void type,
1051 assume we have an enumeration.
1052 Otherwise, if there is more than one member, and all
1053 the members have offset 0, assume we have a union.
1054 Otherwise, assume we have a struct.
1056 The heuristic could guess wrong in the case of of an
1057 enumeration with no members or a union with one (or zero)
1058 members, or when all except the last field of a struct have
1059 width zero. These are uncommon and/or illegal situations,
1060 and in any case guessing wrong probably doesn't matter
1063 But if we later do find out we were wrong, we fixup the tag
1064 kind. Members of an enumeration must be handled
1065 differently from struct/union fields, and that is harder to
1066 patch up, but luckily we shouldn't need to. (If there are
1067 any enumeration members, we can tell for sure it's an enum
1070 if (type_code
== TYPE_CODE_UNDEF
)
1072 if (nfields
> 1 && max_value
== 0)
1073 type_code
= TYPE_CODE_UNION
;
1075 type_code
= TYPE_CODE_STRUCT
;
1078 /* Create a new type or use the pending type. */
1079 pend
= is_pending_symbol (cur_fdr
, ext_sh
);
1080 if (pend
== (struct mdebug_pending
*) NULL
)
1082 t
= new_type (NULL
);
1083 add_pending (cur_fdr
, ext_sh
, t
);
1088 /* Do not set the tag name if it is a compiler generated tag name
1089 (.Fxx or .xxfake or empty) for unnamed struct/union/enums.
1090 Alpha cc puts out an sh->iss of zero for those. */
1091 if (sh
->iss
== 0 || name
[0] == '.' || name
[0] == '\0')
1092 TYPE_TAG_NAME (t
) = NULL
;
1094 TYPE_TAG_NAME (t
) = obconcat (¤t_objfile
->symbol_obstack
,
1097 TYPE_CODE (t
) = type_code
;
1098 TYPE_LENGTH (t
) = sh
->value
;
1099 TYPE_NFIELDS (t
) = nfields
;
1100 TYPE_FIELDS (t
) = f
= ((struct field
*)
1102 nfields
* sizeof (struct field
)));
1104 if (type_code
== TYPE_CODE_ENUM
)
1106 int unsigned_enum
= 1;
1108 /* This is a non-empty enum. */
1110 /* DEC c89 has the number of enumerators in the sh.value field,
1111 not the type length, so we have to compensate for that
1112 incompatibility quirk.
1113 This might do the wrong thing for an enum with one or two
1114 enumerators and gcc -gcoff -fshort-enums, but these cases
1115 are hopefully rare enough.
1116 Alpha cc -migrate has a sh.value field of zero, we adjust
1118 if (TYPE_LENGTH (t
) == TYPE_NFIELDS (t
)
1119 || TYPE_LENGTH (t
) == 0)
1120 TYPE_LENGTH (t
) = TARGET_INT_BIT
/ HOST_CHAR_BIT
;
1121 for (ext_tsym
= ext_sh
+ external_sym_size
;
1123 ext_tsym
+= external_sym_size
)
1126 struct symbol
*enum_sym
;
1128 (*swap_sym_in
) (cur_bfd
, ext_tsym
, &tsym
);
1130 if (tsym
.st
!= stMember
)
1133 FIELD_BITPOS (*f
) = tsym
.value
;
1134 FIELD_TYPE (*f
) = t
;
1135 FIELD_NAME (*f
) = debug_info
->ss
+ cur_fdr
->issBase
+ tsym
.iss
;
1136 FIELD_BITSIZE (*f
) = 0;
1138 enum_sym
= ((struct symbol
*)
1139 obstack_alloc (¤t_objfile
->symbol_obstack
,
1140 sizeof (struct symbol
)));
1141 memset ((PTR
) enum_sym
, 0, sizeof (struct symbol
));
1142 SYMBOL_NAME (enum_sym
) =
1143 obsavestring (f
->name
, strlen (f
->name
),
1144 ¤t_objfile
->symbol_obstack
);
1145 SYMBOL_CLASS (enum_sym
) = LOC_CONST
;
1146 SYMBOL_TYPE (enum_sym
) = t
;
1147 SYMBOL_NAMESPACE (enum_sym
) = VAR_NAMESPACE
;
1148 SYMBOL_VALUE (enum_sym
) = tsym
.value
;
1149 if (SYMBOL_VALUE (enum_sym
) < 0)
1151 add_symbol (enum_sym
, top_stack
->cur_block
);
1153 /* Skip the stMembers that we've handled. */
1158 TYPE_FLAGS (t
) |= TYPE_FLAG_UNSIGNED
;
1160 /* make this the current type */
1161 top_stack
->cur_type
= t
;
1162 top_stack
->cur_field
= 0;
1164 /* Do not create a symbol for alpha cc unnamed structs. */
1168 /* gcc puts out an empty struct for an opaque struct definitions,
1169 do not create a symbol for it either. */
1170 if (TYPE_NFIELDS (t
) == 0)
1172 TYPE_FLAGS (t
) |= TYPE_FLAG_STUB
;
1176 s
= new_symbol (name
);
1177 SYMBOL_NAMESPACE (s
) = STRUCT_NAMESPACE
;
1178 SYMBOL_CLASS (s
) = LOC_TYPEDEF
;
1179 SYMBOL_VALUE (s
) = 0;
1180 SYMBOL_TYPE (s
) = t
;
1181 add_symbol (s
, top_stack
->cur_block
);
1184 /* End of local variables shared by struct, union, enum, and
1185 block (as yet unknown struct/union/enum) processing. */
1189 found_ecoff_debugging_info
= 1;
1190 /* beginnning of (code) block. Value of symbol
1191 is the displacement from procedure start */
1192 push_parse_stack ();
1194 /* Do not start a new block if this is the outermost block of a
1195 procedure. This allows the LOC_BLOCK symbol to point to the
1196 block with the local variables, so funcname::var works. */
1197 if (top_stack
->blocktype
== stProc
1198 || top_stack
->blocktype
== stStaticProc
)
1200 top_stack
->blocktype
= stNil
;
1204 top_stack
->blocktype
= stBlock
;
1205 b
= new_block (top_stack
->maxsyms
);
1206 BLOCK_START (b
) = sh
->value
+ top_stack
->procadr
;
1207 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
1208 top_stack
->cur_block
= b
;
1209 add_block (b
, top_stack
->cur_st
);
1212 case stEnd
: /* end (of anything) */
1213 if (sh
->sc
== scInfo
|| SC_IS_COMMON (sh
->sc
))
1215 /* Finished with type */
1216 top_stack
->cur_type
= 0;
1218 else if (sh
->sc
== scText
&&
1219 (top_stack
->blocktype
== stProc
||
1220 top_stack
->blocktype
== stStaticProc
))
1222 /* Finished with procedure */
1223 struct blockvector
*bv
= BLOCKVECTOR (top_stack
->cur_st
);
1224 struct mips_extra_func_info
*e
;
1226 struct type
*ftype
= top_stack
->cur_type
;
1229 BLOCK_END (top_stack
->cur_block
) += sh
->value
; /* size */
1231 /* Make up special symbol to contain procedure specific info */
1232 s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
1233 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
1234 SYMBOL_CLASS (s
) = LOC_CONST
;
1235 SYMBOL_TYPE (s
) = mdebug_type_void
;
1236 e
= ((struct mips_extra_func_info
*)
1237 obstack_alloc (¤t_objfile
->symbol_obstack
,
1238 sizeof (struct mips_extra_func_info
)));
1239 memset ((PTR
) e
, 0, sizeof (struct mips_extra_func_info
));
1240 SYMBOL_VALUE (s
) = (long) e
;
1241 e
->numargs
= top_stack
->numargs
;
1242 e
->pdr
.framereg
= -1;
1243 add_symbol (s
, top_stack
->cur_block
);
1245 /* Reallocate symbols, saving memory */
1246 b
= shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
1248 /* f77 emits proc-level with address bounds==[0,0],
1249 So look for such child blocks, and patch them. */
1250 for (i
= 0; i
< BLOCKVECTOR_NBLOCKS (bv
); i
++)
1252 struct block
*b_bad
= BLOCKVECTOR_BLOCK (bv
, i
);
1253 if (BLOCK_SUPERBLOCK (b_bad
) == b
1254 && BLOCK_START (b_bad
) == top_stack
->procadr
1255 && BLOCK_END (b_bad
) == top_stack
->procadr
)
1257 BLOCK_START (b_bad
) = BLOCK_START (b
);
1258 BLOCK_END (b_bad
) = BLOCK_END (b
);
1262 if (TYPE_NFIELDS (ftype
) <= 0)
1264 /* No parameter type information is recorded with the function's
1265 type. Set that from the type of the parameter symbols. */
1266 int nparams
= top_stack
->numargs
;
1272 TYPE_NFIELDS (ftype
) = nparams
;
1273 TYPE_FIELDS (ftype
) = (struct field
*)
1274 TYPE_ALLOC (ftype
, nparams
* sizeof (struct field
));
1276 for (i
= iparams
= 0; iparams
< nparams
; i
++)
1278 sym
= BLOCK_SYM (b
, i
);
1279 switch (SYMBOL_CLASS (sym
))
1284 case LOC_REGPARM_ADDR
:
1285 TYPE_FIELD_TYPE (ftype
, iparams
) = SYMBOL_TYPE (sym
);
1295 else if (sh
->sc
== scText
&& top_stack
->blocktype
== stBlock
)
1297 /* End of (code) block. The value of the symbol is the
1298 displacement from the procedure`s start address of the
1299 end of this block. */
1300 BLOCK_END (top_stack
->cur_block
) = sh
->value
+ top_stack
->procadr
;
1301 shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
1303 else if (sh
->sc
== scText
&& top_stack
->blocktype
== stNil
)
1305 /* End of outermost block. Pop parse stack and ignore. The
1306 following stEnd of stProc will take care of the block. */
1309 else if (sh
->sc
== scText
&& top_stack
->blocktype
== stFile
)
1311 /* End of file. Pop parse stack and ignore. Higher
1312 level code deals with this. */
1316 complain (&stEnd_complaint
, sh
->sc
);
1318 pop_parse_stack (); /* restore previous lexical context */
1321 case stMember
: /* member of struct or union */
1322 f
= &TYPE_FIELDS (top_stack
->cur_type
)[top_stack
->cur_field
++];
1323 FIELD_NAME (*f
) = name
;
1324 FIELD_BITPOS (*f
) = sh
->value
;
1326 FIELD_TYPE (*f
) = parse_type (cur_fd
, ax
, sh
->index
, &bitsize
, bigend
, name
);
1327 FIELD_BITSIZE (*f
) = bitsize
;
1330 case stIndirect
: /* forward declaration on Irix5 */
1331 /* Forward declarations from Irix5 cc are handled by cross_ref,
1335 case stTypedef
: /* type definition */
1336 found_ecoff_debugging_info
= 1;
1338 /* Typedefs for forward declarations and opaque structs from alpha cc
1339 are handled by cross_ref, skip them. */
1343 /* Parse the type or use the pending type. */
1344 pend
= is_pending_symbol (cur_fdr
, ext_sh
);
1345 if (pend
== (struct mdebug_pending
*) NULL
)
1347 t
= parse_type (cur_fd
, ax
, sh
->index
, (int *) NULL
, bigend
, name
);
1348 add_pending (cur_fdr
, ext_sh
, t
);
1353 /* mips cc puts out a typedef with the name of the struct for forward
1354 declarations. These should not go into the symbol table and
1355 TYPE_NAME should not be set for them.
1356 They can't be distinguished from an intentional typedef to
1357 the same name however:
1359 struct x { int ix; int jx; };
1363 struct xx {int ixx; int jxx; };
1364 generates a cross referencing stTypedef for x and xx.
1365 The user visible effect of this is that the type of a pointer
1366 to struct foo sometimes is given as `foo *' instead of `struct foo *'.
1367 The problem is fixed with alpha cc and Irix5 cc. */
1369 /* However if the typedef cross references to an opaque aggregate, it
1370 is safe to omit it from the symbol table. */
1372 if (has_opaque_xref (cur_fdr
, sh
))
1374 s
= new_symbol (name
);
1375 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
1376 SYMBOL_CLASS (s
) = LOC_TYPEDEF
;
1377 SYMBOL_BLOCK_VALUE (s
) = top_stack
->cur_block
;
1378 SYMBOL_TYPE (s
) = t
;
1379 add_symbol (s
, top_stack
->cur_block
);
1381 /* Incomplete definitions of structs should not get a name. */
1382 if (TYPE_NAME (SYMBOL_TYPE (s
)) == NULL
1383 && (TYPE_NFIELDS (SYMBOL_TYPE (s
)) != 0
1384 || (TYPE_CODE (SYMBOL_TYPE (s
)) != TYPE_CODE_STRUCT
1385 && TYPE_CODE (SYMBOL_TYPE (s
)) != TYPE_CODE_UNION
)))
1387 if (TYPE_CODE (SYMBOL_TYPE (s
)) == TYPE_CODE_PTR
1388 || TYPE_CODE (SYMBOL_TYPE (s
)) == TYPE_CODE_FUNC
)
1390 /* If we are giving a name to a type such as "pointer to
1391 foo" or "function returning foo", we better not set
1392 the TYPE_NAME. If the program contains "typedef char
1393 *caddr_t;", we don't want all variables of type char
1394 * to print as caddr_t. This is not just a
1395 consequence of GDB's type management; CC and GCC (at
1396 least through version 2.4) both output variables of
1397 either type char * or caddr_t with the type
1398 refering to the stTypedef symbol for caddr_t. If a future
1399 compiler cleans this up it GDB is not ready for it
1400 yet, but if it becomes ready we somehow need to
1401 disable this check (without breaking the PCC/GCC2.4
1406 Fortunately, this check seems not to be necessary
1407 for anything except pointers or functions. */
1410 TYPE_NAME (SYMBOL_TYPE (s
)) = SYMBOL_NAME (s
);
1414 case stFile
: /* file name */
1415 push_parse_stack ();
1416 top_stack
->blocktype
= sh
->st
;
1419 /* I`ve never seen these for C */
1421 break; /* register relocation */
1423 break; /* forwarding address */
1425 break; /* constant */
1427 complain (&unknown_mdebug_symtype_complaint
, sh
->st
);
1434 /* Parse the type information provided in the raw AX entries for
1435 the symbol SH. Return the bitfield size in BS, in case.
1436 We must byte-swap the AX entries before we use them; BIGEND says whether
1437 they are big-endian or little-endian (from fh->fBigendian). */
1439 static struct type
*
1440 parse_type (fd
, ax
, aux_index
, bs
, bigend
, sym_name
)
1443 unsigned int aux_index
;
1448 /* Null entries in this map are treated specially */
1449 static struct type
**map_bt
[] =
1451 &mdebug_type_void
, /* btNil */
1452 &mdebug_type_adr_32
, /* btAdr */
1453 &mdebug_type_char
, /* btChar */
1454 &mdebug_type_unsigned_char
, /* btUChar */
1455 &mdebug_type_short
, /* btShort */
1456 &mdebug_type_unsigned_short
, /* btUShort */
1457 &mdebug_type_int_32
, /* btInt */
1458 &mdebug_type_unsigned_int_32
, /* btUInt */
1459 &mdebug_type_long_32
, /* btLong */
1460 &mdebug_type_unsigned_long_32
, /* btULong */
1461 &mdebug_type_float
, /* btFloat */
1462 &mdebug_type_double
, /* btDouble */
1469 &mdebug_type_complex
, /* btComplex */
1470 &mdebug_type_double_complex
, /* btDComplex */
1472 &mdebug_type_fixed_dec
, /* btFixedDec */
1473 &mdebug_type_float_dec
, /* btFloatDec */
1474 &mdebug_type_string
, /* btString */
1477 &mdebug_type_void
, /* btVoid */
1478 0, /* DEC C++: Pointer to member */
1479 0, /* DEC C++: Virtual function table */
1480 0, /* DEC C++: Class (Record) */
1481 &mdebug_type_long_64
, /* btLong64 */
1482 &mdebug_type_unsigned_long_64
, /* btULong64 */
1483 &mdebug_type_long_long_64
, /* btLongLong64 */
1484 &mdebug_type_unsigned_long_long_64
, /* btULongLong64 */
1485 &mdebug_type_adr_64
, /* btAdr64 */
1486 &mdebug_type_int_64
, /* btInt64 */
1487 &mdebug_type_unsigned_int_64
, /* btUInt64 */
1491 struct type
*tp
= 0;
1492 enum type_code type_code
= TYPE_CODE_UNDEF
;
1494 /* Handle undefined types, they have indexNil. */
1495 if (aux_index
== indexNil
)
1496 return mdebug_type_int
;
1498 /* Handle corrupt aux indices. */
1499 if (aux_index
>= (debug_info
->fdr
+ fd
)->caux
)
1501 complain (&index_complaint
, sym_name
);
1502 return mdebug_type_int
;
1506 /* Use aux as a type information record, map its basic type. */
1507 (*debug_swap
->swap_tir_in
) (bigend
, &ax
->a_ti
, t
);
1508 if (t
->bt
>= (sizeof (map_bt
) / sizeof (*map_bt
)))
1510 complain (&basic_type_complaint
, t
->bt
, sym_name
);
1511 return mdebug_type_int
;
1515 tp
= *map_bt
[t
->bt
];
1520 /* Cannot use builtin types -- build our own */
1524 type_code
= TYPE_CODE_STRUCT
;
1527 type_code
= TYPE_CODE_UNION
;
1530 type_code
= TYPE_CODE_ENUM
;
1533 type_code
= TYPE_CODE_RANGE
;
1536 type_code
= TYPE_CODE_SET
;
1539 /* alpha cc -migrate uses this for typedefs. The true type will
1540 be obtained by crossreferencing below. */
1541 type_code
= TYPE_CODE_ERROR
;
1544 /* alpha cc uses this for typedefs. The true type will be
1545 obtained by crossreferencing below. */
1546 type_code
= TYPE_CODE_ERROR
;
1549 complain (&basic_type_complaint
, t
->bt
, sym_name
);
1550 return mdebug_type_int
;
1554 /* Move on to next aux */
1559 int width
= AUX_GET_WIDTH (bigend
, ax
);
1561 /* Inhibit core dumps with some cfront generated objects that
1563 if (bs
== (int *) NULL
)
1565 /* Alpha cc -migrate encodes char and unsigned char types
1566 as short and unsigned short types with a field width of 8.
1567 Enum types also have a field width which we ignore for now. */
1568 if (t
->bt
== btShort
&& width
== 8)
1569 tp
= mdebug_type_char
;
1570 else if (t
->bt
== btUShort
&& width
== 8)
1571 tp
= mdebug_type_unsigned_char
;
1572 else if (t
->bt
== btEnum
)
1575 complain (&bad_fbitfield_complaint
, sym_name
);
1582 /* A btIndirect entry cross references to an aux entry containing
1584 if (t
->bt
== btIndirect
)
1591 (*debug_swap
->swap_rndx_in
) (bigend
, &ax
->a_rndx
, rn
);
1593 if (rn
->rfd
== 0xfff)
1595 rf
= AUX_GET_ISYM (bigend
, ax
);
1603 complain (&bad_indirect_xref_complaint
, sym_name
);
1604 return mdebug_type_int
;
1606 xref_fh
= get_rfd (fd
, rf
);
1607 xref_fd
= xref_fh
- debug_info
->fdr
;
1608 tp
= parse_type (xref_fd
, debug_info
->external_aux
+ xref_fh
->iauxBase
,
1609 rn
->index
, (int *) NULL
, xref_fh
->fBigendian
, sym_name
);
1612 /* All these types really point to some (common) MIPS type
1613 definition, and only the type-qualifiers fully identify
1614 them. We'll make the same effort at sharing. */
1615 if (t
->bt
== btStruct
||
1619 /* btSet (I think) implies that the name is a tag name, not a typedef
1620 name. This apparently is a MIPS extension for C sets. */
1625 /* Try to cross reference this type, build new type on failure. */
1626 ax
+= cross_ref (fd
, ax
, &tp
, type_code
, &name
, bigend
, sym_name
);
1627 if (tp
== (struct type
*) NULL
)
1628 tp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
1630 /* DEC c89 produces cross references to qualified aggregate types,
1631 dereference them. */
1632 while (TYPE_CODE (tp
) == TYPE_CODE_PTR
1633 || TYPE_CODE (tp
) == TYPE_CODE_ARRAY
)
1634 tp
= tp
->target_type
;
1636 /* Make sure that TYPE_CODE(tp) has an expected type code.
1637 Any type may be returned from cross_ref if file indirect entries
1639 if (TYPE_CODE (tp
) != TYPE_CODE_STRUCT
1640 && TYPE_CODE (tp
) != TYPE_CODE_UNION
1641 && TYPE_CODE (tp
) != TYPE_CODE_ENUM
)
1643 complain (&unexpected_type_code_complaint
, sym_name
);
1648 /* Usually, TYPE_CODE(tp) is already type_code. The main
1649 exception is if we guessed wrong re struct/union/enum.
1650 But for struct vs. union a wrong guess is harmless, so
1651 don't complain(). */
1652 if ((TYPE_CODE (tp
) == TYPE_CODE_ENUM
1653 && type_code
!= TYPE_CODE_ENUM
)
1654 || (TYPE_CODE (tp
) != TYPE_CODE_ENUM
1655 && type_code
== TYPE_CODE_ENUM
))
1657 complain (&bad_tag_guess_complaint
, sym_name
);
1660 if (TYPE_CODE (tp
) != type_code
)
1662 TYPE_CODE (tp
) = type_code
;
1665 /* Do not set the tag name if it is a compiler generated tag name
1666 (.Fxx or .xxfake or empty) for unnamed struct/union/enums. */
1667 if (name
[0] == '.' || name
[0] == '\0')
1668 TYPE_TAG_NAME (tp
) = NULL
;
1669 else if (TYPE_TAG_NAME (tp
) == NULL
1670 || !STREQ (TYPE_TAG_NAME (tp
), name
))
1671 TYPE_TAG_NAME (tp
) = obsavestring (name
, strlen (name
),
1672 ¤t_objfile
->type_obstack
);
1676 /* All these types really point to some (common) MIPS type
1677 definition, and only the type-qualifiers fully identify
1678 them. We'll make the same effort at sharing.
1679 FIXME: We are not doing any guessing on range types. */
1680 if (t
->bt
== btRange
)
1684 /* Try to cross reference this type, build new type on failure. */
1685 ax
+= cross_ref (fd
, ax
, &tp
, type_code
, &name
, bigend
, sym_name
);
1686 if (tp
== (struct type
*) NULL
)
1687 tp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
1689 /* Make sure that TYPE_CODE(tp) has an expected type code.
1690 Any type may be returned from cross_ref if file indirect entries
1692 if (TYPE_CODE (tp
) != TYPE_CODE_RANGE
)
1694 complain (&unexpected_type_code_complaint
, sym_name
);
1698 /* Usually, TYPE_CODE(tp) is already type_code. The main
1699 exception is if we guessed wrong re struct/union/enum. */
1700 if (TYPE_CODE (tp
) != type_code
)
1702 complain (&bad_tag_guess_complaint
, sym_name
);
1703 TYPE_CODE (tp
) = type_code
;
1705 if (TYPE_NAME (tp
) == NULL
|| !STREQ (TYPE_NAME (tp
), name
))
1706 TYPE_NAME (tp
) = obsavestring (name
, strlen (name
),
1707 ¤t_objfile
->type_obstack
);
1710 if (t
->bt
== btTypedef
)
1714 /* Try to cross reference this type, it should succeed. */
1715 ax
+= cross_ref (fd
, ax
, &tp
, type_code
, &name
, bigend
, sym_name
);
1716 if (tp
== (struct type
*) NULL
)
1718 complain (&unable_to_cross_ref_complaint
, sym_name
);
1719 tp
= mdebug_type_int
;
1723 /* Deal with range types */
1724 if (t
->bt
== btRange
)
1726 TYPE_NFIELDS (tp
) = 2;
1727 TYPE_FIELDS (tp
) = ((struct field
*)
1728 TYPE_ALLOC (tp
, 2 * sizeof (struct field
)));
1729 TYPE_FIELD_NAME (tp
, 0) = obsavestring ("Low", strlen ("Low"),
1730 ¤t_objfile
->type_obstack
);
1731 TYPE_FIELD_BITPOS (tp
, 0) = AUX_GET_DNLOW (bigend
, ax
);
1733 TYPE_FIELD_NAME (tp
, 1) = obsavestring ("High", strlen ("High"),
1734 ¤t_objfile
->type_obstack
);
1735 TYPE_FIELD_BITPOS (tp
, 1) = AUX_GET_DNHIGH (bigend
, ax
);
1739 /* Parse all the type qualifiers now. If there are more
1740 than 6 the game will continue in the next aux */
1744 #define PARSE_TQ(tq) \
1745 if (t->tq != tqNil) \
1746 ax += upgrade_type(fd, &tp, t->tq, ax, bigend, sym_name); \
1758 /* mips cc 2.x and gcc never put out continued aux entries. */
1762 (*debug_swap
->swap_tir_in
) (bigend
, &ax
->a_ti
, t
);
1766 /* Complain for illegal continuations due to corrupt aux entries. */
1768 complain (&bad_continued_complaint
, sym_name
);
1773 /* Make up a complex type from a basic one. Type is passed by
1774 reference in TPP and side-effected as necessary. The type
1775 qualifier TQ says how to handle the aux symbols at AX for
1776 the symbol SX we are currently analyzing. BIGEND says whether
1777 aux symbols are big-endian or little-endian.
1778 Returns the number of aux symbols we parsed. */
1781 upgrade_type (fd
, tpp
, tq
, ax
, bigend
, sym_name
)
1792 /* Used in array processing */
1803 t
= lookup_pointer_type (*tpp
);
1808 t
= lookup_function_type (*tpp
);
1815 /* Determine and record the domain type (type of index) */
1816 (*debug_swap
->swap_rndx_in
) (bigend
, &ax
->a_rndx
, &rndx
);
1822 rf
= AUX_GET_ISYM (bigend
, ax
);
1825 fh
= get_rfd (fd
, rf
);
1827 indx
= parse_type (fh
- debug_info
->fdr
,
1828 debug_info
->external_aux
+ fh
->iauxBase
,
1829 id
, (int *) NULL
, bigend
, sym_name
);
1831 /* The bounds type should be an integer type, but might be anything
1832 else due to corrupt aux entries. */
1833 if (TYPE_CODE (indx
) != TYPE_CODE_INT
)
1835 complain (&array_index_type_complaint
, sym_name
);
1836 indx
= mdebug_type_int
;
1839 /* Get the bounds, and create the array type. */
1841 lower
= AUX_GET_DNLOW (bigend
, ax
);
1843 upper
= AUX_GET_DNHIGH (bigend
, ax
);
1845 rf
= AUX_GET_WIDTH (bigend
, ax
); /* bit size of array element */
1847 range
= create_range_type ((struct type
*) NULL
, indx
,
1850 t
= create_array_type ((struct type
*) NULL
, *tpp
, range
);
1852 /* We used to fill in the supplied array element bitsize
1853 here if the TYPE_LENGTH of the target type was zero.
1854 This happens for a `pointer to an array of anonymous structs',
1855 but in this case the array element bitsize is also zero,
1856 so nothing is gained.
1857 And we used to check the TYPE_LENGTH of the target type against
1858 the supplied array element bitsize.
1859 gcc causes a mismatch for `pointer to array of object',
1860 since the sdb directives it uses do not have a way of
1861 specifying the bitsize, but it does no harm (the
1862 TYPE_LENGTH should be correct) and we should be able to
1863 ignore the erroneous bitsize from the auxiliary entry safely.
1864 dbx seems to ignore it too. */
1866 /* TYPE_FLAG_TARGET_STUB now takes care of the zero TYPE_LENGTH
1868 if (TYPE_LENGTH (*tpp
) == 0)
1870 TYPE_FLAGS (t
) |= TYPE_FLAG_TARGET_STUB
;
1877 /* Volatile -- currently ignored */
1881 /* Const -- currently ignored */
1885 complain (&unknown_type_qual_complaint
, tq
);
1891 /* Parse a procedure descriptor record PR. Note that the procedure is
1892 parsed _after_ the local symbols, now we just insert the extra
1893 information we need into a MIPS_EFI_SYMBOL_NAME symbol that has
1894 already been placed in the procedure's main block. Note also that
1895 images that have been partially stripped (ld -x) have been deprived
1896 of local symbols, and we have to cope with them here. FIRST_OFF is
1897 the offset of the first procedure for this FDR; we adjust the
1898 address by this amount, but I don't know why. SEARCH_SYMTAB is the symtab
1899 to look for the function which contains the MIPS_EFI_SYMBOL_NAME symbol
1900 in question, or NULL to use top_stack->cur_block. */
1902 static void parse_procedure (PDR
*, struct symtab
*, struct partial_symtab
*);
1905 parse_procedure (pr
, search_symtab
, pst
)
1907 struct symtab
*search_symtab
;
1908 struct partial_symtab
*pst
;
1910 struct symbol
*s
, *i
;
1912 struct mips_extra_func_info
*e
;
1915 /* Simple rule to find files linked "-x" */
1916 if (cur_fdr
->rss
== -1)
1920 /* Static procedure at address pr->adr. Sigh. */
1921 /* FIXME-32x64. assuming pr->adr fits in long. */
1922 complain (&pdr_static_symbol_complaint
, (unsigned long) pr
->adr
);
1930 (*debug_swap
->swap_ext_in
) (cur_bfd
,
1931 ((char *) debug_info
->external_ext
1933 * debug_swap
->external_ext_size
)),
1935 sh_name
= debug_info
->ssext
+ she
.asym
.iss
;
1943 (*debug_swap
->swap_sym_in
) (cur_bfd
,
1944 ((char *) debug_info
->external_sym
1945 + ((cur_fdr
->isymBase
+ pr
->isym
)
1946 * debug_swap
->external_sym_size
)),
1948 sh_name
= debug_info
->ss
+ cur_fdr
->issBase
+ sh
.iss
;
1951 if (search_symtab
!= NULL
)
1954 /* This loses both in the case mentioned (want a static, find a global),
1955 but also if we are looking up a non-mangled name which happens to
1956 match the name of a mangled function. */
1957 /* We have to save the cur_fdr across the call to lookup_symbol.
1958 If the pdr is for a static function and if a global function with
1959 the same name exists, lookup_symbol will eventually read in the symtab
1960 for the global function and clobber cur_fdr. */
1961 FDR
*save_cur_fdr
= cur_fdr
;
1962 s
= lookup_symbol (sh_name
, NULL
, VAR_NAMESPACE
, 0, NULL
);
1963 cur_fdr
= save_cur_fdr
;
1967 BLOCKVECTOR_BLOCK (BLOCKVECTOR (search_symtab
), STATIC_BLOCK
),
1973 s
= mylookup_symbol (sh_name
, top_stack
->cur_block
,
1974 VAR_NAMESPACE
, LOC_BLOCK
);
1978 b
= SYMBOL_BLOCK_VALUE (s
);
1982 complain (&pdr_for_nonsymbol_complaint
, sh_name
);
1986 /* FIXME -- delete. We can't do symbol allocation now; it's all done. */
1987 s
= new_symbol (sh_name
);
1988 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
1989 SYMBOL_CLASS (s
) = LOC_BLOCK
;
1990 /* Donno its type, hope int is ok */
1991 SYMBOL_TYPE (s
) = lookup_function_type (mdebug_type_int
);
1992 add_symbol (s
, top_stack
->cur_block
);
1993 /* Wont have symbols for this one */
1995 SYMBOL_BLOCK_VALUE (s
) = b
;
1996 BLOCK_FUNCTION (b
) = s
;
1997 BLOCK_START (b
) = pr
->adr
;
1998 /* BOUND used to be the end of procedure's text, but the
1999 argument is no longer passed in. */
2000 BLOCK_END (b
) = bound
;
2001 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
2002 add_block (b
, top_stack
->cur_st
);
2006 i
= mylookup_symbol (MIPS_EFI_SYMBOL_NAME
, b
, LABEL_NAMESPACE
, LOC_CONST
);
2010 e
= (struct mips_extra_func_info
*) SYMBOL_VALUE (i
);
2012 e
->pdr
.isym
= (long) s
;
2014 /* GDB expects the absolute function start address for the
2015 procedure descriptor in e->pdr.adr.
2016 As the address in the procedure descriptor is usually relative,
2017 we would have to relocate e->pdr.adr with cur_fdr->adr and
2018 ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (pst->objfile)).
2019 Unfortunately cur_fdr->adr and e->pdr.adr are both absolute
2020 in shared libraries on some systems, and on other systems
2021 e->pdr.adr is sometimes offset by a bogus value.
2022 To work around these problems, we replace e->pdr.adr with
2023 the start address of the function. */
2024 e
->pdr
.adr
= BLOCK_START (b
);
2026 /* Correct incorrect setjmp procedure descriptor from the library
2027 to make backtrace through setjmp work. */
2028 if (e
->pdr
.pcreg
== 0 && STREQ (sh_name
, "setjmp"))
2030 complain (&bad_setjmp_pdr_complaint
, 0);
2031 e
->pdr
.pcreg
= RA_REGNUM
;
2032 e
->pdr
.regmask
= 0x80000000;
2033 e
->pdr
.regoffset
= -4;
2037 /* It would be reasonable that functions that have been compiled
2038 without debugging info have a btNil type for their return value,
2039 and functions that are void and are compiled with debugging info
2041 gcc and DEC f77 put out btNil types for both cases, so btNil is mapped
2042 to TYPE_CODE_VOID in parse_type to get the `compiled with debugging info'
2044 The glevel field in cur_fdr could be used to determine the presence
2045 of debugging info, but GCC doesn't always pass the -g switch settings
2046 to the assembler and GAS doesn't set the glevel field from the -g switch
2048 To work around these problems, the return value type of a TYPE_CODE_VOID
2049 function is adjusted accordingly if no debugging info was found in the
2050 compilation unit. */
2052 if (processing_gcc_compilation
== 0
2053 && found_ecoff_debugging_info
== 0
2054 && TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (s
))) == TYPE_CODE_VOID
)
2055 SYMBOL_TYPE (s
) = nodebug_func_symbol_type
;
2058 /* Relocate the extra function info pointed to by the symbol table. */
2061 ecoff_relocate_efi (sym
, delta
)
2065 struct mips_extra_func_info
*e
;
2067 e
= (struct mips_extra_func_info
*) SYMBOL_VALUE (sym
);
2069 e
->pdr
.adr
+= delta
;
2072 /* Parse the external symbol ES. Just call parse_symbol() after
2073 making sure we know where the aux are for it.
2074 BIGEND says whether aux entries are big-endian or little-endian.
2076 This routine clobbers top_stack->cur_block and ->cur_st. */
2078 static void parse_external (EXTR
*, int, struct section_offsets
*,
2082 parse_external (es
, bigend
, section_offsets
, objfile
)
2085 struct section_offsets
*section_offsets
;
2086 struct objfile
*objfile
;
2090 if (es
->ifd
!= ifdNil
)
2093 cur_fdr
= debug_info
->fdr
+ cur_fd
;
2094 ax
= debug_info
->external_aux
+ cur_fdr
->iauxBase
;
2098 cur_fdr
= debug_info
->fdr
;
2102 /* Reading .o files */
2103 if (SC_IS_UNDEF (es
->asym
.sc
) || es
->asym
.sc
== scNil
)
2106 switch (es
->asym
.st
)
2109 /* These are generated for static symbols in .o files,
2130 /* FIXME: Turn this into a complaint? */
2132 printf_filtered ("Warning: %s `%s' is undefined (in %s)\n",
2133 what
, debug_info
->ssext
+ es
->asym
.iss
,
2134 fdr_name (cur_fdr
));
2138 switch (es
->asym
.st
)
2142 /* There is no need to parse the external procedure symbols.
2143 If they are from objects compiled without -g, their index will
2144 be indexNil, and the symbol definition from the minimal symbol
2145 is preferrable (yielding a function returning int instead of int).
2146 If the index points to a local procedure symbol, the local
2147 symbol already provides the correct type.
2148 Note that the index of the external procedure symbol points
2149 to the local procedure symbol in the local symbol table, and
2150 _not_ to the auxiliary symbol info. */
2154 /* Global common symbols are resolved by the runtime loader,
2156 if (SC_IS_COMMON (es
->asym
.sc
))
2159 /* Note that the case of a symbol with indexNil must be handled
2160 anyways by parse_symbol(). */
2161 parse_symbol (&es
->asym
, ax
, (char *) NULL
, bigend
, section_offsets
, objfile
);
2168 /* Parse the line number info for file descriptor FH into
2169 GDB's linetable LT. MIPS' encoding requires a little bit
2170 of magic to get things out. Note also that MIPS' line
2171 numbers can go back and forth, apparently we can live
2172 with that and do not need to reorder our linetables */
2174 static void parse_lines (FDR
*, PDR
*, struct linetable
*, int,
2175 struct partial_symtab
*, CORE_ADDR
);
2178 parse_lines (fh
, pr
, lt
, maxlines
, pst
, lowest_pdr_addr
)
2181 struct linetable
*lt
;
2183 struct partial_symtab
*pst
;
2184 CORE_ADDR lowest_pdr_addr
;
2186 unsigned char *base
;
2188 int delta
, count
, lineno
= 0;
2190 if (fh
->cbLine
== 0)
2193 /* Scan by procedure descriptors */
2195 for (j
= 0; j
< fh
->cpd
; j
++, pr
++)
2199 unsigned char *halt
;
2201 /* No code for this one */
2202 if (pr
->iline
== ilineNil
||
2203 pr
->lnLow
== -1 || pr
->lnHigh
== -1)
2206 /* Determine start and end address of compressed line bytes for
2208 base
= debug_info
->line
+ fh
->cbLineOffset
;
2209 if (j
!= (fh
->cpd
- 1))
2210 halt
= base
+ pr
[1].cbLineOffset
;
2212 halt
= base
+ fh
->cbLine
;
2213 base
+= pr
->cbLineOffset
;
2215 adr
= pst
->textlow
+ pr
->adr
- lowest_pdr_addr
;
2217 l
= adr
>> 2; /* in words */
2218 for (lineno
= pr
->lnLow
; base
< halt
;)
2220 count
= *base
& 0x0f;
2221 delta
= *base
++ >> 4;
2226 delta
= (base
[0] << 8) | base
[1];
2227 if (delta
>= 0x8000)
2231 lineno
+= delta
; /* first delta is 0 */
2233 /* Complain if the line table overflows. Could happen
2234 with corrupt binaries. */
2235 if (lt
->nitems
>= maxlines
)
2237 complain (&bad_linetable_guess_complaint
, fdr_name (fh
));
2240 k
= add_line (lt
, lineno
, l
, k
);
2246 /* Master parsing procedure for first-pass reading of file symbols
2247 into a partial_symtab. */
2250 parse_partial_symbols (objfile
)
2251 struct objfile
*objfile
;
2253 const bfd_size_type external_sym_size
= debug_swap
->external_sym_size
;
2254 const bfd_size_type external_rfd_size
= debug_swap
->external_rfd_size
;
2255 const bfd_size_type external_ext_size
= debug_swap
->external_ext_size
;
2256 void (*const swap_ext_in
) (bfd
*, PTR
, EXTR
*) = debug_swap
->swap_ext_in
;
2257 void (*const swap_sym_in
) (bfd
*, PTR
, SYMR
*) = debug_swap
->swap_sym_in
;
2258 void (*const swap_rfd_in
) (bfd
*, PTR
, RFDT
*) = debug_swap
->swap_rfd_in
;
2260 HDRR
*hdr
= &debug_info
->symbolic_header
;
2261 /* Running pointers */
2266 register EXTR
*ext_in
;
2269 struct partial_symtab
*pst
;
2270 int textlow_not_set
= 1;
2271 int past_first_source_file
= 0;
2273 /* List of current psymtab's include files */
2274 char **psymtab_include_list
;
2275 int includes_allocated
;
2278 struct pst_map
*fdr_to_pst
;
2279 /* Index within current psymtab dependency list */
2280 struct partial_symtab
**dependency_list
;
2281 int dependencies_used
, dependencies_allocated
;
2282 struct cleanup
*old_chain
;
2284 enum language prev_language
;
2285 asection
*text_sect
;
2286 int relocatable
= 0;
2288 /* Irix 5.2 shared libraries have a fh->adr field of zero, but
2289 the shared libraries are prelinked at a high memory address.
2290 We have to adjust the start address of the object file for this case,
2291 by setting it to the start address of the first procedure in the file.
2292 But we should do no adjustments if we are debugging a .o file, where
2293 the text section (and fh->adr) really starts at zero. */
2294 text_sect
= bfd_get_section_by_name (cur_bfd
, ".text");
2295 if (text_sect
!= NULL
2296 && (bfd_get_section_flags (cur_bfd
, text_sect
) & SEC_RELOC
))
2299 extern_tab
= (EXTR
*) obstack_alloc (&objfile
->psymbol_obstack
,
2300 sizeof (EXTR
) * hdr
->iextMax
);
2302 includes_allocated
= 30;
2304 psymtab_include_list
= (char **) alloca (includes_allocated
*
2306 next_symbol_text_func
= mdebug_next_symbol_text
;
2308 dependencies_allocated
= 30;
2309 dependencies_used
= 0;
2311 (struct partial_symtab
**) alloca (dependencies_allocated
*
2312 sizeof (struct partial_symtab
*));
2314 last_source_file
= NULL
;
2319 * Only parse the Local and External symbols, and the Relative FDR.
2320 * Fixup enough of the loader symtab to be able to use it.
2321 * Allocate space only for the file's portions we need to
2326 max_glevel
= MIN_GLEVEL
;
2328 /* Allocate the map FDR -> PST.
2329 Minor hack: -O3 images might claim some global data belongs
2330 to FDR -1. We`ll go along with that */
2331 fdr_to_pst
= (struct pst_map
*) xzalloc ((hdr
->ifdMax
+ 1) * sizeof *fdr_to_pst
);
2332 old_chain
= make_cleanup (free
, fdr_to_pst
);
2335 struct partial_symtab
*pst
= new_psymtab ("", objfile
);
2336 fdr_to_pst
[-1].pst
= pst
;
2340 /* Allocate the global pending list. */
2342 ((struct mdebug_pending
**)
2343 obstack_alloc (&objfile
->psymbol_obstack
,
2344 hdr
->ifdMax
* sizeof (struct mdebug_pending
*)));
2345 memset ((PTR
) pending_list
, 0,
2346 hdr
->ifdMax
* sizeof (struct mdebug_pending
*));
2348 /* Pass 0 over external syms: swap them in. */
2349 ext_block
= (EXTR
*) xmalloc (hdr
->iextMax
* sizeof (EXTR
));
2350 make_cleanup (free
, ext_block
);
2352 ext_out
= (char *) debug_info
->external_ext
;
2353 ext_out_end
= ext_out
+ hdr
->iextMax
* external_ext_size
;
2355 for (; ext_out
< ext_out_end
; ext_out
+= external_ext_size
, ext_in
++)
2356 (*swap_ext_in
) (cur_bfd
, ext_out
, ext_in
);
2358 /* Pass 1 over external syms: Presize and partition the list */
2360 ext_in_end
= ext_in
+ hdr
->iextMax
;
2361 for (; ext_in
< ext_in_end
; ext_in
++)
2363 /* See calls to complain below. */
2364 if (ext_in
->ifd
>= -1
2365 && ext_in
->ifd
< hdr
->ifdMax
2366 && ext_in
->asym
.iss
>= 0
2367 && ext_in
->asym
.iss
< hdr
->issExtMax
)
2368 fdr_to_pst
[ext_in
->ifd
].n_globals
++;
2371 /* Pass 1.5 over files: partition out global symbol space */
2373 for (f_idx
= -1; f_idx
< hdr
->ifdMax
; f_idx
++)
2375 fdr_to_pst
[f_idx
].globals_offset
= s_idx
;
2376 s_idx
+= fdr_to_pst
[f_idx
].n_globals
;
2377 fdr_to_pst
[f_idx
].n_globals
= 0;
2382 For ECOFF in ELF, we skip the creation of the minimal symbols.
2383 The ECOFF symbols should be a subset of the Elf symbols, and the
2384 section information of the elf symbols will be more accurate.
2385 FIXME! What about Irix 5's native linker?
2387 By default, Elf sections which don't exist in ECOFF
2388 get put in ECOFF's absolute section by the gnu linker.
2389 Since absolute sections don't get relocated, we
2390 end up calculating an address different from that of
2391 the symbol's minimal symbol (created earlier from the
2394 To fix this, either :
2395 1) don't create the duplicate symbol
2396 (assumes ECOFF symtab is a subset of the ELF symtab;
2397 assumes no side-effects result from ignoring ECOFF symbol)
2398 2) create it, only if lookup for existing symbol in ELF's minimal
2401 assumes no side-effects result from ignoring ECOFF symbol)
2402 3) create it, but lookup ELF's minimal symbol and use it's section
2403 during relocation, then modify "uniqify" phase to merge and
2404 eliminate the duplicate symbol
2405 (highly inefficient)
2407 I've implemented #1 here...
2408 Skip the creation of the minimal symbols based on the ECOFF
2411 /* Pass 2 over external syms: fill in external symbols */
2413 ext_in_end
= ext_in
+ hdr
->iextMax
;
2414 for (; ext_in
< ext_in_end
; ext_in
++)
2416 enum minimal_symbol_type ms_type
= mst_text
;
2417 CORE_ADDR svalue
= ext_in
->asym
.value
;
2419 /* The Irix 5 native tools seem to sometimes generate bogus
2420 external symbols. */
2421 if (ext_in
->ifd
< -1 || ext_in
->ifd
>= hdr
->ifdMax
)
2423 complain (&bad_ext_ifd_complaint
, ext_in
->ifd
, hdr
->ifdMax
);
2426 if (ext_in
->asym
.iss
< 0 || ext_in
->asym
.iss
>= hdr
->issExtMax
)
2428 complain (&bad_ext_iss_complaint
, ext_in
->asym
.iss
,
2433 extern_tab
[fdr_to_pst
[ext_in
->ifd
].globals_offset
2434 + fdr_to_pst
[ext_in
->ifd
].n_globals
++] = *ext_in
;
2437 if (SC_IS_UNDEF (ext_in
->asym
.sc
) || ext_in
->asym
.sc
== scNil
)
2441 /* Pass 3 over files, over local syms: fill in static symbols */
2442 name
= debug_info
->ssext
+ ext_in
->asym
.iss
;
2444 /* Process ECOFF Symbol Types and Storage Classes */
2445 switch (ext_in
->asym
.st
)
2448 /* Beginnning of Procedure */
2449 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2452 /* Load time only static procs */
2453 ms_type
= mst_file_text
;
2454 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2457 /* External symbol */
2458 if (SC_IS_COMMON (ext_in
->asym
.sc
))
2460 /* The value of a common symbol is its size, not its address.
2464 else if (SC_IS_DATA (ext_in
->asym
.sc
))
2467 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
2469 else if (SC_IS_BSS (ext_in
->asym
.sc
))
2472 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
2479 if (SC_IS_TEXT (ext_in
->asym
.sc
))
2481 ms_type
= mst_file_text
;
2482 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2484 else if (SC_IS_DATA (ext_in
->asym
.sc
))
2486 ms_type
= mst_file_data
;
2487 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
2489 else if (SC_IS_BSS (ext_in
->asym
.sc
))
2491 ms_type
= mst_file_bss
;
2492 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
2499 /* The alpha has the section start addresses in stLocal symbols
2500 whose name starts with a `.'. Skip those but complain for all
2501 other stLocal symbols.
2502 Irix6 puts the section start addresses in stNil symbols, skip
2508 ms_type
= mst_unknown
;
2509 complain (&unknown_ext_complaint
, name
);
2511 if (!ECOFF_IN_ELF (cur_bfd
))
2512 prim_record_minimal_symbol (name
, svalue
, ms_type
, objfile
);
2515 /* Pass 3 over files, over local syms: fill in static symbols */
2516 for (f_idx
= 0; f_idx
< hdr
->ifdMax
; f_idx
++)
2518 struct partial_symtab
*save_pst
;
2522 cur_fdr
= fh
= debug_info
->fdr
+ f_idx
;
2526 fdr_to_pst
[f_idx
].pst
= NULL
;
2530 /* Determine the start address for this object file from the
2531 file header and relocate it, except for Irix 5.2 zero fh->adr. */
2535 if (relocatable
|| textlow
!= 0)
2536 textlow
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2540 pst
= start_psymtab_common (objfile
, objfile
->section_offsets
,
2543 objfile
->global_psymbols
.next
,
2544 objfile
->static_psymbols
.next
);
2545 pst
->read_symtab_private
= ((char *)
2546 obstack_alloc (&objfile
->psymbol_obstack
,
2547 sizeof (struct symloc
)));
2548 memset ((PTR
) pst
->read_symtab_private
, 0, sizeof (struct symloc
));
2551 FDR_IDX (pst
) = f_idx
;
2552 CUR_BFD (pst
) = cur_bfd
;
2553 DEBUG_SWAP (pst
) = debug_swap
;
2554 DEBUG_INFO (pst
) = debug_info
;
2555 PENDING_LIST (pst
) = pending_list
;
2557 /* The way to turn this into a symtab is to call... */
2558 pst
->read_symtab
= mdebug_psymtab_to_symtab
;
2560 /* Set up language for the pst.
2561 The language from the FDR is used if it is unambigious (e.g. cfront
2562 with native cc and g++ will set the language to C).
2563 Otherwise we have to deduce the language from the filename.
2564 Native ecoff has every header file in a separate FDR, so
2565 deduce_language_from_filename will return language_unknown for
2566 a header file, which is not what we want.
2567 But the FDRs for the header files are after the FDR for the source
2568 file, so we can assign the language of the source file to the
2569 following header files. Then we save the language in the private
2570 pst data so that we can reuse it when building symtabs. */
2571 prev_language
= psymtab_language
;
2575 case langCplusplusV2
:
2576 psymtab_language
= language_cplus
;
2579 psymtab_language
= deduce_language_from_filename (fdr_name (fh
));
2582 if (psymtab_language
== language_unknown
)
2583 psymtab_language
= prev_language
;
2584 PST_PRIVATE (pst
)->pst_language
= psymtab_language
;
2586 pst
->texthigh
= pst
->textlow
;
2588 /* For stabs-in-ecoff files, the second symbol must be @stab.
2589 This symbol is emitted by mips-tfile to signal that the
2590 current object file uses encapsulated stabs instead of mips
2591 ecoff for local symbols. (It is the second symbol because
2592 the first symbol is the stFile used to signal the start of a
2594 processing_gcc_compilation
= 0;
2597 (*swap_sym_in
) (cur_bfd
,
2598 ((char *) debug_info
->external_sym
2599 + (fh
->isymBase
+ 1) * external_sym_size
),
2601 if (STREQ (debug_info
->ss
+ fh
->issBase
+ sh
.iss
, stabs_symbol
))
2602 processing_gcc_compilation
= 2;
2605 if (processing_gcc_compilation
!= 0)
2607 for (cur_sdx
= 2; cur_sdx
< fh
->csym
; cur_sdx
++)
2612 (*swap_sym_in
) (cur_bfd
,
2613 (((char *) debug_info
->external_sym
)
2614 + (fh
->isymBase
+ cur_sdx
) * external_sym_size
),
2616 type_code
= ECOFF_UNMARK_STAB (sh
.index
);
2617 if (!ECOFF_IS_STAB (&sh
))
2619 if (sh
.st
== stProc
|| sh
.st
== stStaticProc
)
2624 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2625 if (sh
.st
== stStaticProc
)
2627 namestring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2628 prim_record_minimal_symbol_and_info (namestring
,
2632 SECT_OFF_TEXT (objfile
),
2636 procaddr
= sh
.value
;
2638 isym
= AUX_GET_ISYM (fh
->fBigendian
,
2639 (debug_info
->external_aux
2642 (*swap_sym_in
) (cur_bfd
,
2643 ((char *) debug_info
->external_sym
2644 + ((fh
->isymBase
+ isym
- 1)
2645 * external_sym_size
)),
2649 CORE_ADDR high
= procaddr
+ sh
.value
;
2651 /* Kludge for Irix 5.2 zero fh->adr. */
2653 && (pst
->textlow
== 0 || procaddr
< pst
->textlow
))
2654 pst
->textlow
= procaddr
;
2655 if (high
> pst
->texthigh
)
2656 pst
->texthigh
= high
;
2659 else if (sh
.st
== stStatic
)
2674 namestring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2675 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
2676 prim_record_minimal_symbol_and_info (namestring
,
2680 SECT_OFF_DATA (objfile
),
2686 /* FIXME! Shouldn't this use cases for bss,
2687 then have the default be abs? */
2688 namestring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2689 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
2690 prim_record_minimal_symbol_and_info (namestring
,
2694 SECT_OFF_BSS (objfile
),
2702 /* Handle stabs continuation */
2704 char *stabstring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2705 int len
= strlen (stabstring
);
2706 while (stabstring
[len
- 1] == '\\')
2709 char *stabstring1
= stabstring
;
2713 /* Ignore continuation char from 1st string */
2716 /* Read next stabstring */
2718 (*swap_sym_in
) (cur_bfd
,
2719 (((char *) debug_info
->external_sym
)
2720 + (fh
->isymBase
+ cur_sdx
)
2721 * external_sym_size
),
2723 stabstring2
= debug_info
->ss
+ fh
->issBase
+ sh2
.iss
;
2724 len2
= strlen (stabstring2
);
2726 /* Concatinate stabstring2 with stabstring1 */
2728 && stabstring
!= debug_info
->ss
+ fh
->issBase
+ sh
.iss
)
2729 stabstring
= xrealloc (stabstring
, len
+ len2
+ 1);
2731 stabstring
= xmalloc (len
+ len2
+ 1);
2732 strcpy (stabstring
, stabstring1
);
2733 strcpy (stabstring
+ len
, stabstring2
);
2737 #define SET_NAMESTRING() \
2738 namestring = stabstring
2739 #define CUR_SYMBOL_TYPE type_code
2740 #define CUR_SYMBOL_VALUE sh.value
2741 #define START_PSYMTAB(ofile,fname,low,symoff,global_syms,static_syms)\
2743 #define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps,textlow_not_set) (void)0
2744 #define HANDLE_RBRAC(val) \
2745 if ((val) > save_pst->texthigh) save_pst->texthigh = (val);
2746 #include "partial-stab.h"
2749 && stabstring
!= debug_info
->ss
+ fh
->issBase
+ sh
.iss
)
2752 /* end - Handle continuation */
2757 for (cur_sdx
= 0; cur_sdx
< fh
->csym
;)
2760 enum address_class
class;
2762 (*swap_sym_in
) (cur_bfd
,
2763 ((char *) debug_info
->external_sym
2764 + ((fh
->isymBase
+ cur_sdx
)
2765 * external_sym_size
)),
2768 if (ECOFF_IS_STAB (&sh
))
2774 /* Non absolute static symbols go into the minimal table. */
2775 if (SC_IS_UNDEF (sh
.sc
) || sh
.sc
== scNil
2776 || (sh
.index
== indexNil
2777 && (sh
.st
!= stStatic
|| sh
.sc
== scAbs
)))
2779 /* FIXME, premature? */
2784 name
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2790 /* The value of a stEnd symbol is the displacement from the
2791 corresponding start symbol value, do not relocate it. */
2793 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
2800 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
2804 sh
.value
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
2815 prim_record_minimal_symbol_and_info (name
, sh
.value
,
2816 mst_file_text
, NULL
,
2817 SECT_OFF_TEXT (objfile
), NULL
,
2823 /* Usually there is a local and a global stProc symbol
2824 for a function. This means that the function name
2825 has already been entered into the mimimal symbol table
2826 while processing the global symbols in pass 2 above.
2827 One notable exception is the PROGRAM name from
2828 f77 compiled executables, it is only put out as
2829 local stProc symbol, and a global MAIN__ stProc symbol
2830 points to it. It doesn't matter though, as gdb is
2831 still able to find the PROGRAM name via the partial
2832 symbol table, and the MAIN__ symbol via the minimal
2834 if (sh
.st
== stProc
)
2835 add_psymbol_to_list (name
, strlen (name
),
2836 VAR_NAMESPACE
, LOC_BLOCK
,
2837 &objfile
->global_psymbols
,
2838 0, sh
.value
, psymtab_language
, objfile
);
2840 add_psymbol_to_list (name
, strlen (name
),
2841 VAR_NAMESPACE
, LOC_BLOCK
,
2842 &objfile
->static_psymbols
,
2843 0, sh
.value
, psymtab_language
, objfile
);
2845 /* Skip over procedure to next one. */
2846 if (sh
.index
>= hdr
->iauxMax
)
2848 /* Should not happen, but does when cross-compiling
2849 with the MIPS compiler. FIXME -- pull later. */
2850 complain (&index_complaint
, name
);
2851 new_sdx
= cur_sdx
+ 1; /* Don't skip at all */
2854 new_sdx
= AUX_GET_ISYM (fh
->fBigendian
,
2855 (debug_info
->external_aux
2858 procaddr
= sh
.value
;
2860 if (new_sdx
<= cur_sdx
)
2862 /* This should not happen either... FIXME. */
2863 complain (&aux_index_complaint
, name
);
2864 new_sdx
= cur_sdx
+ 1; /* Don't skip backward */
2868 (*swap_sym_in
) (cur_bfd
,
2869 ((char *) debug_info
->external_sym
2870 + ((fh
->isymBase
+ cur_sdx
- 1)
2871 * external_sym_size
)),
2876 /* Kludge for Irix 5.2 zero fh->adr. */
2878 && (pst
->textlow
== 0 || procaddr
< pst
->textlow
))
2879 pst
->textlow
= procaddr
;
2881 high
= procaddr
+ sh
.value
;
2882 if (high
> pst
->texthigh
)
2883 pst
->texthigh
= high
;
2886 case stStatic
: /* Variable */
2887 if (SC_IS_DATA (sh
.sc
))
2888 prim_record_minimal_symbol_and_info (name
, sh
.value
,
2889 mst_file_data
, NULL
,
2890 SECT_OFF_DATA (objfile
),
2894 prim_record_minimal_symbol_and_info (name
, sh
.value
,
2896 SECT_OFF_BSS (objfile
),
2902 case stIndirect
: /* Irix5 forward declaration */
2903 /* Skip forward declarations from Irix5 cc */
2906 case stTypedef
: /* Typedef */
2907 /* Skip typedefs for forward declarations and opaque
2908 structs from alpha and mips cc. */
2909 if (sh
.iss
== 0 || has_opaque_xref (fh
, &sh
))
2911 class = LOC_TYPEDEF
;
2914 case stConstant
: /* Constant decl */
2921 case stBlock
: /* { }, str, un, enum */
2922 /* Do not create a partial symbol for cc unnamed aggregates
2923 and gcc empty aggregates. */
2924 if ((sh
.sc
== scInfo
2925 || SC_IS_COMMON (sh
.sc
))
2927 && sh
.index
!= cur_sdx
+ 2)
2929 add_psymbol_to_list (name
, strlen (name
),
2930 STRUCT_NAMESPACE
, LOC_TYPEDEF
,
2931 &objfile
->static_psymbols
,
2933 psymtab_language
, objfile
);
2935 handle_psymbol_enumerators (objfile
, fh
, sh
.st
, sh
.value
);
2937 /* Skip over the block */
2939 if (new_sdx
<= cur_sdx
)
2941 /* This happens with the Ultrix kernel. */
2942 complain (&block_index_complaint
, name
);
2943 new_sdx
= cur_sdx
+ 1; /* Don't skip backward */
2948 case stFile
: /* File headers */
2949 case stLabel
: /* Labels */
2950 case stEnd
: /* Ends of files */
2953 case stLocal
: /* Local variables */
2954 /* Normally these are skipped because we skip over
2955 all blocks we see. However, these can occur
2956 as visible symbols in a .h file that contains code. */
2960 /* Both complaints are valid: one gives symbol name,
2961 the other the offending symbol type. */
2962 complain (&unknown_sym_complaint
, name
);
2963 complain (&unknown_st_complaint
, sh
.st
);
2967 /* Use this gdb symbol */
2968 add_psymbol_to_list (name
, strlen (name
),
2969 VAR_NAMESPACE
, class,
2970 &objfile
->static_psymbols
,
2971 0, sh
.value
, psymtab_language
, objfile
);
2973 cur_sdx
++; /* Go to next file symbol */
2976 /* Now do enter the external symbols. */
2977 ext_ptr
= &extern_tab
[fdr_to_pst
[f_idx
].globals_offset
];
2978 cur_sdx
= fdr_to_pst
[f_idx
].n_globals
;
2979 PST_PRIVATE (save_pst
)->extern_count
= cur_sdx
;
2980 PST_PRIVATE (save_pst
)->extern_tab
= ext_ptr
;
2981 for (; --cur_sdx
>= 0; ext_ptr
++)
2983 enum address_class
class;
2988 if (ext_ptr
->ifd
!= f_idx
)
2990 psh
= &ext_ptr
->asym
;
2992 /* Do not add undefined symbols to the partial symbol table. */
2993 if (SC_IS_UNDEF (psh
->sc
) || psh
->sc
== scNil
)
2996 svalue
= psh
->value
;
3001 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_TEXT (objfile
));
3008 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_DATA (objfile
));
3012 svalue
+= ANOFFSET (objfile
->section_offsets
, SECT_OFF_BSS (objfile
));
3019 /* These are generated for static symbols in .o files,
3024 /* External procedure symbols have been entered
3025 into the minimal symbol table in pass 2 above.
3026 Ignore them, as parse_external will ignore them too. */
3032 complain (&unknown_ext_complaint
,
3033 debug_info
->ssext
+ psh
->iss
);
3034 /* Fall through, pretend it's global. */
3036 /* Global common symbols are resolved by the runtime loader,
3038 if (SC_IS_COMMON (psh
->sc
))
3044 name
= debug_info
->ssext
+ psh
->iss
;
3045 add_psymbol_to_list (name
, strlen (name
),
3046 VAR_NAMESPACE
, class,
3047 &objfile
->global_psymbols
,
3049 psymtab_language
, objfile
);
3053 /* Link pst to FDR. end_psymtab returns NULL if the psymtab was
3054 empty and put on the free list. */
3055 fdr_to_pst
[f_idx
].pst
= end_psymtab (save_pst
,
3056 psymtab_include_list
, includes_used
,
3057 -1, save_pst
->texthigh
,
3058 dependency_list
, dependencies_used
, textlow_not_set
);
3060 dependencies_used
= 0;
3062 if (objfile
->ei
.entry_point
>= save_pst
->textlow
&&
3063 objfile
->ei
.entry_point
< save_pst
->texthigh
)
3065 objfile
->ei
.entry_file_lowpc
= save_pst
->textlow
;
3066 objfile
->ei
.entry_file_highpc
= save_pst
->texthigh
;
3069 /* The objfile has its functions reordered if this partial symbol
3070 table overlaps any other partial symbol table.
3071 We cannot assume a reordered objfile if a partial symbol table
3072 is contained within another partial symbol table, as partial symbol
3073 tables for include files with executable code are contained
3074 within the partial symbol table for the including source file,
3075 and we do not want to flag the objfile reordered for these cases.
3077 This strategy works well for Irix-5.2 shared libraries, but we
3078 might have to use a more elaborate (and slower) algorithm for
3080 save_pst
= fdr_to_pst
[f_idx
].pst
;
3081 if (save_pst
!= NULL
3082 && save_pst
->textlow
!= 0
3083 && !(objfile
->flags
& OBJF_REORDERED
))
3085 ALL_OBJFILE_PSYMTABS (objfile
, pst
)
3088 && save_pst
->textlow
>= pst
->textlow
3089 && save_pst
->textlow
< pst
->texthigh
3090 && save_pst
->texthigh
> pst
->texthigh
)
3092 objfile
->flags
|= OBJF_REORDERED
;
3099 /* Now scan the FDRs for dependencies */
3100 for (f_idx
= 0; f_idx
< hdr
->ifdMax
; f_idx
++)
3102 fh
= f_idx
+ debug_info
->fdr
;
3103 pst
= fdr_to_pst
[f_idx
].pst
;
3105 if (pst
== (struct partial_symtab
*) NULL
)
3108 /* This should catch stabs-in-ecoff. */
3112 /* Skip the first file indirect entry as it is a self dependency
3113 for source files or a reverse .h -> .c dependency for header files. */
3114 pst
->number_of_dependencies
= 0;
3116 ((struct partial_symtab
**)
3117 obstack_alloc (&objfile
->psymbol_obstack
,
3119 * sizeof (struct partial_symtab
*))));
3120 for (s_idx
= 1; s_idx
< fh
->crfd
; s_idx
++)
3124 (*swap_rfd_in
) (cur_bfd
,
3125 ((char *) debug_info
->external_rfd
3126 + (fh
->rfdBase
+ s_idx
) * external_rfd_size
),
3128 if (rh
< 0 || rh
>= hdr
->ifdMax
)
3130 complain (&bad_file_number_complaint
, rh
);
3134 /* Skip self dependencies of header files. */
3138 /* Do not add to dependeny list if psymtab was empty. */
3139 if (fdr_to_pst
[rh
].pst
== (struct partial_symtab
*) NULL
)
3141 pst
->dependencies
[pst
->number_of_dependencies
++] = fdr_to_pst
[rh
].pst
;
3145 /* Remove the dummy psymtab created for -O3 images above, if it is
3146 still empty, to enable the detection of stripped executables. */
3147 if (objfile
->psymtabs
->next
== NULL
3148 && objfile
->psymtabs
->number_of_dependencies
== 0
3149 && objfile
->psymtabs
->n_global_syms
== 0
3150 && objfile
->psymtabs
->n_static_syms
== 0)
3151 objfile
->psymtabs
= NULL
;
3152 do_cleanups (old_chain
);
3155 /* If the current psymbol has an enumerated type, we need to add
3156 all the the enum constants to the partial symbol table. */
3159 handle_psymbol_enumerators (objfile
, fh
, stype
, svalue
)
3160 struct objfile
*objfile
;
3165 const bfd_size_type external_sym_size
= debug_swap
->external_sym_size
;
3166 void (*const swap_sym_in
) (bfd
*, PTR
, SYMR
*) = debug_swap
->swap_sym_in
;
3167 char *ext_sym
= ((char *) debug_info
->external_sym
3168 + ((fh
->isymBase
+ cur_sdx
+ 1) * external_sym_size
));
3178 /* It is an enumerated type if the next symbol entry is a stMember
3179 and its auxiliary index is indexNil or its auxiliary entry
3180 is a plain btNil or btVoid.
3181 Alpha cc -migrate enums are recognized by a zero index and
3182 a zero symbol value.
3183 DU 4.0 cc enums are recognized by a member type of btEnum without
3184 qualifiers and a zero symbol value. */
3185 (*swap_sym_in
) (cur_bfd
, ext_sym
, &sh
);
3186 if (sh
.st
!= stMember
)
3189 if (sh
.index
== indexNil
3190 || (sh
.index
== 0 && svalue
== 0))
3192 (*debug_swap
->swap_tir_in
) (fh
->fBigendian
,
3193 &(debug_info
->external_aux
3194 + fh
->iauxBase
+ sh
.index
)->a_ti
,
3196 if ((tir
.bt
!= btNil
3198 && (tir
.bt
!= btEnum
|| svalue
!= 0))
3199 || tir
.tq0
!= tqNil
)
3211 (*swap_sym_in
) (cur_bfd
, ext_sym
, &sh
);
3212 if (sh
.st
!= stMember
)
3214 name
= debug_info
->ss
+ cur_fdr
->issBase
+ sh
.iss
;
3216 /* Note that the value doesn't matter for enum constants
3217 in psymtabs, just in symtabs. */
3218 add_psymbol_to_list (name
, strlen (name
),
3219 VAR_NAMESPACE
, LOC_CONST
,
3220 &objfile
->static_psymbols
, 0,
3221 (CORE_ADDR
) 0, psymtab_language
, objfile
);
3222 ext_sym
+= external_sym_size
;
3227 mdebug_next_symbol_text (objfile
)
3228 struct objfile
*objfile
; /* argument objfile is currently unused */
3233 (*debug_swap
->swap_sym_in
) (cur_bfd
,
3234 ((char *) debug_info
->external_sym
3235 + ((cur_fdr
->isymBase
+ cur_sdx
)
3236 * debug_swap
->external_sym_size
)),
3238 return debug_info
->ss
+ cur_fdr
->issBase
+ sh
.iss
;
3241 /* Ancillary function to psymtab_to_symtab(). Does all the work
3242 for turning the partial symtab PST into a symtab, recurring
3243 first on all dependent psymtabs. The argument FILENAME is
3244 only passed so we can see in debug stack traces what file
3247 This function has a split personality, based on whether the
3248 symbol table contains ordinary ecoff symbols, or stabs-in-ecoff.
3249 The flow of control and even the memory allocation differs. FIXME. */
3252 psymtab_to_symtab_1 (pst
, filename
)
3253 struct partial_symtab
*pst
;
3256 bfd_size_type external_sym_size
;
3257 bfd_size_type external_pdr_size
;
3258 void (*swap_sym_in
) (bfd
*, PTR
, SYMR
*);
3259 void (*swap_pdr_in
) (bfd
*, PTR
, PDR
*);
3263 struct linetable
*lines
;
3264 CORE_ADDR lowest_pdr_addr
= 0;
3270 /* Read in all partial symbtabs on which this one is dependent.
3271 NOTE that we do have circular dependencies, sigh. We solved
3272 that by setting pst->readin before this point. */
3274 for (i
= 0; i
< pst
->number_of_dependencies
; i
++)
3275 if (!pst
->dependencies
[i
]->readin
)
3277 /* Inform about additional files to be read in. */
3280 fputs_filtered (" ", gdb_stdout
);
3282 fputs_filtered ("and ", gdb_stdout
);
3284 printf_filtered ("%s...",
3285 pst
->dependencies
[i
]->filename
);
3286 wrap_here (""); /* Flush output */
3287 gdb_flush (gdb_stdout
);
3289 /* We only pass the filename for debug purposes */
3290 psymtab_to_symtab_1 (pst
->dependencies
[i
],
3291 pst
->dependencies
[i
]->filename
);
3294 /* Do nothing if this is a dummy psymtab. */
3296 if (pst
->n_global_syms
== 0 && pst
->n_static_syms
== 0
3297 && pst
->textlow
== 0 && pst
->texthigh
== 0)
3300 /* Now read the symbols for this symtab */
3302 cur_bfd
= CUR_BFD (pst
);
3303 debug_swap
= DEBUG_SWAP (pst
);
3304 debug_info
= DEBUG_INFO (pst
);
3305 pending_list
= PENDING_LIST (pst
);
3306 external_sym_size
= debug_swap
->external_sym_size
;
3307 external_pdr_size
= debug_swap
->external_pdr_size
;
3308 swap_sym_in
= debug_swap
->swap_sym_in
;
3309 swap_pdr_in
= debug_swap
->swap_pdr_in
;
3310 current_objfile
= pst
->objfile
;
3311 cur_fd
= FDR_IDX (pst
);
3312 fh
= ((cur_fd
== -1)
3314 : debug_info
->fdr
+ cur_fd
);
3317 /* See comment in parse_partial_symbols about the @stabs sentinel. */
3318 processing_gcc_compilation
= 0;
3319 if (fh
!= (FDR
*) NULL
&& fh
->csym
>= 2)
3323 (*swap_sym_in
) (cur_bfd
,
3324 ((char *) debug_info
->external_sym
3325 + (fh
->isymBase
+ 1) * external_sym_size
),
3327 if (STREQ (debug_info
->ss
+ fh
->issBase
+ sh
.iss
,
3330 /* We indicate that this is a GCC compilation so that certain
3331 features will be enabled in stabsread/dbxread. */
3332 processing_gcc_compilation
= 2;
3336 if (processing_gcc_compilation
!= 0)
3339 /* This symbol table contains stabs-in-ecoff entries. */
3341 /* Parse local symbols first */
3343 if (fh
->csym
<= 2) /* FIXME, this blows psymtab->symtab ptr */
3345 current_objfile
= NULL
;
3348 for (cur_sdx
= 2; cur_sdx
< fh
->csym
; cur_sdx
++)
3354 (*swap_sym_in
) (cur_bfd
,
3355 (((char *) debug_info
->external_sym
)
3356 + (fh
->isymBase
+ cur_sdx
) * external_sym_size
),
3358 name
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
3360 /* XXX This is a hack. It will go away! */
3361 if (ECOFF_IS_STAB (&sh
) || (name
[0] == '#'))
3363 int type_code
= ECOFF_UNMARK_STAB (sh
.index
);
3365 /* We should never get non N_STAB symbols here, but they
3366 should be harmless, so keep process_one_symbol from
3367 complaining about them. */
3368 if (type_code
& N_STAB
)
3370 process_one_symbol (type_code
, 0, valu
, name
,
3371 pst
->section_offsets
, pst
->objfile
);
3373 /* Similarly a hack. */
3374 else if (name
[0] == '#')
3376 process_one_symbol (N_SLINE
, 0, valu
, name
,
3377 pst
->section_offsets
, pst
->objfile
);
3379 if (type_code
== N_FUN
)
3381 /* Make up special symbol to contain
3382 procedure specific info */
3383 struct mips_extra_func_info
*e
=
3384 ((struct mips_extra_func_info
*)
3385 obstack_alloc (¤t_objfile
->symbol_obstack
,
3386 sizeof (struct mips_extra_func_info
)));
3387 struct symbol
*s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
3389 memset ((PTR
) e
, 0, sizeof (struct mips_extra_func_info
));
3390 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
3391 SYMBOL_CLASS (s
) = LOC_CONST
;
3392 SYMBOL_TYPE (s
) = mdebug_type_void
;
3393 SYMBOL_VALUE (s
) = (long) e
;
3394 e
->pdr
.framereg
= -1;
3395 add_symbol_to_list (s
, &local_symbols
);
3398 else if (sh
.st
== stLabel
)
3400 if (sh
.index
== indexNil
)
3402 /* This is what the gcc2_compiled and __gnu_compiled_*
3403 show up as. So don't complain. */
3408 /* Handle encoded stab line number. */
3409 valu
+= ANOFFSET (pst
->section_offsets
, SECT_OFF_TEXT (pst
->objfile
));
3410 record_line (current_subfile
, sh
.index
, valu
);
3413 else if (sh
.st
== stProc
|| sh
.st
== stStaticProc
3414 || sh
.st
== stStatic
|| sh
.st
== stEnd
)
3415 /* These are generated by gcc-2.x, do not complain */
3418 complain (&stab_unknown_complaint
, name
);
3420 st
= end_symtab (pst
->texthigh
, pst
->objfile
, SECT_OFF_TEXT (pst
->objfile
));
3423 /* Sort the symbol table now, we are done adding symbols to it.
3424 We must do this before parse_procedure calls lookup_symbol. */
3425 sort_symtab_syms (st
);
3427 /* There used to be a call to sort_blocks here, but this should not
3428 be necessary for stabs symtabs. And as sort_blocks modifies the
3429 start address of the GLOBAL_BLOCK to the FIRST_LOCAL_BLOCK,
3430 it did the wrong thing if the first procedure in a file was
3431 generated via asm statements. */
3433 /* Fill in procedure info next. */
3437 struct cleanup
*old_chain
;
3443 pr_block
= (PDR
*) xmalloc (fh
->cpd
* sizeof (PDR
));
3444 old_chain
= make_cleanup (free
, pr_block
);
3446 pdr_ptr
= ((char *) debug_info
->external_pdr
3447 + fh
->ipdFirst
* external_pdr_size
);
3448 pdr_end
= pdr_ptr
+ fh
->cpd
* external_pdr_size
;
3452 pdr_ptr
+= external_pdr_size
, pdr_in
++)
3454 (*swap_pdr_in
) (cur_bfd
, pdr_ptr
, pdr_in
);
3456 /* Determine lowest PDR address, the PDRs are not always
3458 if (pdr_in
== pr_block
)
3459 lowest_pdr_addr
= pdr_in
->adr
;
3460 else if (pdr_in
->adr
< lowest_pdr_addr
)
3461 lowest_pdr_addr
= pdr_in
->adr
;
3465 pdr_in_end
= pdr_in
+ fh
->cpd
;
3466 for (; pdr_in
< pdr_in_end
; pdr_in
++)
3467 parse_procedure (pdr_in
, st
, pst
);
3469 do_cleanups (old_chain
);
3474 /* This symbol table contains ordinary ecoff entries. */
3480 /* How many symbols will we need */
3481 /* FIXME, this does not count enum values. */
3482 f_max
= pst
->n_global_syms
+ pst
->n_static_syms
;
3486 st
= new_symtab ("unknown", f_max
, 0, pst
->objfile
);
3490 f_max
+= fh
->csym
+ fh
->cpd
;
3491 maxlines
= 2 * fh
->cline
;
3492 st
= new_symtab (pst
->filename
, 2 * f_max
, maxlines
, pst
->objfile
);
3494 /* The proper language was already determined when building
3495 the psymtab, use it. */
3496 st
->language
= PST_PRIVATE (pst
)->pst_language
;
3499 psymtab_language
= st
->language
;
3501 lines
= LINETABLE (st
);
3503 /* Get a new lexical context */
3505 push_parse_stack ();
3506 top_stack
->cur_st
= st
;
3507 top_stack
->cur_block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (st
),
3509 BLOCK_START (top_stack
->cur_block
) = pst
->textlow
;
3510 BLOCK_END (top_stack
->cur_block
) = 0;
3511 top_stack
->blocktype
= stFile
;
3512 top_stack
->maxsyms
= 2 * f_max
;
3513 top_stack
->cur_type
= 0;
3514 top_stack
->procadr
= 0;
3515 top_stack
->numargs
= 0;
3516 found_ecoff_debugging_info
= 0;
3523 /* Parse local symbols first */
3524 sym_ptr
= ((char *) debug_info
->external_sym
3525 + fh
->isymBase
* external_sym_size
);
3526 sym_end
= sym_ptr
+ fh
->csym
* external_sym_size
;
3527 while (sym_ptr
< sym_end
)
3532 (*swap_sym_in
) (cur_bfd
, sym_ptr
, &sh
);
3533 c
= parse_symbol (&sh
,
3534 debug_info
->external_aux
+ fh
->iauxBase
,
3535 sym_ptr
, fh
->fBigendian
, pst
->section_offsets
, pst
->objfile
);
3536 sym_ptr
+= c
* external_sym_size
;
3539 /* Linenumbers. At the end, check if we can save memory.
3540 parse_lines has to look ahead an arbitrary number of PDR
3541 structures, so we swap them all first. */
3545 struct cleanup
*old_chain
;
3551 pr_block
= (PDR
*) xmalloc (fh
->cpd
* sizeof (PDR
));
3553 old_chain
= make_cleanup (free
, pr_block
);
3555 pdr_ptr
= ((char *) debug_info
->external_pdr
3556 + fh
->ipdFirst
* external_pdr_size
);
3557 pdr_end
= pdr_ptr
+ fh
->cpd
* external_pdr_size
;
3561 pdr_ptr
+= external_pdr_size
, pdr_in
++)
3563 (*swap_pdr_in
) (cur_bfd
, pdr_ptr
, pdr_in
);
3565 /* Determine lowest PDR address, the PDRs are not always
3567 if (pdr_in
== pr_block
)
3568 lowest_pdr_addr
= pdr_in
->adr
;
3569 else if (pdr_in
->adr
< lowest_pdr_addr
)
3570 lowest_pdr_addr
= pdr_in
->adr
;
3573 parse_lines (fh
, pr_block
, lines
, maxlines
, pst
, lowest_pdr_addr
);
3574 if (lines
->nitems
< fh
->cline
)
3575 lines
= shrink_linetable (lines
);
3577 /* Fill in procedure info next. */
3579 pdr_in_end
= pdr_in
+ fh
->cpd
;
3580 for (; pdr_in
< pdr_in_end
; pdr_in
++)
3581 parse_procedure (pdr_in
, 0, pst
);
3583 do_cleanups (old_chain
);
3587 LINETABLE (st
) = lines
;
3589 /* .. and our share of externals.
3590 XXX use the global list to speed up things here. how?
3591 FIXME, Maybe quit once we have found the right number of ext's? */
3592 top_stack
->cur_st
= st
;
3593 top_stack
->cur_block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack
->cur_st
),
3595 top_stack
->blocktype
= stFile
;
3597 = (debug_info
->symbolic_header
.isymMax
3598 + debug_info
->symbolic_header
.ipdMax
3599 + debug_info
->symbolic_header
.iextMax
);
3601 ext_ptr
= PST_PRIVATE (pst
)->extern_tab
;
3602 for (i
= PST_PRIVATE (pst
)->extern_count
; --i
>= 0; ext_ptr
++)
3603 parse_external (ext_ptr
, fh
->fBigendian
, pst
->section_offsets
, pst
->objfile
);
3605 /* If there are undefined symbols, tell the user.
3606 The alpha has an undefined symbol for every symbol that is
3607 from a shared library, so tell the user only if verbose is on. */
3608 if (info_verbose
&& n_undef_symbols
)
3610 printf_filtered ("File %s contains %d unresolved references:",
3611 st
->filename
, n_undef_symbols
);
3612 printf_filtered ("\n\t%4d variables\n\t%4d procedures\n\t%4d labels\n",
3613 n_undef_vars
, n_undef_procs
, n_undef_labels
);
3614 n_undef_symbols
= n_undef_labels
= n_undef_vars
= n_undef_procs
= 0;
3621 /* Sort the symbol table now, we are done adding symbols to it. */
3622 sort_symtab_syms (st
);
3627 /* Now link the psymtab and the symtab. */
3630 current_objfile
= NULL
;
3633 /* Ancillary parsing procedures. */
3635 /* Return 1 if the symbol pointed to by SH has a cross reference
3636 to an opaque aggregate type, else 0. */
3639 has_opaque_xref (fh
, sh
)
3648 if (sh
->index
== indexNil
)
3651 ax
= debug_info
->external_aux
+ fh
->iauxBase
+ sh
->index
;
3652 (*debug_swap
->swap_tir_in
) (fh
->fBigendian
, &ax
->a_ti
, &tir
);
3653 if (tir
.bt
!= btStruct
&& tir
.bt
!= btUnion
&& tir
.bt
!= btEnum
)
3657 (*debug_swap
->swap_rndx_in
) (fh
->fBigendian
, &ax
->a_rndx
, rn
);
3658 if (rn
->rfd
== 0xfff)
3659 rf
= AUX_GET_ISYM (fh
->fBigendian
, ax
+ 1);
3667 /* Lookup the type at relative index RN. Return it in TPP
3668 if found and in any event come up with its name PNAME.
3669 BIGEND says whether aux symbols are big-endian or not (from fh->fBigendian).
3670 Return value says how many aux symbols we ate. */
3673 cross_ref (fd
, ax
, tpp
, type_code
, pname
, bigend
, sym_name
)
3677 enum type_code type_code
; /* Use to alloc new type if none is found. */
3689 struct mdebug_pending
*pend
;
3691 *tpp
= (struct type
*) NULL
;
3693 (*debug_swap
->swap_rndx_in
) (bigend
, &ax
->a_rndx
, rn
);
3695 /* Escape index means 'the next one' */
3696 if (rn
->rfd
== 0xfff)
3699 rf
= AUX_GET_ISYM (bigend
, ax
+ 1);
3706 /* mips cc uses a rf of -1 for opaque struct definitions.
3707 Set TYPE_FLAG_STUB for these types so that check_typedef will
3708 resolve them if the struct gets defined in another compilation unit. */
3711 *pname
= "<undefined>";
3712 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
3713 TYPE_FLAGS (*tpp
) |= TYPE_FLAG_STUB
;
3717 /* mips cc uses an escaped rn->index of 0 for struct return types
3718 of procedures that were compiled without -g. These will always remain
3720 if (rn
->rfd
== 0xfff && rn
->index
== 0)
3722 *pname
= "<undefined>";
3726 /* Find the relative file descriptor and the symbol in it. */
3727 fh
= get_rfd (fd
, rf
);
3728 xref_fd
= fh
- debug_info
->fdr
;
3730 if (rn
->index
>= fh
->csym
)
3732 /* File indirect entry is corrupt. */
3733 *pname
= "<illegal>";
3734 complain (&bad_rfd_entry_complaint
,
3735 sym_name
, xref_fd
, rn
->index
);
3739 /* If we have processed this symbol then we left a forwarding
3740 pointer to the type in the pending list. If not, we`ll put
3741 it in a list of pending types, to be processed later when
3742 the file will be. In any event, we collect the name for the
3745 esh
= ((char *) debug_info
->external_sym
3746 + ((fh
->isymBase
+ rn
->index
)
3747 * debug_swap
->external_sym_size
));
3748 (*debug_swap
->swap_sym_in
) (cur_bfd
, esh
, &sh
);
3750 /* Make sure that this type of cross reference can be handled. */
3751 if ((sh
.sc
!= scInfo
3752 || (sh
.st
!= stBlock
&& sh
.st
!= stTypedef
&& sh
.st
!= stIndirect
3753 && sh
.st
!= stStruct
&& sh
.st
!= stUnion
3754 && sh
.st
!= stEnum
))
3755 && (sh
.st
!= stBlock
|| !SC_IS_COMMON (sh
.sc
)))
3757 /* File indirect entry is corrupt. */
3758 *pname
= "<illegal>";
3759 complain (&bad_rfd_entry_complaint
,
3760 sym_name
, xref_fd
, rn
->index
);
3764 *pname
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
3766 pend
= is_pending_symbol (fh
, esh
);
3771 /* We have not yet seen this type. */
3773 if ((sh
.iss
== 0 && sh
.st
== stTypedef
) || sh
.st
== stIndirect
)
3777 /* alpha cc puts out a stTypedef with a sh.iss of zero for
3779 a) forward declarations of structs/unions/enums which are not
3780 defined in this compilation unit.
3781 For these the type will be void. This is a bad design decision
3782 as cross referencing across compilation units is impossible
3783 due to the missing name.
3784 b) forward declarations of structs/unions/enums/typedefs which
3785 are defined later in this file or in another file in the same
3786 compilation unit. Irix5 cc uses a stIndirect symbol for this.
3787 Simply cross reference those again to get the true type.
3788 The forward references are not entered in the pending list and
3789 in the symbol table. */
3791 (*debug_swap
->swap_tir_in
) (bigend
,
3792 &(debug_info
->external_aux
3793 + fh
->iauxBase
+ sh
.index
)->a_ti
,
3795 if (tir
.tq0
!= tqNil
)
3796 complain (&illegal_forward_tq0_complaint
, sym_name
);
3800 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
,
3802 *pname
= "<undefined>";
3809 (debug_info
->external_aux
3810 + fh
->iauxBase
+ sh
.index
+ 1),
3811 tpp
, type_code
, pname
,
3812 fh
->fBigendian
, sym_name
);
3816 /* Follow a forward typedef. This might recursively
3817 call cross_ref till we get a non typedef'ed type.
3818 FIXME: This is not correct behaviour, but gdb currently
3819 cannot handle typedefs without type copying. Type
3820 copying is impossible as we might have mutual forward
3821 references between two files and the copied type would not
3822 get filled in when we later parse its definition. */
3823 *tpp
= parse_type (xref_fd
,
3824 debug_info
->external_aux
+ fh
->iauxBase
,
3828 debug_info
->ss
+ fh
->issBase
+ sh
.iss
);
3829 add_pending (fh
, esh
, *tpp
);
3833 complain (&illegal_forward_bt_complaint
, tir
.bt
, sym_name
);
3834 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
,
3840 else if (sh
.st
== stTypedef
)
3842 /* Parse the type for a normal typedef. This might recursively call
3843 cross_ref till we get a non typedef'ed type.
3844 FIXME: This is not correct behaviour, but gdb currently
3845 cannot handle typedefs without type copying. But type copying is
3846 impossible as we might have mutual forward references between
3847 two files and the copied type would not get filled in when
3848 we later parse its definition. */
3849 *tpp
= parse_type (xref_fd
,
3850 debug_info
->external_aux
+ fh
->iauxBase
,
3854 debug_info
->ss
+ fh
->issBase
+ sh
.iss
);
3858 /* Cross reference to a struct/union/enum which is defined
3859 in another file in the same compilation unit but that file
3860 has not been parsed yet.
3861 Initialize the type only, it will be filled in when
3862 it's definition is parsed. */
3863 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
3865 add_pending (fh
, esh
, *tpp
);
3868 /* We used one auxent normally, two if we got a "next one" rf. */
3873 /* Quick&dirty lookup procedure, to avoid the MI ones that require
3874 keeping the symtab sorted */
3876 static struct symbol
*
3877 mylookup_symbol (name
, block
, namespace, class)
3879 register struct block
*block
;
3880 namespace_enum
namespace;
3881 enum address_class
class;
3883 register int bot
, top
, inc
;
3884 register struct symbol
*sym
;
3887 top
= BLOCK_NSYMS (block
);
3891 sym
= BLOCK_SYM (block
, bot
);
3892 if (SYMBOL_NAME (sym
)[0] == inc
3893 && SYMBOL_NAMESPACE (sym
) == namespace
3894 && SYMBOL_CLASS (sym
) == class
3895 && strcmp (SYMBOL_NAME (sym
), name
) == 0)
3899 block
= BLOCK_SUPERBLOCK (block
);
3901 return mylookup_symbol (name
, block
, namespace, class);
3906 /* Add a new symbol S to a block B.
3907 Infrequently, we will need to reallocate the block to make it bigger.
3908 We only detect this case when adding to top_stack->cur_block, since
3909 that's the only time we know how big the block is. FIXME. */
3916 int nsyms
= BLOCK_NSYMS (b
)++;
3917 struct block
*origb
;
3918 struct parse_stack
*stackp
;
3920 if (b
== top_stack
->cur_block
&&
3921 nsyms
>= top_stack
->maxsyms
)
3923 complain (&block_overflow_complaint
, SYMBOL_NAME (s
));
3924 /* In this case shrink_block is actually grow_block, since
3925 BLOCK_NSYMS(b) is larger than its current size. */
3927 b
= shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
3929 /* Now run through the stack replacing pointers to the
3930 original block. shrink_block has already done this
3931 for the blockvector and BLOCK_FUNCTION. */
3932 for (stackp
= top_stack
; stackp
; stackp
= stackp
->next
)
3934 if (stackp
->cur_block
== origb
)
3936 stackp
->cur_block
= b
;
3937 stackp
->maxsyms
= BLOCK_NSYMS (b
);
3941 BLOCK_SYM (b
, nsyms
) = s
;
3944 /* Add a new block B to a symtab S */
3951 struct blockvector
*bv
= BLOCKVECTOR (s
);
3953 bv
= (struct blockvector
*) xrealloc ((PTR
) bv
,
3954 (sizeof (struct blockvector
)
3955 + BLOCKVECTOR_NBLOCKS (bv
)
3956 * sizeof (bv
->block
)));
3957 if (bv
!= BLOCKVECTOR (s
))
3958 BLOCKVECTOR (s
) = bv
;
3960 BLOCKVECTOR_BLOCK (bv
, BLOCKVECTOR_NBLOCKS (bv
)++) = b
;
3963 /* Add a new linenumber entry (LINENO,ADR) to a linevector LT.
3964 MIPS' linenumber encoding might need more than one byte
3965 to describe it, LAST is used to detect these continuation lines.
3967 Combining lines with the same line number seems like a bad idea.
3968 E.g: There could be a line number entry with the same line number after the
3969 prologue and GDB should not ignore it (this is a better way to find
3970 a prologue than mips_skip_prologue).
3971 But due to the compressed line table format there are line number entries
3972 for the same line which are needed to bridge the gap to the next
3973 line number entry. These entries have a bogus address info with them
3974 and we are unable to tell them from intended duplicate line number
3976 This is another reason why -ggdb debugging format is preferable. */
3979 add_line (lt
, lineno
, adr
, last
)
3980 struct linetable
*lt
;
3985 /* DEC c89 sometimes produces zero linenos which confuse gdb.
3986 Change them to something sensible. */
3990 last
= -2; /* make sure we record first line */
3992 if (last
== lineno
) /* skip continuation lines */
3995 lt
->item
[lt
->nitems
].line
= lineno
;
3996 lt
->item
[lt
->nitems
++].pc
= adr
<< 2;
4000 /* Sorting and reordering procedures */
4002 /* Blocks with a smaller low bound should come first */
4005 compare_blocks (arg1
, arg2
)
4009 register int addr_diff
;
4010 struct block
**b1
= (struct block
**) arg1
;
4011 struct block
**b2
= (struct block
**) arg2
;
4013 addr_diff
= (BLOCK_START ((*b1
))) - (BLOCK_START ((*b2
)));
4015 return (BLOCK_END ((*b2
))) - (BLOCK_END ((*b1
)));
4019 /* Sort the blocks of a symtab S.
4020 Reorder the blocks in the blockvector by code-address,
4021 as required by some MI search routines */
4027 struct blockvector
*bv
= BLOCKVECTOR (s
);
4029 if (BLOCKVECTOR_NBLOCKS (bv
) <= 2)
4032 if (BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) == 0)
4033 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) = 0;
4034 if (BLOCK_END (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) == 0)
4035 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) = 0;
4039 * This is very unfortunate: normally all functions are compiled in
4040 * the order they are found, but if the file is compiled -O3 things
4041 * are very different. It would be nice to find a reliable test
4042 * to detect -O3 images in advance.
4044 if (BLOCKVECTOR_NBLOCKS (bv
) > 3)
4045 qsort (&BLOCKVECTOR_BLOCK (bv
, FIRST_LOCAL_BLOCK
),
4046 BLOCKVECTOR_NBLOCKS (bv
) - FIRST_LOCAL_BLOCK
,
4047 sizeof (struct block
*),
4051 register CORE_ADDR high
= 0;
4052 register int i
, j
= BLOCKVECTOR_NBLOCKS (bv
);
4054 for (i
= FIRST_LOCAL_BLOCK
; i
< j
; i
++)
4055 if (high
< BLOCK_END (BLOCKVECTOR_BLOCK (bv
, i
)))
4056 high
= BLOCK_END (BLOCKVECTOR_BLOCK (bv
, i
));
4057 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) = high
;
4060 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) =
4061 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, FIRST_LOCAL_BLOCK
));
4063 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) =
4064 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
));
4065 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) =
4066 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
));
4070 /* Constructor/restructor/destructor procedures */
4072 /* Allocate a new symtab for NAME. Needs an estimate of how many symbols
4073 MAXSYMS and linenumbers MAXLINES we'll put in it */
4075 static struct symtab
*
4076 new_symtab (name
, maxsyms
, maxlines
, objfile
)
4080 struct objfile
*objfile
;
4082 struct symtab
*s
= allocate_symtab (name
, objfile
);
4084 LINETABLE (s
) = new_linetable (maxlines
);
4086 /* All symtabs must have at least two blocks */
4087 BLOCKVECTOR (s
) = new_bvect (2);
4088 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), GLOBAL_BLOCK
) = new_block (maxsyms
);
4089 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), STATIC_BLOCK
) = new_block (maxsyms
);
4090 BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), STATIC_BLOCK
)) =
4091 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), GLOBAL_BLOCK
);
4093 s
->free_code
= free_linetable
;
4094 s
->debugformat
= obsavestring ("ECOFF", 5,
4095 &objfile
->symbol_obstack
);
4099 /* Allocate a new partial_symtab NAME */
4101 static struct partial_symtab
*
4102 new_psymtab (name
, objfile
)
4104 struct objfile
*objfile
;
4106 struct partial_symtab
*psymtab
;
4108 psymtab
= allocate_psymtab (name
, objfile
);
4109 psymtab
->section_offsets
= objfile
->section_offsets
;
4111 /* Keep a backpointer to the file's symbols */
4113 psymtab
->read_symtab_private
= ((char *)
4114 obstack_alloc (&objfile
->psymbol_obstack
,
4115 sizeof (struct symloc
)));
4116 memset ((PTR
) psymtab
->read_symtab_private
, 0, sizeof (struct symloc
));
4117 CUR_BFD (psymtab
) = cur_bfd
;
4118 DEBUG_SWAP (psymtab
) = debug_swap
;
4119 DEBUG_INFO (psymtab
) = debug_info
;
4120 PENDING_LIST (psymtab
) = pending_list
;
4122 /* The way to turn this into a symtab is to call... */
4123 psymtab
->read_symtab
= mdebug_psymtab_to_symtab
;
4128 /* Allocate a linetable array of the given SIZE. Since the struct
4129 already includes one item, we subtract one when calculating the
4130 proper size to allocate. */
4132 static struct linetable
*
4133 new_linetable (size
)
4136 struct linetable
*l
;
4138 size
= (size
- 1) * sizeof (l
->item
) + sizeof (struct linetable
);
4139 l
= (struct linetable
*) xmalloc (size
);
4144 /* Oops, too big. Shrink it. This was important with the 2.4 linetables,
4145 I am not so sure about the 3.4 ones.
4147 Since the struct linetable already includes one item, we subtract one when
4148 calculating the proper size to allocate. */
4150 static struct linetable
*
4151 shrink_linetable (lt
)
4152 struct linetable
*lt
;
4155 return (struct linetable
*) xrealloc ((PTR
) lt
,
4156 (sizeof (struct linetable
)
4158 * sizeof (lt
->item
))));
4161 /* Allocate and zero a new blockvector of NBLOCKS blocks. */
4163 static struct blockvector
*
4167 struct blockvector
*bv
;
4170 size
= sizeof (struct blockvector
) + nblocks
* sizeof (struct block
*);
4171 bv
= (struct blockvector
*) xzalloc (size
);
4173 BLOCKVECTOR_NBLOCKS (bv
) = nblocks
;
4178 /* Allocate and zero a new block of MAXSYMS symbols */
4180 static struct block
*
4184 int size
= sizeof (struct block
) + (maxsyms
- 1) * sizeof (struct symbol
*);
4186 return (struct block
*) xzalloc (size
);
4189 /* Ooops, too big. Shrink block B in symtab S to its minimal size.
4190 Shrink_block can also be used by add_symbol to grow a block. */
4192 static struct block
*
4198 struct blockvector
*bv
= BLOCKVECTOR (s
);
4201 /* Just reallocate it and fix references to the old one */
4203 new = (struct block
*) xrealloc ((PTR
) b
,
4204 (sizeof (struct block
)
4205 + ((BLOCK_NSYMS (b
) - 1)
4206 * sizeof (struct symbol
*))));
4208 /* Should chase pointers to old one. Fortunately, that`s just
4209 the block`s function and inferior blocks */
4210 if (BLOCK_FUNCTION (new) && SYMBOL_BLOCK_VALUE (BLOCK_FUNCTION (new)) == b
)
4211 SYMBOL_BLOCK_VALUE (BLOCK_FUNCTION (new)) = new;
4212 for (i
= 0; i
< BLOCKVECTOR_NBLOCKS (bv
); i
++)
4213 if (BLOCKVECTOR_BLOCK (bv
, i
) == b
)
4214 BLOCKVECTOR_BLOCK (bv
, i
) = new;
4215 else if (BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv
, i
)) == b
)
4216 BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv
, i
)) = new;
4220 /* Create a new symbol with printname NAME */
4222 static struct symbol
*
4226 struct symbol
*s
= ((struct symbol
*)
4227 obstack_alloc (¤t_objfile
->symbol_obstack
,
4228 sizeof (struct symbol
)));
4230 memset ((PTR
) s
, 0, sizeof (*s
));
4231 SYMBOL_NAME (s
) = obsavestring (name
, strlen (name
),
4232 ¤t_objfile
->symbol_obstack
);
4233 SYMBOL_LANGUAGE (s
) = psymtab_language
;
4234 SYMBOL_INIT_DEMANGLED_NAME (s
, ¤t_objfile
->symbol_obstack
);
4238 /* Create a new type with printname NAME */
4240 static struct type
*
4246 t
= alloc_type (current_objfile
);
4247 TYPE_NAME (t
) = name
;
4248 TYPE_CPLUS_SPECIFIC (t
) = (struct cplus_struct_type
*) &cplus_struct_default
;
4252 /* Read ECOFF debugging information from a BFD section. This is
4253 called from elfread.c. It parses the section into a
4254 ecoff_debug_info struct, and then lets the rest of the file handle
4258 elfmdebug_build_psymtabs (objfile
, swap
, sec
)
4259 struct objfile
*objfile
;
4260 const struct ecoff_debug_swap
*swap
;
4263 bfd
*abfd
= objfile
->obfd
;
4264 struct ecoff_debug_info
*info
;
4266 info
= ((struct ecoff_debug_info
*)
4267 obstack_alloc (&objfile
->psymbol_obstack
,
4268 sizeof (struct ecoff_debug_info
)));
4270 if (!(*swap
->read_debug_info
) (abfd
, sec
, info
))
4271 error ("Error reading ECOFF debugging information: %s",
4272 bfd_errmsg (bfd_get_error ()));
4274 mdebug_build_psymtabs (objfile
, swap
, info
);
4278 /* Things used for calling functions in the inferior.
4279 These functions are exported to our companion
4280 mips-tdep.c file and are here because they play
4281 with the symbol-table explicitly. */
4283 /* Sigtramp: make sure we have all the necessary information
4284 about the signal trampoline code. Since the official code
4285 from MIPS does not do so, we make up that information ourselves.
4286 If they fix the library (unlikely) this code will neutralize itself. */
4288 /* FIXME: This function is called only by mips-tdep.c. It needs to be
4289 here because it calls functions defined in this file, but perhaps
4290 this could be handled in a better way. Only compile it in when
4291 tm-mips.h is included. */
4300 struct block
*b
, *b0
= NULL
;
4302 sigtramp_address
= -1;
4304 /* We have to handle the following cases here:
4305 a) The Mips library has a sigtramp label within sigvec.
4306 b) Irix has a _sigtramp which we want to use, but it also has sigvec. */
4307 s
= lookup_symbol ("sigvec", 0, VAR_NAMESPACE
, 0, NULL
);
4310 b0
= SYMBOL_BLOCK_VALUE (s
);
4311 s
= lookup_symbol ("sigtramp", b0
, VAR_NAMESPACE
, 0, NULL
);
4315 /* No sigvec or no sigtramp inside sigvec, try _sigtramp. */
4316 s
= lookup_symbol ("_sigtramp", 0, VAR_NAMESPACE
, 0, NULL
);
4319 /* But maybe this program uses its own version of sigvec */
4323 /* Did we or MIPSco fix the library ? */
4324 if (SYMBOL_CLASS (s
) == LOC_BLOCK
)
4326 sigtramp_address
= BLOCK_START (SYMBOL_BLOCK_VALUE (s
));
4327 sigtramp_end
= BLOCK_END (SYMBOL_BLOCK_VALUE (s
));
4331 sigtramp_address
= SYMBOL_VALUE (s
);
4332 sigtramp_end
= sigtramp_address
+ 0x88; /* black magic */
4334 /* But what symtab does it live in ? */
4335 st
= find_pc_symtab (SYMBOL_VALUE (s
));
4338 * Ok, there goes the fix: turn it into a procedure, with all the
4339 * needed info. Note we make it a nested procedure of sigvec,
4340 * which is the way the (assembly) code is actually written.
4342 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
4343 SYMBOL_CLASS (s
) = LOC_BLOCK
;
4344 SYMBOL_TYPE (s
) = init_type (TYPE_CODE_FUNC
, 4, 0, (char *) NULL
,
4346 TYPE_TARGET_TYPE (SYMBOL_TYPE (s
)) = mdebug_type_void
;
4348 /* Need a block to allocate MIPS_EFI_SYMBOL_NAME in */
4350 SYMBOL_BLOCK_VALUE (s
) = b
;
4351 BLOCK_START (b
) = sigtramp_address
;
4352 BLOCK_END (b
) = sigtramp_end
;
4353 BLOCK_FUNCTION (b
) = s
;
4354 BLOCK_SUPERBLOCK (b
) = BLOCK_SUPERBLOCK (b0
);
4358 /* Make a MIPS_EFI_SYMBOL_NAME entry for it */
4360 struct mips_extra_func_info
*e
=
4361 ((struct mips_extra_func_info
*)
4362 xzalloc (sizeof (struct mips_extra_func_info
)));
4364 e
->numargs
= 0; /* the kernel thinks otherwise */
4365 e
->pdr
.frameoffset
= 32;
4366 e
->pdr
.framereg
= SP_REGNUM
;
4367 /* Note that setting pcreg is no longer strictly necessary as
4368 mips_frame_saved_pc is now aware of signal handler frames. */
4369 e
->pdr
.pcreg
= PC_REGNUM
;
4370 e
->pdr
.regmask
= -2;
4371 /* Offset to saved r31, in the sigtramp case the saved registers
4372 are above the frame in the sigcontext.
4373 We have 4 alignment bytes, 12 bytes for onstack, mask and pc,
4374 32 * 4 bytes for the general registers, 12 bytes for mdhi, mdlo, ownedfp
4375 and 32 * 4 bytes for the floating point registers. */
4376 e
->pdr
.regoffset
= 4 + 12 + 31 * 4;
4377 e
->pdr
.fregmask
= -1;
4378 /* Offset to saved f30 (first saved *double* register). */
4379 e
->pdr
.fregoffset
= 4 + 12 + 32 * 4 + 12 + 30 * 4;
4380 e
->pdr
.isym
= (long) s
;
4381 e
->pdr
.adr
= sigtramp_address
;
4383 current_objfile
= st
->objfile
; /* Keep new_symbol happy */
4384 s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
4385 SYMBOL_VALUE (s
) = (long) e
;
4386 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
4387 SYMBOL_CLASS (s
) = LOC_CONST
;
4388 SYMBOL_TYPE (s
) = mdebug_type_void
;
4389 current_objfile
= NULL
;
4392 BLOCK_SYM (b
, BLOCK_NSYMS (b
)++) = s
;
4395 #endif /* TM_MIPS_H */
4398 _initialize_mdebugread ()
4401 init_type (TYPE_CODE_VOID
, 1,
4403 "void", (struct objfile
*) NULL
);
4405 init_type (TYPE_CODE_INT
, 1,
4407 "char", (struct objfile
*) NULL
);
4408 mdebug_type_unsigned_char
=
4409 init_type (TYPE_CODE_INT
, 1,
4411 "unsigned char", (struct objfile
*) NULL
);
4413 init_type (TYPE_CODE_INT
, 2,
4415 "short", (struct objfile
*) NULL
);
4416 mdebug_type_unsigned_short
=
4417 init_type (TYPE_CODE_INT
, 2,
4419 "unsigned short", (struct objfile
*) NULL
);
4420 mdebug_type_int_32
=
4421 init_type (TYPE_CODE_INT
, 4,
4423 "int", (struct objfile
*) NULL
);
4424 mdebug_type_unsigned_int_32
=
4425 init_type (TYPE_CODE_INT
, 4,
4427 "unsigned int", (struct objfile
*) NULL
);
4428 mdebug_type_int_64
=
4429 init_type (TYPE_CODE_INT
, 8,
4431 "int", (struct objfile
*) NULL
);
4432 mdebug_type_unsigned_int_64
=
4433 init_type (TYPE_CODE_INT
, 8,
4435 "unsigned int", (struct objfile
*) NULL
);
4436 mdebug_type_long_32
=
4437 init_type (TYPE_CODE_INT
, 4,
4439 "long", (struct objfile
*) NULL
);
4440 mdebug_type_unsigned_long_32
=
4441 init_type (TYPE_CODE_INT
, 4,
4443 "unsigned long", (struct objfile
*) NULL
);
4444 mdebug_type_long_64
=
4445 init_type (TYPE_CODE_INT
, 8,
4447 "long", (struct objfile
*) NULL
);
4448 mdebug_type_unsigned_long_64
=
4449 init_type (TYPE_CODE_INT
, 8,
4451 "unsigned long", (struct objfile
*) NULL
);
4452 mdebug_type_long_long_64
=
4453 init_type (TYPE_CODE_INT
, 8,
4455 "long long", (struct objfile
*) NULL
);
4456 mdebug_type_unsigned_long_long_64
=
4457 init_type (TYPE_CODE_INT
, 8,
4459 "unsigned long long", (struct objfile
*) NULL
);
4460 mdebug_type_adr_32
=
4461 init_type (TYPE_CODE_PTR
, 4,
4463 "adr_32", (struct objfile
*) NULL
);
4464 TYPE_TARGET_TYPE (mdebug_type_adr_32
) = mdebug_type_void
;
4465 mdebug_type_adr_64
=
4466 init_type (TYPE_CODE_PTR
, 8,
4468 "adr_64", (struct objfile
*) NULL
);
4469 TYPE_TARGET_TYPE (mdebug_type_adr_64
) = mdebug_type_void
;
4471 init_type (TYPE_CODE_FLT
, TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
4473 "float", (struct objfile
*) NULL
);
4474 mdebug_type_double
=
4475 init_type (TYPE_CODE_FLT
, TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
4477 "double", (struct objfile
*) NULL
);
4478 mdebug_type_complex
=
4479 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
4481 "complex", (struct objfile
*) NULL
);
4482 TYPE_TARGET_TYPE (mdebug_type_complex
) = mdebug_type_float
;
4483 mdebug_type_double_complex
=
4484 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
4486 "double complex", (struct objfile
*) NULL
);
4487 TYPE_TARGET_TYPE (mdebug_type_double_complex
) = mdebug_type_double
;
4489 /* Is a "string" the way btString means it the same as TYPE_CODE_STRING?
4491 mdebug_type_string
=
4492 init_type (TYPE_CODE_STRING
,
4493 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
4495 (struct objfile
*) NULL
);
4497 /* We use TYPE_CODE_INT to print these as integers. Does this do any
4498 good? Would we be better off with TYPE_CODE_ERROR? Should
4499 TYPE_CODE_ERROR print things in hex if it knows the size? */
4500 mdebug_type_fixed_dec
=
4501 init_type (TYPE_CODE_INT
,
4502 TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
4504 (struct objfile
*) NULL
);
4506 mdebug_type_float_dec
=
4507 init_type (TYPE_CODE_ERROR
,
4508 TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
4509 0, "floating decimal",
4510 (struct objfile
*) NULL
);
4512 nodebug_func_symbol_type
= init_type (TYPE_CODE_FUNC
, 1, 0,
4513 "<function, no debug info>", NULL
);
4514 TYPE_TARGET_TYPE (nodebug_func_symbol_type
) = mdebug_type_int
;
4515 nodebug_var_symbol_type
=
4516 init_type (TYPE_CODE_INT
, TARGET_INT_BIT
/ HOST_CHAR_BIT
, 0,
4517 "<variable, no debug info>", NULL
);