1 /* Read a symbol table in ECOFF format (Third-Eye).
2 Copyright 1986, 87, 89, 90, 91, 92, 93, 94, 95, 96, 1997
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, Boston, MA 02111-1307, USA. */
24 /* This module provides the function mdebug_build_psymtabs. It reads
25 ECOFF debugging information into partial symbol tables. The
26 debugging information is read from two structures. A struct
27 ecoff_debug_swap includes the sizes of each ECOFF structure and
28 swapping routines; these are fixed for a particular target. A
29 struct ecoff_debug_info points to the debugging information for a
30 particular object file.
32 ECOFF symbol tables are mostly written in the byte order of the
33 target machine. However, one section of the table (the auxiliary
34 symbol information) is written in the host byte order. There is a
35 bit in the other symbol info which describes which host byte order
36 was used. ECOFF thereby takes the trophy from Intel `b.out' for
37 the most brain-dead adaptation of a file format to byte order.
39 This module can read all four of the known byte-order combinations,
40 on any type of host. */
50 #include "stabsread.h"
51 #include "complaints.h"
54 /* These are needed if the tm.h file does not contain the necessary
55 mips specific definitions. */
57 #ifndef MIPS_EFI_SYMBOL_NAME
58 #define MIPS_EFI_SYMBOL_NAME "__GDB_EFI_INFO__"
59 extern void ecoff_relocate_efi
PARAMS ((struct symbol
*, CORE_ADDR
));
61 #include "coff/symconst.h"
62 typedef struct mips_extra_func_info
{
65 } *mips_extra_func_info_t
;
72 #include <sys/types.h>
76 #include "gdb_string.h"
78 #include "gdb-stabs.h"
82 #include "coff/ecoff.h" /* COFF-like aspects of ecoff files */
84 #include "libaout.h" /* Private BFD a.out information. */
85 #include "aout/aout64.h"
86 #include "aout/stab_gnu.h" /* STABS information */
88 #include "expression.h"
89 #include "language.h" /* Needed inside partial-stab.h */
92 /* Provide a default mapping from a ecoff register number to a gdb REGNUM. */
93 #ifndef ECOFF_REG_TO_REGNUM
94 #define ECOFF_REG_TO_REGNUM(num) (num)
97 /* Provide a way to test if we have both ECOFF and ELF symbol tables.
98 We use this define in order to know whether we should override a
99 symbol's ECOFF section with its ELF section. This is necessary in
100 case the symbol's ELF section could not be represented in ECOFF. */
101 #define ECOFF_IN_ELF(bfd) (bfd_get_flavour (bfd) == bfd_target_elf_flavour \
102 && bfd_get_section_by_name (bfd, ".mdebug") != NULL)
105 /* We put a pointer to this structure in the read_symtab_private field
110 /* Index of the FDR that this psymtab represents. */
112 /* The BFD that the psymtab was created from. */
114 const struct ecoff_debug_swap
*debug_swap
;
115 struct ecoff_debug_info
*debug_info
;
116 struct mdebug_pending
**pending_list
;
117 /* Pointer to external symbols for this file. */
119 /* Size of extern_tab. */
121 enum language pst_language
;
124 #define PST_PRIVATE(p) ((struct symloc *)(p)->read_symtab_private)
125 #define FDR_IDX(p) (PST_PRIVATE(p)->fdr_idx)
126 #define CUR_BFD(p) (PST_PRIVATE(p)->cur_bfd)
127 #define DEBUG_SWAP(p) (PST_PRIVATE(p)->debug_swap)
128 #define DEBUG_INFO(p) (PST_PRIVATE(p)->debug_info)
129 #define PENDING_LIST(p) (PST_PRIVATE(p)->pending_list)
131 #define SC_IS_TEXT(sc) ((sc) == scText \
132 || (sc) == scRConst \
135 #define SC_IS_DATA(sc) ((sc) == scData \
140 #define SC_IS_COMMON(sc) ((sc) == scCommon || (sc) == scSCommon)
141 #define SC_IS_BSS(sc) ((sc) == scBss || (sc) == scSBss)
142 #define SC_IS_UNDEF(sc) ((sc) == scUndefined || (sc) == scSUndefined)
145 /* Things we import explicitly from other modules */
147 extern int info_verbose
;
149 /* Various complaints about symbol reading that don't abort the process */
151 static struct complaint bad_file_number_complaint
=
152 {"bad file number %d", 0, 0};
154 static struct complaint index_complaint
=
155 {"bad aux index at symbol %s", 0, 0};
157 static struct complaint aux_index_complaint
=
158 {"bad proc end in aux found from symbol %s", 0, 0};
160 static struct complaint block_index_complaint
=
161 {"bad aux index at block symbol %s", 0, 0};
163 static struct complaint unknown_ext_complaint
=
164 {"unknown external symbol %s", 0, 0};
166 static struct complaint unknown_sym_complaint
=
167 {"unknown local symbol %s", 0, 0};
169 static struct complaint unknown_st_complaint
=
170 {"with type %d", 0, 0};
172 static struct complaint block_overflow_complaint
=
173 {"block containing %s overfilled", 0, 0};
175 static struct complaint basic_type_complaint
=
176 {"cannot map ECOFF basic type 0x%x for %s", 0, 0};
178 static struct complaint unknown_type_qual_complaint
=
179 {"unknown type qualifier 0x%x", 0, 0};
181 static struct complaint array_index_type_complaint
=
182 {"illegal array index type for %s, assuming int", 0, 0};
184 static struct complaint bad_tag_guess_complaint
=
185 {"guessed tag type of %s incorrectly", 0, 0};
187 static struct complaint block_member_complaint
=
188 {"declaration block contains unhandled symbol type %d", 0, 0};
190 static struct complaint stEnd_complaint
=
191 {"stEnd with storage class %d not handled", 0, 0};
193 static struct complaint unknown_mdebug_symtype_complaint
=
194 {"unknown symbol type 0x%x", 0, 0};
196 static struct complaint stab_unknown_complaint
=
197 {"unknown stabs symbol %s", 0, 0};
199 static struct complaint pdr_for_nonsymbol_complaint
=
200 {"PDR for %s, but no symbol", 0, 0};
202 static struct complaint pdr_static_symbol_complaint
=
203 {"can't handle PDR for static proc at 0x%lx", 0, 0};
205 static struct complaint bad_setjmp_pdr_complaint
=
206 {"fixing bad setjmp PDR from libc", 0, 0};
208 static struct complaint bad_fbitfield_complaint
=
209 {"can't handle TIR fBitfield for %s", 0, 0};
211 static struct complaint bad_continued_complaint
=
212 {"illegal TIR continued for %s", 0, 0};
214 static struct complaint bad_rfd_entry_complaint
=
215 {"bad rfd entry for %s: file %d, index %d", 0, 0};
217 static struct complaint unexpected_type_code_complaint
=
218 {"unexpected type code for %s", 0, 0};
220 static struct complaint unable_to_cross_ref_complaint
=
221 {"unable to cross ref btTypedef for %s", 0, 0};
223 static struct complaint bad_indirect_xref_complaint
=
224 {"unable to cross ref btIndirect for %s", 0, 0};
226 static struct complaint illegal_forward_tq0_complaint
=
227 {"illegal tq0 in forward typedef for %s", 0, 0};
229 static struct complaint illegal_forward_bt_complaint
=
230 {"illegal bt %d in forward typedef for %s", 0, 0};
232 static struct complaint bad_linetable_guess_complaint
=
233 {"guessed size of linetable for %s incorrectly", 0, 0};
235 static struct complaint bad_ext_ifd_complaint
=
236 {"bad ifd for external symbol: %d (max %d)", 0, 0};
238 static struct complaint bad_ext_iss_complaint
=
239 {"bad iss for external symbol: %ld (max %ld)", 0, 0};
241 /* Macros and extra defs */
243 /* Puns: hard to find whether -g was used and how */
245 #define MIN_GLEVEL GLEVEL_0
246 #define compare_glevel(a,b) \
247 (((a) == GLEVEL_3) ? ((b) < GLEVEL_3) : \
248 ((b) == GLEVEL_3) ? -1 : (int)((b) - (a)))
250 /* Things that really are local to this module */
252 /* Remember what we deduced to be the source language of this psymtab. */
254 static enum language psymtab_language
= language_unknown
;
260 /* How to parse debugging information for CUR_BFD. */
262 static const struct ecoff_debug_swap
*debug_swap
;
264 /* Pointers to debugging information for CUR_BFD. */
266 static struct ecoff_debug_info
*debug_info
;
268 /* Pointer to current file decriptor record, and its index */
273 /* Index of current symbol */
277 /* Note how much "debuggable" this image is. We would like
278 to see at least one FDR with full symbols */
280 static int max_gdbinfo
;
281 static int max_glevel
;
283 /* When examining .o files, report on undefined symbols */
285 static int n_undef_symbols
, n_undef_labels
, n_undef_vars
, n_undef_procs
;
287 /* Pseudo symbol to use when putting stabs into the symbol table. */
289 static char stabs_symbol
[] = STABS_SYMBOL
;
291 /* Types corresponding to mdebug format bt* basic types. */
293 static struct type
*mdebug_type_void
;
294 static struct type
*mdebug_type_char
;
295 static struct type
*mdebug_type_short
;
296 static struct type
*mdebug_type_int_32
;
297 #define mdebug_type_int mdebug_type_int_32
298 static struct type
*mdebug_type_int_64
;
299 static struct type
*mdebug_type_long_32
;
300 static struct type
*mdebug_type_long_64
;
301 static struct type
*mdebug_type_long_long_64
;
302 static struct type
*mdebug_type_unsigned_char
;
303 static struct type
*mdebug_type_unsigned_short
;
304 static struct type
*mdebug_type_unsigned_int_32
;
305 static struct type
*mdebug_type_unsigned_int_64
;
306 static struct type
*mdebug_type_unsigned_long_32
;
307 static struct type
*mdebug_type_unsigned_long_64
;
308 static struct type
*mdebug_type_unsigned_long_long_64
;
309 static struct type
*mdebug_type_adr_32
;
310 static struct type
*mdebug_type_adr_64
;
311 static struct type
*mdebug_type_float
;
312 static struct type
*mdebug_type_double
;
313 static struct type
*mdebug_type_complex
;
314 static struct type
*mdebug_type_double_complex
;
315 static struct type
*mdebug_type_fixed_dec
;
316 static struct type
*mdebug_type_float_dec
;
317 static struct type
*mdebug_type_string
;
319 /* Types for symbols from files compiled without debugging info. */
321 static struct type
*nodebug_func_symbol_type
;
322 static struct type
*nodebug_var_symbol_type
;
324 /* Nonzero if we have seen ecoff debugging info for a file. */
326 static int found_ecoff_debugging_info
;
328 /* Forward declarations */
331 add_pending
PARAMS ((FDR
*, char *, struct type
*));
333 static struct mdebug_pending
*
334 is_pending_symbol
PARAMS ((FDR
*, char *));
337 pop_parse_stack
PARAMS ((void));
340 push_parse_stack
PARAMS ((void));
343 fdr_name
PARAMS ((FDR
*));
346 mdebug_psymtab_to_symtab
PARAMS ((struct partial_symtab
*));
349 upgrade_type
PARAMS ((int, struct type
**, int, union aux_ext
*, int, char *));
352 parse_partial_symbols
PARAMS ((struct objfile
*,
353 struct section_offsets
*));
356 *get_rfd
PARAMS ((int, int));
359 has_opaque_xref
PARAMS ((FDR
*, SYMR
*));
362 cross_ref
PARAMS ((int, union aux_ext
*, struct type
**, enum type_code
,
363 char **, int, char *));
365 static struct symbol
*
366 new_symbol
PARAMS ((char *));
369 new_type
PARAMS ((char *));
371 static struct block
*
372 new_block
PARAMS ((int));
374 static struct symtab
*
375 new_symtab
PARAMS ((char *, int, int, struct objfile
*));
377 static struct linetable
*
378 new_linetable
PARAMS ((int));
380 static struct blockvector
*
381 new_bvect
PARAMS ((int));
384 parse_symbol
PARAMS ((SYMR
*, union aux_ext
*, char *, int, struct section_offsets
*));
387 parse_type
PARAMS ((int, union aux_ext
*, unsigned int, int *, int, char *));
389 static struct symbol
*
390 mylookup_symbol
PARAMS ((char *, struct block
*, namespace_enum
,
391 enum address_class
));
393 static struct block
*
394 shrink_block
PARAMS ((struct block
*, struct symtab
*));
397 xzalloc
PARAMS ((unsigned int));
400 sort_blocks
PARAMS ((struct symtab
*));
403 compare_blocks
PARAMS ((const void *, const void *));
405 static struct partial_symtab
*
406 new_psymtab
PARAMS ((char *, struct objfile
*, struct section_offsets
*));
409 psymtab_to_symtab_1
PARAMS ((struct partial_symtab
*, char *));
412 add_block
PARAMS ((struct block
*, struct symtab
*));
415 add_symbol
PARAMS ((struct symbol
*, struct block
*));
418 add_line
PARAMS ((struct linetable
*, int, CORE_ADDR
, int));
420 static struct linetable
*
421 shrink_linetable
PARAMS ((struct linetable
*));
424 handle_psymbol_enumerators
PARAMS ((struct objfile
*, FDR
*, int, CORE_ADDR
));
427 mdebug_next_symbol_text
PARAMS ((struct objfile
*));
429 /* Address bounds for the signal trampoline in inferior, if any */
431 CORE_ADDR sigtramp_address
, sigtramp_end
;
433 /* Allocate zeroed memory */
439 PTR p
= xmalloc (size
);
445 /* Exported procedure: Builds a symtab from the PST partial one.
446 Restores the environment in effect when PST was created, delegates
447 most of the work to an ancillary procedure, and sorts
448 and reorders the symtab list at the end */
451 mdebug_psymtab_to_symtab (pst
)
452 struct partial_symtab
*pst
;
460 printf_filtered ("Reading in symbols for %s...", pst
->filename
);
461 gdb_flush (gdb_stdout
);
464 next_symbol_text_func
= mdebug_next_symbol_text
;
466 psymtab_to_symtab_1 (pst
, pst
->filename
);
468 /* Match with global symbols. This only needs to be done once,
469 after all of the symtabs and dependencies have been read in. */
470 scan_file_globals (pst
->objfile
);
473 printf_filtered ("done.\n");
476 /* File-level interface functions */
478 /* Find a file descriptor given its index RF relative to a file CF */
488 fdrs
= debug_info
->fdr
;
490 /* Object files do not have the RFD table, all refs are absolute */
493 (*debug_swap
->swap_rfd_in
) (cur_bfd
,
494 ((char *) debug_info
->external_rfd
496 * debug_swap
->external_rfd_size
)),
501 /* Return a safer print NAME for a file descriptor */
508 return "<stripped file>";
511 return debug_info
->ss
+ f
->issBase
+ f
->rss
;
515 /* Read in and parse the symtab of the file OBJFILE. Symbols from
516 different sections are relocated via the SECTION_OFFSETS. */
519 mdebug_build_psymtabs (objfile
, swap
, info
, section_offsets
)
520 struct objfile
*objfile
;
521 const struct ecoff_debug_swap
*swap
;
522 struct ecoff_debug_info
*info
;
523 struct section_offsets
*section_offsets
;
525 cur_bfd
= objfile
->obfd
;
529 /* Make sure all the FDR information is swapped in. */
530 if (info
->fdr
== (FDR
*) NULL
)
536 info
->fdr
= (FDR
*) obstack_alloc (&objfile
->psymbol_obstack
,
537 (info
->symbolic_header
.ifdMax
539 fdr_src
= info
->external_fdr
;
541 + info
->symbolic_header
.ifdMax
* swap
->external_fdr_size
);
543 for (; fdr_src
< fdr_end
; fdr_src
+= swap
->external_fdr_size
, fdr_ptr
++)
544 (*swap
->swap_fdr_in
) (objfile
->obfd
, fdr_src
, fdr_ptr
);
547 parse_partial_symbols (objfile
, section_offsets
);
550 /* Check to make sure file was compiled with -g. If not, warn the
551 user of this limitation. */
552 if (compare_glevel (max_glevel
, GLEVEL_2
) < 0)
554 if (max_gdbinfo
== 0)
555 printf_unfiltered ("\n%s not compiled with -g, debugging support is limited.\n",
557 printf_unfiltered ("You should compile with -g2 or -g3 for best debugging support.\n");
558 gdb_flush (gdb_stdout
);
563 /* Local utilities */
565 /* Map of FDR indexes to partial symtabs */
569 struct partial_symtab
*pst
; /* the psymtab proper */
570 long n_globals
; /* exported globals (external symbols) */
571 long globals_offset
; /* cumulative */
575 /* Utility stack, used to nest procedures and blocks properly.
576 It is a doubly linked list, to avoid too many alloc/free.
577 Since we might need it quite a few times it is NOT deallocated
580 static struct parse_stack
582 struct parse_stack
*next
, *prev
;
583 struct symtab
*cur_st
; /* Current symtab. */
584 struct block
*cur_block
; /* Block in it. */
586 /* What are we parsing. stFile, or stBlock are for files and
587 blocks. stProc or stStaticProc means we have seen the start of a
588 procedure, but not the start of the block within in. When we see
589 the start of that block, we change it to stNil, without pushing a
590 new block, i.e. stNil means both a procedure and a block. */
594 int maxsyms
; /* Max symbols in this block. */
595 struct type
*cur_type
; /* Type we parse fields for. */
596 int cur_field
; /* Field number in cur_type. */
597 CORE_ADDR procadr
; /* Start addres of this procedure */
598 int numargs
; /* Its argument count */
601 *top_stack
; /* Top stack ptr */
604 /* Enter a new lexical context */
609 struct parse_stack
*new;
611 /* Reuse frames if possible */
612 if (top_stack
&& top_stack
->prev
)
613 new = top_stack
->prev
;
615 new = (struct parse_stack
*) xzalloc (sizeof (struct parse_stack
));
616 /* Initialize new frame with previous content */
619 register struct parse_stack
*prev
= new->prev
;
622 top_stack
->prev
= new;
624 new->next
= top_stack
;
629 /* Exit a lexical context */
637 top_stack
= top_stack
->next
;
641 /* Cross-references might be to things we haven't looked at
642 yet, e.g. type references. To avoid too many type
643 duplications we keep a quick fixup table, an array
644 of lists of references indexed by file descriptor */
646 struct mdebug_pending
648 struct mdebug_pending
*next
; /* link */
649 char *s
; /* the unswapped symbol */
650 struct type
*t
; /* its partial type descriptor */
654 /* The pending information is kept for an entire object file, and used
655 to be in the sym_private field. I took it out when I split
656 mdebugread from mipsread, because this might not be the only type
657 of symbols read from an object file. Instead, we allocate the
658 pending information table when we create the partial symbols, and
659 we store a pointer to the single table in each psymtab. */
661 static struct mdebug_pending
**pending_list
;
663 /* Check whether we already saw symbol SH in file FH */
665 static struct mdebug_pending
*
666 is_pending_symbol (fh
, sh
)
670 int f_idx
= fh
- debug_info
->fdr
;
671 register struct mdebug_pending
*p
;
673 /* Linear search is ok, list is typically no more than 10 deep */
674 for (p
= pending_list
[f_idx
]; p
; p
= p
->next
)
680 /* Add a new symbol SH of type T */
683 add_pending (fh
, sh
, t
)
688 int f_idx
= fh
- debug_info
->fdr
;
689 struct mdebug_pending
*p
= is_pending_symbol (fh
, sh
);
691 /* Make sure we do not make duplicates */
694 p
= ((struct mdebug_pending
*)
695 obstack_alloc (¤t_objfile
->psymbol_obstack
,
696 sizeof (struct mdebug_pending
)));
699 p
->next
= pending_list
[f_idx
];
700 pending_list
[f_idx
] = p
;
705 /* Parsing Routines proper. */
707 /* Parse a single symbol. Mostly just make up a GDB symbol for it.
708 For blocks, procedures and types we open a new lexical context.
709 This is basically just a big switch on the symbol's type. Argument
710 AX is the base pointer of aux symbols for this file (fh->iauxBase).
711 EXT_SH points to the unswapped symbol, which is needed for struct,
712 union, etc., types; it is NULL for an EXTR. BIGEND says whether
713 aux symbols are big-endian or little-endian. Return count of
714 SYMR's handled (normally one). */
717 parse_symbol (sh
, ax
, ext_sh
, bigend
, section_offsets
)
722 struct section_offsets
*section_offsets
;
724 const bfd_size_type external_sym_size
= debug_swap
->external_sym_size
;
725 void (* const swap_sym_in
) PARAMS ((bfd
*, PTR
, SYMR
*)) =
726 debug_swap
->swap_sym_in
;
730 struct mdebug_pending
*pend
;
734 enum address_class
class;
736 long svalue
= sh
->value
;
739 if (ext_sh
== (char *) NULL
)
740 name
= debug_info
->ssext
+ sh
->iss
;
742 name
= debug_info
->ss
+ cur_fdr
->issBase
+ sh
->iss
;
748 /* Do not relocate relative values.
749 The value of a stEnd symbol is the displacement from the
750 corresponding start symbol value.
751 The value of a stBlock symbol is the displacement from the
752 procedure address. */
753 if (sh
->st
!= stEnd
&& sh
->st
!= stBlock
)
754 sh
->value
+= ANOFFSET (section_offsets
, SECT_OFF_TEXT
);
761 sh
->value
+= ANOFFSET (section_offsets
, SECT_OFF_DATA
);
765 sh
->value
+= ANOFFSET (section_offsets
, SECT_OFF_BSS
);
774 case stGlobal
: /* external symbol, goes into global block */
776 b
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack
->cur_st
),
778 s
= new_symbol (name
);
779 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
782 case stStatic
: /* static data, goes into current block. */
784 b
= top_stack
->cur_block
;
785 s
= new_symbol (name
);
786 if (SC_IS_COMMON(sh
->sc
))
788 /* It is a FORTRAN common block. At least for SGI Fortran the
789 address is not in the symbol; we need to fix it later in
790 scan_file_globals. */
791 int bucket
= hashname (SYMBOL_NAME (s
));
792 SYMBOL_VALUE_CHAIN (s
) = global_sym_chain
[bucket
];
793 global_sym_chain
[bucket
] = s
;
796 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
799 case stLocal
: /* local variable, goes into current block */
800 if (sh
->sc
== scRegister
)
802 class = LOC_REGISTER
;
803 svalue
= ECOFF_REG_TO_REGNUM (svalue
);
807 b
= top_stack
->cur_block
;
808 s
= new_symbol (name
);
809 SYMBOL_VALUE (s
) = svalue
;
811 data
: /* Common code for symbols describing data */
812 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
813 SYMBOL_CLASS (s
) = class;
816 /* Type could be missing if file is compiled without debugging info. */
817 if (SC_IS_UNDEF(sh
->sc
)
818 || sh
->sc
== scNil
|| sh
->index
== indexNil
)
819 SYMBOL_TYPE (s
) = nodebug_var_symbol_type
;
821 SYMBOL_TYPE (s
) = parse_type (cur_fd
, ax
, sh
->index
, 0, bigend
, name
);
822 /* Value of a data symbol is its memory address */
825 case stParam
: /* arg to procedure, goes into current block */
827 found_ecoff_debugging_info
= 1;
828 top_stack
->numargs
++;
830 /* Special GNU C++ name. */
831 if (is_cplus_marker (name
[0]) && name
[1] == 't' && name
[2] == 0)
832 name
= "this"; /* FIXME, not alloc'd in obstack */
833 s
= new_symbol (name
);
835 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
839 /* Pass by value in register. */
840 SYMBOL_CLASS(s
) = LOC_REGPARM
;
841 svalue
= ECOFF_REG_TO_REGNUM (svalue
);
844 /* Pass by reference on stack. */
845 SYMBOL_CLASS(s
) = LOC_REF_ARG
;
848 /* Pass by reference in register. */
849 SYMBOL_CLASS(s
) = LOC_REGPARM_ADDR
;
850 svalue
= ECOFF_REG_TO_REGNUM (svalue
);
853 /* Pass by value on stack. */
854 SYMBOL_CLASS(s
) = LOC_ARG
;
857 SYMBOL_VALUE (s
) = svalue
;
858 SYMBOL_TYPE (s
) = parse_type (cur_fd
, ax
, sh
->index
, 0, bigend
, name
);
859 add_symbol (s
, top_stack
->cur_block
);
862 case stLabel
: /* label, goes into current block */
863 s
= new_symbol (name
);
864 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
; /* so that it can be used */
865 SYMBOL_CLASS (s
) = LOC_LABEL
; /* but not misused */
866 SYMBOL_VALUE_ADDRESS (s
) = (CORE_ADDR
) sh
->value
;
867 SYMBOL_TYPE (s
) = mdebug_type_int
;
868 add_symbol (s
, top_stack
->cur_block
);
871 case stProc
: /* Procedure, usually goes into global block */
872 case stStaticProc
: /* Static procedure, goes into current block */
873 s
= new_symbol (name
);
874 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
875 SYMBOL_CLASS (s
) = LOC_BLOCK
;
876 /* Type of the return value */
877 if (SC_IS_UNDEF(sh
->sc
) || sh
->sc
== scNil
)
881 t
= parse_type (cur_fd
, ax
, sh
->index
+ 1, 0, bigend
, name
);
882 if (STREQ(name
, "malloc") && t
->code
== TYPE_CODE_VOID
)
884 /* I don't know why, but, at least under Alpha GNU/Linux,
885 when linking against a malloc without debugging
886 symbols, its read as a function returning void---this
887 is bad because it means we cannot call functions with
888 string arguments interactively; i.e., "call
889 printf("howdy\n")" would fail with the error message
890 "program has no memory available". To avoid this, we
891 patch up the type and make it void*
892 instead. (davidm@azstarnet.com)
894 t
= make_pointer_type (t
, NULL
);
897 b
= top_stack
->cur_block
;
898 if (sh
->st
== stProc
)
900 struct blockvector
*bv
= BLOCKVECTOR (top_stack
->cur_st
);
901 /* The next test should normally be true, but provides a
902 hook for nested functions (which we don't want to make
904 if (b
== BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
))
905 b
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
906 /* Irix 5 sometimes has duplicate names for the same
907 function. We want to add such names up at the global
908 level, not as a nested function. */
909 else if (sh
->value
== top_stack
->procadr
)
910 b
= BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
);
914 /* Make a type for the procedure itself */
915 SYMBOL_TYPE (s
) = lookup_function_type (t
);
917 /* Create and enter a new lexical context */
918 b
= new_block (top_stack
->maxsyms
);
919 SYMBOL_BLOCK_VALUE (s
) = b
;
920 BLOCK_FUNCTION (b
) = s
;
921 BLOCK_START (b
) = BLOCK_END (b
) = sh
->value
;
922 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
923 add_block (b
, top_stack
->cur_st
);
925 /* Not if we only have partial info */
926 if (SC_IS_UNDEF(sh
->sc
) || sh
->sc
== scNil
)
930 top_stack
->cur_block
= b
;
931 top_stack
->blocktype
= sh
->st
;
932 top_stack
->cur_type
= SYMBOL_TYPE (s
);
933 top_stack
->cur_field
= -1;
934 top_stack
->procadr
= sh
->value
;
935 top_stack
->numargs
= 0;
938 /* Beginning of code for structure, union, and enum definitions.
939 They all share a common set of local variables, defined here. */
941 enum type_code type_code
;
947 case stStruct
: /* Start a block defining a struct type */
948 type_code
= TYPE_CODE_STRUCT
;
949 goto structured_common
;
951 case stUnion
: /* Start a block defining a union type */
952 type_code
= TYPE_CODE_UNION
;
953 goto structured_common
;
955 case stEnum
: /* Start a block defining an enum type */
956 type_code
= TYPE_CODE_ENUM
;
957 goto structured_common
;
959 case stBlock
: /* Either a lexical block, or some type */
960 if (sh
->sc
!= scInfo
&& !SC_IS_COMMON(sh
->sc
))
961 goto case_stBlock_code
; /* Lexical block */
963 type_code
= TYPE_CODE_UNDEF
; /* We have a type. */
965 /* Common code for handling struct, union, enum, and/or as-yet-
966 unknown-type blocks of info about structured data. `type_code'
967 has been set to the proper TYPE_CODE, if we know it. */
969 found_ecoff_debugging_info
= 1;
971 top_stack
->blocktype
= stBlock
;
973 /* First count the number of fields and the highest value. */
976 for (ext_tsym
= ext_sh
+ external_sym_size
;
978 ext_tsym
+= external_sym_size
)
982 (*swap_sym_in
) (cur_bfd
, ext_tsym
, &tsym
);
990 if (nfields
== 0 && type_code
== TYPE_CODE_UNDEF
)
991 /* If the type of the member is Nil (or Void),
992 without qualifiers, assume the tag is an
994 Alpha cc -migrate enums are recognized by a zero
995 index and a zero symbol value.
996 DU 4.0 cc enums are recognized by a member type of
997 btEnum without qualifiers and a zero symbol value. */
998 if (tsym
.index
== indexNil
999 || (tsym
.index
== 0 && sh
->value
== 0))
1000 type_code
= TYPE_CODE_ENUM
;
1003 (*debug_swap
->swap_tir_in
) (bigend
,
1004 &ax
[tsym
.index
].a_ti
,
1006 if ((tir
.bt
== btNil
|| tir
.bt
== btVoid
1007 || (tir
.bt
== btEnum
&& sh
->value
== 0))
1008 && tir
.tq0
== tqNil
)
1009 type_code
= TYPE_CODE_ENUM
;
1012 if (tsym
.value
> max_value
)
1013 max_value
= tsym
.value
;
1022 /* This is a no-op; is it trying to tell us something
1023 we should be checking? */
1024 if (tsym
.sc
== scVariant
); /*UNIMPLEMENTED*/
1026 if (tsym
.index
!= 0)
1028 /* This is something like a struct within a
1029 struct. Skip over the fields of the inner
1030 struct. The -1 is because the for loop will
1031 increment ext_tsym. */
1032 ext_tsym
= ((char *) debug_info
->external_sym
1033 + ((cur_fdr
->isymBase
+ tsym
.index
- 1)
1034 * external_sym_size
));
1040 /* mips cc puts out a typedef for struct x if it is not yet
1041 defined when it encounters
1042 struct y { struct x *xp; };
1047 /* Irix5 cc puts out a stIndirect for struct x if it is not
1048 yet defined when it encounters
1049 struct y { struct x *xp; };
1054 complain (&block_member_complaint
, tsym
.st
);
1059 /* In an stBlock, there is no way to distinguish structs,
1060 unions, and enums at this point. This is a bug in the
1061 original design (that has been fixed with the recent
1062 addition of the stStruct, stUnion, and stEnum symbol
1063 types.) The way you can tell is if/when you see a variable
1064 or field of that type. In that case the variable's type
1065 (in the AUX table) says if the type is struct, union, or
1066 enum, and points back to the stBlock here. So you can
1067 patch the tag kind up later - but only if there actually is
1068 a variable or field of that type.
1070 So until we know for sure, we will guess at this point.
1072 If the first member has index==indexNil or a void type,
1073 assume we have an enumeration.
1074 Otherwise, if there is more than one member, and all
1075 the members have offset 0, assume we have a union.
1076 Otherwise, assume we have a struct.
1078 The heuristic could guess wrong in the case of of an
1079 enumeration with no members or a union with one (or zero)
1080 members, or when all except the last field of a struct have
1081 width zero. These are uncommon and/or illegal situations,
1082 and in any case guessing wrong probably doesn't matter
1085 But if we later do find out we were wrong, we fixup the tag
1086 kind. Members of an enumeration must be handled
1087 differently from struct/union fields, and that is harder to
1088 patch up, but luckily we shouldn't need to. (If there are
1089 any enumeration members, we can tell for sure it's an enum
1092 if (type_code
== TYPE_CODE_UNDEF
)
1093 if (nfields
> 1 && max_value
== 0)
1094 type_code
= TYPE_CODE_UNION
;
1096 type_code
= TYPE_CODE_STRUCT
;
1098 /* Create a new type or use the pending type. */
1099 pend
= is_pending_symbol (cur_fdr
, ext_sh
);
1100 if (pend
== (struct mdebug_pending
*) NULL
)
1102 t
= new_type (NULL
);
1103 add_pending (cur_fdr
, ext_sh
, t
);
1108 /* Do not set the tag name if it is a compiler generated tag name
1109 (.Fxx or .xxfake or empty) for unnamed struct/union/enums.
1110 Alpha cc puts out an sh->iss of zero for those. */
1111 if (sh
->iss
== 0 || name
[0] == '.' || name
[0] == '\0')
1112 TYPE_TAG_NAME (t
) = NULL
;
1114 TYPE_TAG_NAME (t
) = obconcat (¤t_objfile
->symbol_obstack
,
1117 TYPE_CODE (t
) = type_code
;
1118 TYPE_LENGTH (t
) = sh
->value
;
1119 TYPE_NFIELDS (t
) = nfields
;
1120 TYPE_FIELDS (t
) = f
= ((struct field
*)
1122 nfields
* sizeof (struct field
)));
1124 if (type_code
== TYPE_CODE_ENUM
)
1126 int unsigned_enum
= 1;
1128 /* This is a non-empty enum. */
1130 /* DEC c89 has the number of enumerators in the sh.value field,
1131 not the type length, so we have to compensate for that
1132 incompatibility quirk.
1133 This might do the wrong thing for an enum with one or two
1134 enumerators and gcc -gcoff -fshort-enums, but these cases
1135 are hopefully rare enough.
1136 Alpha cc -migrate has a sh.value field of zero, we adjust
1138 if (TYPE_LENGTH (t
) == TYPE_NFIELDS (t
)
1139 || TYPE_LENGTH (t
) == 0)
1140 TYPE_LENGTH (t
) = TARGET_INT_BIT
/ HOST_CHAR_BIT
;
1141 for (ext_tsym
= ext_sh
+ external_sym_size
;
1143 ext_tsym
+= external_sym_size
)
1146 struct symbol
*enum_sym
;
1148 (*swap_sym_in
) (cur_bfd
, ext_tsym
, &tsym
);
1150 if (tsym
.st
!= stMember
)
1153 FIELD_BITPOS (*f
) = tsym
.value
;
1154 FIELD_TYPE (*f
) = t
;
1155 FIELD_NAME (*f
) = debug_info
->ss
+ cur_fdr
->issBase
+ tsym
.iss
;
1156 FIELD_BITSIZE (*f
) = 0;
1158 enum_sym
= ((struct symbol
*)
1159 obstack_alloc (¤t_objfile
->symbol_obstack
,
1160 sizeof (struct symbol
)));
1161 memset ((PTR
) enum_sym
, 0, sizeof (struct symbol
));
1162 SYMBOL_NAME (enum_sym
) =
1163 obsavestring (f
->name
, strlen (f
->name
),
1164 ¤t_objfile
->symbol_obstack
);
1165 SYMBOL_CLASS (enum_sym
) = LOC_CONST
;
1166 SYMBOL_TYPE (enum_sym
) = t
;
1167 SYMBOL_NAMESPACE (enum_sym
) = VAR_NAMESPACE
;
1168 SYMBOL_VALUE (enum_sym
) = tsym
.value
;
1169 if (SYMBOL_VALUE (enum_sym
) < 0)
1171 add_symbol (enum_sym
, top_stack
->cur_block
);
1173 /* Skip the stMembers that we've handled. */
1178 TYPE_FLAGS (t
) |= TYPE_FLAG_UNSIGNED
;
1180 /* make this the current type */
1181 top_stack
->cur_type
= t
;
1182 top_stack
->cur_field
= 0;
1184 /* Do not create a symbol for alpha cc unnamed structs. */
1188 /* gcc puts out an empty struct for an opaque struct definitions,
1189 do not create a symbol for it either. */
1190 if (TYPE_NFIELDS (t
) == 0)
1192 TYPE_FLAGS (t
) |= TYPE_FLAG_STUB
;
1196 s
= new_symbol (name
);
1197 SYMBOL_NAMESPACE (s
) = STRUCT_NAMESPACE
;
1198 SYMBOL_CLASS (s
) = LOC_TYPEDEF
;
1199 SYMBOL_VALUE (s
) = 0;
1200 SYMBOL_TYPE (s
) = t
;
1201 add_symbol (s
, top_stack
->cur_block
);
1204 /* End of local variables shared by struct, union, enum, and
1205 block (as yet unknown struct/union/enum) processing. */
1209 found_ecoff_debugging_info
= 1;
1210 /* beginnning of (code) block. Value of symbol
1211 is the displacement from procedure start */
1212 push_parse_stack ();
1214 /* Do not start a new block if this is the outermost block of a
1215 procedure. This allows the LOC_BLOCK symbol to point to the
1216 block with the local variables, so funcname::var works. */
1217 if (top_stack
->blocktype
== stProc
1218 || top_stack
->blocktype
== stStaticProc
)
1220 top_stack
->blocktype
= stNil
;
1224 top_stack
->blocktype
= stBlock
;
1225 b
= new_block (top_stack
->maxsyms
);
1226 BLOCK_START (b
) = sh
->value
+ top_stack
->procadr
;
1227 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
1228 top_stack
->cur_block
= b
;
1229 add_block (b
, top_stack
->cur_st
);
1232 case stEnd
: /* end (of anything) */
1233 if (sh
->sc
== scInfo
|| SC_IS_COMMON(sh
->sc
))
1235 /* Finished with type */
1236 top_stack
->cur_type
= 0;
1238 else if (sh
->sc
== scText
&&
1239 (top_stack
->blocktype
== stProc
||
1240 top_stack
->blocktype
== stStaticProc
))
1242 /* Finished with procedure */
1243 struct blockvector
*bv
= BLOCKVECTOR (top_stack
->cur_st
);
1244 struct mips_extra_func_info
*e
;
1246 struct type
*ftype
= top_stack
->cur_type
;
1249 BLOCK_END (top_stack
->cur_block
) += sh
->value
; /* size */
1251 /* Make up special symbol to contain procedure specific info */
1252 s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
1253 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
1254 SYMBOL_CLASS (s
) = LOC_CONST
;
1255 SYMBOL_TYPE (s
) = mdebug_type_void
;
1256 e
= ((struct mips_extra_func_info
*)
1257 obstack_alloc (¤t_objfile
->symbol_obstack
,
1258 sizeof (struct mips_extra_func_info
)));
1259 memset ((PTR
) e
, 0, sizeof (struct mips_extra_func_info
));
1260 SYMBOL_VALUE (s
) = (long) e
;
1261 e
->numargs
= top_stack
->numargs
;
1262 e
->pdr
.framereg
= -1;
1263 add_symbol (s
, top_stack
->cur_block
);
1265 /* Reallocate symbols, saving memory */
1266 b
= shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
1268 /* f77 emits proc-level with address bounds==[0,0],
1269 So look for such child blocks, and patch them. */
1270 for (i
= 0; i
< BLOCKVECTOR_NBLOCKS (bv
); i
++)
1272 struct block
*b_bad
= BLOCKVECTOR_BLOCK (bv
, i
);
1273 if (BLOCK_SUPERBLOCK (b_bad
) == b
1274 && BLOCK_START (b_bad
) == top_stack
->procadr
1275 && BLOCK_END (b_bad
) == top_stack
->procadr
)
1277 BLOCK_START (b_bad
) = BLOCK_START (b
);
1278 BLOCK_END (b_bad
) = BLOCK_END (b
);
1282 if (TYPE_NFIELDS (ftype
) <= 0)
1284 /* No parameter type information is recorded with the function's
1285 type. Set that from the type of the parameter symbols. */
1286 int nparams
= top_stack
->numargs
;
1292 TYPE_NFIELDS (ftype
) = nparams
;
1293 TYPE_FIELDS (ftype
) = (struct field
*)
1294 TYPE_ALLOC (ftype
, nparams
* sizeof (struct field
));
1296 for (i
= iparams
= 0; iparams
< nparams
; i
++)
1298 sym
= BLOCK_SYM (b
, i
);
1299 switch (SYMBOL_CLASS (sym
))
1304 case LOC_REGPARM_ADDR
:
1305 TYPE_FIELD_TYPE (ftype
, iparams
) = SYMBOL_TYPE (sym
);
1315 else if (sh
->sc
== scText
&& top_stack
->blocktype
== stBlock
)
1317 /* End of (code) block. The value of the symbol is the
1318 displacement from the procedure`s start address of the
1319 end of this block. */
1320 BLOCK_END (top_stack
->cur_block
) = sh
->value
+ top_stack
->procadr
;
1321 shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
1323 else if (sh
->sc
== scText
&& top_stack
->blocktype
== stNil
)
1325 /* End of outermost block. Pop parse stack and ignore. The
1326 following stEnd of stProc will take care of the block. */
1329 else if (sh
->sc
== scText
&& top_stack
->blocktype
== stFile
)
1331 /* End of file. Pop parse stack and ignore. Higher
1332 level code deals with this. */
1336 complain (&stEnd_complaint
, sh
->sc
);
1338 pop_parse_stack (); /* restore previous lexical context */
1341 case stMember
: /* member of struct or union */
1342 f
= &TYPE_FIELDS (top_stack
->cur_type
)[top_stack
->cur_field
++];
1343 FIELD_NAME (*f
) = name
;
1344 FIELD_BITPOS (*f
) = sh
->value
;
1346 FIELD_TYPE (*f
) = parse_type (cur_fd
, ax
, sh
->index
, &bitsize
, bigend
, name
);
1347 FIELD_BITSIZE (*f
) = bitsize
;
1350 case stIndirect
: /* forward declaration on Irix5 */
1351 /* Forward declarations from Irix5 cc are handled by cross_ref,
1355 case stTypedef
: /* type definition */
1356 found_ecoff_debugging_info
= 1;
1358 /* Typedefs for forward declarations and opaque structs from alpha cc
1359 are handled by cross_ref, skip them. */
1363 /* Parse the type or use the pending type. */
1364 pend
= is_pending_symbol (cur_fdr
, ext_sh
);
1365 if (pend
== (struct mdebug_pending
*) NULL
)
1367 t
= parse_type (cur_fd
, ax
, sh
->index
, (int *)NULL
, bigend
, name
);
1368 add_pending (cur_fdr
, ext_sh
, t
);
1373 /* mips cc puts out a typedef with the name of the struct for forward
1374 declarations. These should not go into the symbol table and
1375 TYPE_NAME should not be set for them.
1376 They can't be distinguished from an intentional typedef to
1377 the same name however:
1379 struct x { int ix; int jx; };
1383 struct xx {int ixx; int jxx; };
1384 generates a cross referencing stTypedef for x and xx.
1385 The user visible effect of this is that the type of a pointer
1386 to struct foo sometimes is given as `foo *' instead of `struct foo *'.
1387 The problem is fixed with alpha cc and Irix5 cc. */
1389 /* However if the typedef cross references to an opaque aggregate, it
1390 is safe to omit it from the symbol table. */
1392 if (has_opaque_xref (cur_fdr
, sh
))
1394 s
= new_symbol (name
);
1395 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
1396 SYMBOL_CLASS (s
) = LOC_TYPEDEF
;
1397 SYMBOL_BLOCK_VALUE (s
) = top_stack
->cur_block
;
1398 SYMBOL_TYPE (s
) = t
;
1399 add_symbol (s
, top_stack
->cur_block
);
1401 /* Incomplete definitions of structs should not get a name. */
1402 if (TYPE_NAME (SYMBOL_TYPE (s
)) == NULL
1403 && (TYPE_NFIELDS (SYMBOL_TYPE (s
)) != 0
1404 || (TYPE_CODE (SYMBOL_TYPE (s
)) != TYPE_CODE_STRUCT
1405 && TYPE_CODE (SYMBOL_TYPE (s
)) != TYPE_CODE_UNION
)))
1407 if (TYPE_CODE (SYMBOL_TYPE (s
)) == TYPE_CODE_PTR
1408 || TYPE_CODE (SYMBOL_TYPE (s
)) == TYPE_CODE_FUNC
)
1410 /* If we are giving a name to a type such as "pointer to
1411 foo" or "function returning foo", we better not set
1412 the TYPE_NAME. If the program contains "typedef char
1413 *caddr_t;", we don't want all variables of type char
1414 * to print as caddr_t. This is not just a
1415 consequence of GDB's type management; CC and GCC (at
1416 least through version 2.4) both output variables of
1417 either type char * or caddr_t with the type
1418 refering to the stTypedef symbol for caddr_t. If a future
1419 compiler cleans this up it GDB is not ready for it
1420 yet, but if it becomes ready we somehow need to
1421 disable this check (without breaking the PCC/GCC2.4
1426 Fortunately, this check seems not to be necessary
1427 for anything except pointers or functions. */
1430 TYPE_NAME (SYMBOL_TYPE (s
)) = SYMBOL_NAME (s
);
1434 case stFile
: /* file name */
1435 push_parse_stack ();
1436 top_stack
->blocktype
= sh
->st
;
1439 /* I`ve never seen these for C */
1441 break; /* register relocation */
1443 break; /* forwarding address */
1445 break; /* constant */
1447 complain (&unknown_mdebug_symtype_complaint
, sh
->st
);
1454 /* Parse the type information provided in the raw AX entries for
1455 the symbol SH. Return the bitfield size in BS, in case.
1456 We must byte-swap the AX entries before we use them; BIGEND says whether
1457 they are big-endian or little-endian (from fh->fBigendian). */
1459 static struct type
*
1460 parse_type (fd
, ax
, aux_index
, bs
, bigend
, sym_name
)
1463 unsigned int aux_index
;
1468 /* Null entries in this map are treated specially */
1469 static struct type
**map_bt
[] =
1471 &mdebug_type_void
, /* btNil */
1472 &mdebug_type_adr_32
, /* btAdr */
1473 &mdebug_type_char
, /* btChar */
1474 &mdebug_type_unsigned_char
, /* btUChar */
1475 &mdebug_type_short
, /* btShort */
1476 &mdebug_type_unsigned_short
, /* btUShort */
1477 &mdebug_type_int_32
, /* btInt */
1478 &mdebug_type_unsigned_int_32
, /* btUInt */
1479 &mdebug_type_long_32
, /* btLong */
1480 &mdebug_type_unsigned_long_32
, /* btULong */
1481 &mdebug_type_float
, /* btFloat */
1482 &mdebug_type_double
, /* btDouble */
1489 &mdebug_type_complex
, /* btComplex */
1490 &mdebug_type_double_complex
, /* btDComplex */
1492 &mdebug_type_fixed_dec
, /* btFixedDec */
1493 &mdebug_type_float_dec
, /* btFloatDec */
1494 &mdebug_type_string
, /* btString */
1497 &mdebug_type_void
, /* btVoid */
1498 0, /* DEC C++: Pointer to member */
1499 0, /* DEC C++: Virtual function table */
1500 0, /* DEC C++: Class (Record) */
1501 &mdebug_type_long_64
, /* btLong64 */
1502 &mdebug_type_unsigned_long_64
, /* btULong64 */
1503 &mdebug_type_long_long_64
, /* btLongLong64 */
1504 &mdebug_type_unsigned_long_long_64
, /* btULongLong64 */
1505 &mdebug_type_adr_64
, /* btAdr64 */
1506 &mdebug_type_int_64
, /* btInt64 */
1507 &mdebug_type_unsigned_int_64
, /* btUInt64 */
1511 struct type
*tp
= 0;
1512 enum type_code type_code
= TYPE_CODE_UNDEF
;
1514 /* Handle undefined types, they have indexNil. */
1515 if (aux_index
== indexNil
)
1516 return mdebug_type_int
;
1518 /* Handle corrupt aux indices. */
1519 if (aux_index
>= (debug_info
->fdr
+ fd
)->caux
)
1521 complain (&index_complaint
, sym_name
);
1522 return mdebug_type_int
;
1526 /* Use aux as a type information record, map its basic type. */
1527 (*debug_swap
->swap_tir_in
) (bigend
, &ax
->a_ti
, t
);
1528 if (t
->bt
>= (sizeof (map_bt
) / sizeof (*map_bt
)))
1530 complain (&basic_type_complaint
, t
->bt
, sym_name
);
1531 return mdebug_type_int
;
1535 tp
= *map_bt
[t
->bt
];
1540 /* Cannot use builtin types -- build our own */
1544 type_code
= TYPE_CODE_STRUCT
;
1547 type_code
= TYPE_CODE_UNION
;
1550 type_code
= TYPE_CODE_ENUM
;
1553 type_code
= TYPE_CODE_RANGE
;
1556 type_code
= TYPE_CODE_SET
;
1559 /* alpha cc -migrate uses this for typedefs. The true type will
1560 be obtained by crossreferencing below. */
1561 type_code
= TYPE_CODE_ERROR
;
1564 /* alpha cc uses this for typedefs. The true type will be
1565 obtained by crossreferencing below. */
1566 type_code
= TYPE_CODE_ERROR
;
1569 complain (&basic_type_complaint
, t
->bt
, sym_name
);
1570 return mdebug_type_int
;
1574 /* Move on to next aux */
1579 int width
= AUX_GET_WIDTH (bigend
, ax
);
1581 /* Inhibit core dumps with some cfront generated objects that
1583 if (bs
== (int *)NULL
)
1585 /* Alpha cc -migrate encodes char and unsigned char types
1586 as short and unsigned short types with a field width of 8.
1587 Enum types also have a field width which we ignore for now. */
1588 if (t
->bt
== btShort
&& width
== 8)
1589 tp
= mdebug_type_char
;
1590 else if (t
->bt
== btUShort
&& width
== 8)
1591 tp
= mdebug_type_unsigned_char
;
1592 else if (t
->bt
== btEnum
)
1595 complain (&bad_fbitfield_complaint
, sym_name
);
1602 /* A btIndirect entry cross references to an aux entry containing
1604 if (t
->bt
== btIndirect
)
1611 (*debug_swap
->swap_rndx_in
) (bigend
, &ax
->a_rndx
, rn
);
1613 if (rn
->rfd
== 0xfff)
1615 rf
= AUX_GET_ISYM (bigend
, ax
);
1623 complain (&bad_indirect_xref_complaint
, sym_name
);
1624 return mdebug_type_int
;
1626 xref_fh
= get_rfd (fd
, rf
);
1627 xref_fd
= xref_fh
- debug_info
->fdr
;
1628 tp
= parse_type (xref_fd
, debug_info
->external_aux
+ xref_fh
->iauxBase
,
1629 rn
->index
, (int *) NULL
, xref_fh
->fBigendian
, sym_name
);
1632 /* All these types really point to some (common) MIPS type
1633 definition, and only the type-qualifiers fully identify
1634 them. We'll make the same effort at sharing. */
1635 if (t
->bt
== btStruct
||
1639 /* btSet (I think) implies that the name is a tag name, not a typedef
1640 name. This apparently is a MIPS extension for C sets. */
1645 /* Try to cross reference this type, build new type on failure. */
1646 ax
+= cross_ref (fd
, ax
, &tp
, type_code
, &name
, bigend
, sym_name
);
1647 if (tp
== (struct type
*) NULL
)
1648 tp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
1650 /* DEC c89 produces cross references to qualified aggregate types,
1651 dereference them. */
1652 while (TYPE_CODE (tp
) == TYPE_CODE_PTR
1653 || TYPE_CODE (tp
) == TYPE_CODE_ARRAY
)
1654 tp
= tp
->target_type
;
1656 /* Make sure that TYPE_CODE(tp) has an expected type code.
1657 Any type may be returned from cross_ref if file indirect entries
1659 if (TYPE_CODE (tp
) != TYPE_CODE_STRUCT
1660 && TYPE_CODE (tp
) != TYPE_CODE_UNION
1661 && TYPE_CODE (tp
) != TYPE_CODE_ENUM
)
1663 complain (&unexpected_type_code_complaint
, sym_name
);
1668 /* Usually, TYPE_CODE(tp) is already type_code. The main
1669 exception is if we guessed wrong re struct/union/enum.
1670 But for struct vs. union a wrong guess is harmless, so
1671 don't complain(). */
1672 if ((TYPE_CODE (tp
) == TYPE_CODE_ENUM
1673 && type_code
!= TYPE_CODE_ENUM
)
1674 || (TYPE_CODE (tp
) != TYPE_CODE_ENUM
1675 && type_code
== TYPE_CODE_ENUM
))
1677 complain (&bad_tag_guess_complaint
, sym_name
);
1680 if (TYPE_CODE (tp
) != type_code
)
1682 TYPE_CODE (tp
) = type_code
;
1685 /* Do not set the tag name if it is a compiler generated tag name
1686 (.Fxx or .xxfake or empty) for unnamed struct/union/enums. */
1687 if (name
[0] == '.' || name
[0] == '\0')
1688 TYPE_TAG_NAME (tp
) = NULL
;
1689 else if (TYPE_TAG_NAME (tp
) == NULL
1690 || !STREQ (TYPE_TAG_NAME (tp
), name
))
1691 TYPE_TAG_NAME (tp
) = obsavestring (name
, strlen (name
),
1692 ¤t_objfile
->type_obstack
);
1696 /* All these types really point to some (common) MIPS type
1697 definition, and only the type-qualifiers fully identify
1698 them. We'll make the same effort at sharing.
1699 FIXME: We are not doing any guessing on range types. */
1700 if (t
->bt
== btRange
)
1704 /* Try to cross reference this type, build new type on failure. */
1705 ax
+= cross_ref (fd
, ax
, &tp
, type_code
, &name
, bigend
, sym_name
);
1706 if (tp
== (struct type
*) NULL
)
1707 tp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
1709 /* Make sure that TYPE_CODE(tp) has an expected type code.
1710 Any type may be returned from cross_ref if file indirect entries
1712 if (TYPE_CODE (tp
) != TYPE_CODE_RANGE
)
1714 complain (&unexpected_type_code_complaint
, sym_name
);
1718 /* Usually, TYPE_CODE(tp) is already type_code. The main
1719 exception is if we guessed wrong re struct/union/enum. */
1720 if (TYPE_CODE (tp
) != type_code
)
1722 complain (&bad_tag_guess_complaint
, sym_name
);
1723 TYPE_CODE (tp
) = type_code
;
1725 if (TYPE_NAME (tp
) == NULL
|| !STREQ (TYPE_NAME (tp
), name
))
1726 TYPE_NAME (tp
) = obsavestring (name
, strlen (name
),
1727 ¤t_objfile
->type_obstack
);
1730 if (t
->bt
== btTypedef
)
1734 /* Try to cross reference this type, it should succeed. */
1735 ax
+= cross_ref (fd
, ax
, &tp
, type_code
, &name
, bigend
, sym_name
);
1736 if (tp
== (struct type
*) NULL
)
1738 complain (&unable_to_cross_ref_complaint
, sym_name
);
1739 tp
= mdebug_type_int
;
1743 /* Deal with range types */
1744 if (t
->bt
== btRange
)
1746 TYPE_NFIELDS (tp
) = 2;
1747 TYPE_FIELDS (tp
) = ((struct field
*)
1748 TYPE_ALLOC (tp
, 2 * sizeof (struct field
)));
1749 TYPE_FIELD_NAME (tp
, 0) = obsavestring ("Low", strlen ("Low"),
1750 ¤t_objfile
->type_obstack
);
1751 TYPE_FIELD_BITPOS (tp
, 0) = AUX_GET_DNLOW (bigend
, ax
);
1753 TYPE_FIELD_NAME (tp
, 1) = obsavestring ("High", strlen ("High"),
1754 ¤t_objfile
->type_obstack
);
1755 TYPE_FIELD_BITPOS (tp
, 1) = AUX_GET_DNHIGH (bigend
, ax
);
1759 /* Parse all the type qualifiers now. If there are more
1760 than 6 the game will continue in the next aux */
1764 #define PARSE_TQ(tq) \
1765 if (t->tq != tqNil) \
1766 ax += upgrade_type(fd, &tp, t->tq, ax, bigend, sym_name); \
1778 /* mips cc 2.x and gcc never put out continued aux entries. */
1782 (*debug_swap
->swap_tir_in
) (bigend
, &ax
->a_ti
, t
);
1786 /* Complain for illegal continuations due to corrupt aux entries. */
1788 complain (&bad_continued_complaint
, sym_name
);
1793 /* Make up a complex type from a basic one. Type is passed by
1794 reference in TPP and side-effected as necessary. The type
1795 qualifier TQ says how to handle the aux symbols at AX for
1796 the symbol SX we are currently analyzing. BIGEND says whether
1797 aux symbols are big-endian or little-endian.
1798 Returns the number of aux symbols we parsed. */
1801 upgrade_type (fd
, tpp
, tq
, ax
, bigend
, sym_name
)
1812 /* Used in array processing */
1823 t
= lookup_pointer_type (*tpp
);
1828 t
= lookup_function_type (*tpp
);
1835 /* Determine and record the domain type (type of index) */
1836 (*debug_swap
->swap_rndx_in
) (bigend
, &ax
->a_rndx
, &rndx
);
1842 rf
= AUX_GET_ISYM (bigend
, ax
);
1845 fh
= get_rfd (fd
, rf
);
1847 indx
= parse_type (fh
- debug_info
->fdr
,
1848 debug_info
->external_aux
+ fh
->iauxBase
,
1849 id
, (int *) NULL
, bigend
, sym_name
);
1851 /* The bounds type should be an integer type, but might be anything
1852 else due to corrupt aux entries. */
1853 if (TYPE_CODE (indx
) != TYPE_CODE_INT
)
1855 complain (&array_index_type_complaint
, sym_name
);
1856 indx
= mdebug_type_int
;
1859 /* Get the bounds, and create the array type. */
1861 lower
= AUX_GET_DNLOW (bigend
, ax
);
1863 upper
= AUX_GET_DNHIGH (bigend
, ax
);
1865 rf
= AUX_GET_WIDTH (bigend
, ax
); /* bit size of array element */
1867 range
= create_range_type ((struct type
*) NULL
, indx
,
1870 t
= create_array_type ((struct type
*) NULL
, *tpp
, range
);
1872 /* We used to fill in the supplied array element bitsize
1873 here if the TYPE_LENGTH of the target type was zero.
1874 This happens for a `pointer to an array of anonymous structs',
1875 but in this case the array element bitsize is also zero,
1876 so nothing is gained.
1877 And we used to check the TYPE_LENGTH of the target type against
1878 the supplied array element bitsize.
1879 gcc causes a mismatch for `pointer to array of object',
1880 since the sdb directives it uses do not have a way of
1881 specifying the bitsize, but it does no harm (the
1882 TYPE_LENGTH should be correct) and we should be able to
1883 ignore the erroneous bitsize from the auxiliary entry safely.
1884 dbx seems to ignore it too. */
1886 /* TYPE_FLAG_TARGET_STUB now takes care of the zero TYPE_LENGTH
1888 if (TYPE_LENGTH (*tpp
) == 0)
1890 TYPE_FLAGS (t
) |= TYPE_FLAG_TARGET_STUB
;
1897 /* Volatile -- currently ignored */
1901 /* Const -- currently ignored */
1905 complain (&unknown_type_qual_complaint
, tq
);
1911 /* Parse a procedure descriptor record PR. Note that the procedure is
1912 parsed _after_ the local symbols, now we just insert the extra
1913 information we need into a MIPS_EFI_SYMBOL_NAME symbol that has
1914 already been placed in the procedure's main block. Note also that
1915 images that have been partially stripped (ld -x) have been deprived
1916 of local symbols, and we have to cope with them here. FIRST_OFF is
1917 the offset of the first procedure for this FDR; we adjust the
1918 address by this amount, but I don't know why. SEARCH_SYMTAB is the symtab
1919 to look for the function which contains the MIPS_EFI_SYMBOL_NAME symbol
1920 in question, or NULL to use top_stack->cur_block. */
1922 static void parse_procedure
PARAMS ((PDR
*, struct symtab
*,
1923 struct partial_symtab
*));
1926 parse_procedure (pr
, search_symtab
, pst
)
1928 struct symtab
*search_symtab
;
1929 struct partial_symtab
*pst
;
1931 struct symbol
*s
, *i
;
1933 struct mips_extra_func_info
*e
;
1936 /* Simple rule to find files linked "-x" */
1937 if (cur_fdr
->rss
== -1)
1941 /* Static procedure at address pr->adr. Sigh. */
1942 /* FIXME-32x64. assuming pr->adr fits in long. */
1943 complain (&pdr_static_symbol_complaint
, (unsigned long) pr
->adr
);
1951 (*debug_swap
->swap_ext_in
) (cur_bfd
,
1952 ((char *) debug_info
->external_ext
1954 * debug_swap
->external_ext_size
)),
1956 sh_name
= debug_info
->ssext
+ she
.asym
.iss
;
1964 (*debug_swap
->swap_sym_in
) (cur_bfd
,
1965 ((char *) debug_info
->external_sym
1966 + ((cur_fdr
->isymBase
+ pr
->isym
)
1967 * debug_swap
->external_sym_size
)),
1969 sh_name
= debug_info
->ss
+ cur_fdr
->issBase
+ sh
.iss
;
1972 if (search_symtab
!= NULL
)
1975 /* This loses both in the case mentioned (want a static, find a global),
1976 but also if we are looking up a non-mangled name which happens to
1977 match the name of a mangled function. */
1978 /* We have to save the cur_fdr across the call to lookup_symbol.
1979 If the pdr is for a static function and if a global function with
1980 the same name exists, lookup_symbol will eventually read in the symtab
1981 for the global function and clobber cur_fdr. */
1982 FDR
*save_cur_fdr
= cur_fdr
;
1983 s
= lookup_symbol (sh_name
, NULL
, VAR_NAMESPACE
, 0, NULL
);
1984 cur_fdr
= save_cur_fdr
;
1988 BLOCKVECTOR_BLOCK (BLOCKVECTOR (search_symtab
), STATIC_BLOCK
),
1994 s
= mylookup_symbol (sh_name
, top_stack
->cur_block
,
1995 VAR_NAMESPACE
, LOC_BLOCK
);
1999 b
= SYMBOL_BLOCK_VALUE (s
);
2003 complain (&pdr_for_nonsymbol_complaint
, sh_name
);
2007 /* FIXME -- delete. We can't do symbol allocation now; it's all done. */
2008 s
= new_symbol (sh_name
);
2009 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
2010 SYMBOL_CLASS (s
) = LOC_BLOCK
;
2011 /* Donno its type, hope int is ok */
2012 SYMBOL_TYPE (s
) = lookup_function_type (mdebug_type_int
);
2013 add_symbol (s
, top_stack
->cur_block
);
2014 /* Wont have symbols for this one */
2016 SYMBOL_BLOCK_VALUE (s
) = b
;
2017 BLOCK_FUNCTION (b
) = s
;
2018 BLOCK_START (b
) = pr
->adr
;
2019 /* BOUND used to be the end of procedure's text, but the
2020 argument is no longer passed in. */
2021 BLOCK_END (b
) = bound
;
2022 BLOCK_SUPERBLOCK (b
) = top_stack
->cur_block
;
2023 add_block (b
, top_stack
->cur_st
);
2027 i
= mylookup_symbol (MIPS_EFI_SYMBOL_NAME
, b
, LABEL_NAMESPACE
, LOC_CONST
);
2031 e
= (struct mips_extra_func_info
*) SYMBOL_VALUE (i
);
2033 e
->pdr
.isym
= (long) s
;
2035 /* GDB expects the absolute function start address for the
2036 procedure descriptor in e->pdr.adr.
2037 As the address in the procedure descriptor is usually relative,
2038 we would have to relocate e->pdr.adr with cur_fdr->adr and
2039 ANOFFSET (pst->section_offsets, SECT_OFF_TEXT).
2040 Unfortunately cur_fdr->adr and e->pdr.adr are both absolute
2041 in shared libraries on some systems, and on other systems
2042 e->pdr.adr is sometimes offset by a bogus value.
2043 To work around these problems, we replace e->pdr.adr with
2044 the start address of the function. */
2045 e
->pdr
.adr
= BLOCK_START (b
);
2047 /* Correct incorrect setjmp procedure descriptor from the library
2048 to make backtrace through setjmp work. */
2049 if (e
->pdr
.pcreg
== 0 && STREQ (sh_name
, "setjmp"))
2051 complain (&bad_setjmp_pdr_complaint
, 0);
2052 e
->pdr
.pcreg
= RA_REGNUM
;
2053 e
->pdr
.regmask
= 0x80000000;
2054 e
->pdr
.regoffset
= -4;
2058 /* It would be reasonable that functions that have been compiled
2059 without debugging info have a btNil type for their return value,
2060 and functions that are void and are compiled with debugging info
2062 gcc and DEC f77 put out btNil types for both cases, so btNil is mapped
2063 to TYPE_CODE_VOID in parse_type to get the `compiled with debugging info'
2065 The glevel field in cur_fdr could be used to determine the presence
2066 of debugging info, but GCC doesn't always pass the -g switch settings
2067 to the assembler and GAS doesn't set the glevel field from the -g switch
2069 To work around these problems, the return value type of a TYPE_CODE_VOID
2070 function is adjusted accordingly if no debugging info was found in the
2071 compilation unit. */
2073 if (processing_gcc_compilation
== 0
2074 && found_ecoff_debugging_info
== 0
2075 && TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (s
))) == TYPE_CODE_VOID
)
2076 SYMBOL_TYPE (s
) = nodebug_func_symbol_type
;
2079 /* Relocate the extra function info pointed to by the symbol table. */
2082 ecoff_relocate_efi (sym
, delta
)
2086 struct mips_extra_func_info
*e
;
2088 e
= (struct mips_extra_func_info
*) SYMBOL_VALUE (sym
);
2090 e
->pdr
.adr
+= delta
;
2093 /* Parse the external symbol ES. Just call parse_symbol() after
2094 making sure we know where the aux are for it.
2095 BIGEND says whether aux entries are big-endian or little-endian.
2097 This routine clobbers top_stack->cur_block and ->cur_st. */
2099 static void parse_external
PARAMS ((EXTR
*, int, struct section_offsets
*));
2102 parse_external (es
, bigend
, section_offsets
)
2105 struct section_offsets
*section_offsets
;
2109 if (es
->ifd
!= ifdNil
)
2112 cur_fdr
= debug_info
->fdr
+ cur_fd
;
2113 ax
= debug_info
->external_aux
+ cur_fdr
->iauxBase
;
2117 cur_fdr
= debug_info
->fdr
;
2121 /* Reading .o files */
2122 if (SC_IS_UNDEF(es
->asym
.sc
) || es
->asym
.sc
== scNil
)
2125 switch (es
->asym
.st
)
2128 /* These are generated for static symbols in .o files,
2149 /* FIXME: Turn this into a complaint? */
2151 printf_filtered ("Warning: %s `%s' is undefined (in %s)\n",
2152 what
, debug_info
->ssext
+ es
->asym
.iss
,
2153 fdr_name (cur_fdr
));
2157 switch (es
->asym
.st
)
2161 /* There is no need to parse the external procedure symbols.
2162 If they are from objects compiled without -g, their index will
2163 be indexNil, and the symbol definition from the minimal symbol
2164 is preferrable (yielding a function returning int instead of int).
2165 If the index points to a local procedure symbol, the local
2166 symbol already provides the correct type.
2167 Note that the index of the external procedure symbol points
2168 to the local procedure symbol in the local symbol table, and
2169 _not_ to the auxiliary symbol info. */
2173 /* Global common symbols are resolved by the runtime loader,
2175 if (SC_IS_COMMON(es
->asym
.sc
))
2178 /* Note that the case of a symbol with indexNil must be handled
2179 anyways by parse_symbol(). */
2180 parse_symbol (&es
->asym
, ax
, (char *) NULL
, bigend
, section_offsets
);
2187 /* Parse the line number info for file descriptor FH into
2188 GDB's linetable LT. MIPS' encoding requires a little bit
2189 of magic to get things out. Note also that MIPS' line
2190 numbers can go back and forth, apparently we can live
2191 with that and do not need to reorder our linetables */
2193 static void parse_lines
PARAMS ((FDR
*, PDR
*, struct linetable
*, int,
2194 struct partial_symtab
*, CORE_ADDR
));
2197 parse_lines (fh
, pr
, lt
, maxlines
, pst
, lowest_pdr_addr
)
2200 struct linetable
*lt
;
2202 struct partial_symtab
*pst
;
2203 CORE_ADDR lowest_pdr_addr
;
2205 unsigned char *base
;
2207 int delta
, count
, lineno
= 0;
2209 if (fh
->cbLine
== 0)
2212 /* Scan by procedure descriptors */
2214 for (j
= 0; j
< fh
->cpd
; j
++, pr
++)
2218 unsigned char *halt
;
2220 /* No code for this one */
2221 if (pr
->iline
== ilineNil
||
2222 pr
->lnLow
== -1 || pr
->lnHigh
== -1)
2225 /* Determine start and end address of compressed line bytes for
2227 base
= debug_info
->line
+ fh
->cbLineOffset
;
2228 if (j
!= (fh
->cpd
- 1))
2229 halt
= base
+ pr
[1].cbLineOffset
;
2231 halt
= base
+ fh
->cbLine
;
2232 base
+= pr
->cbLineOffset
;
2234 adr
= pst
->textlow
+ pr
->adr
- lowest_pdr_addr
;
2236 l
= adr
>> 2; /* in words */
2237 for (lineno
= pr
->lnLow
; base
< halt
; )
2239 count
= *base
& 0x0f;
2240 delta
= *base
++ >> 4;
2245 delta
= (base
[0] << 8) | base
[1];
2246 if (delta
>= 0x8000)
2250 lineno
+= delta
; /* first delta is 0 */
2252 /* Complain if the line table overflows. Could happen
2253 with corrupt binaries. */
2254 if (lt
->nitems
>= maxlines
)
2256 complain (&bad_linetable_guess_complaint
, fdr_name (fh
));
2259 k
= add_line (lt
, lineno
, l
, k
);
2265 /* Master parsing procedure for first-pass reading of file symbols
2266 into a partial_symtab. */
2269 parse_partial_symbols (objfile
, section_offsets
)
2270 struct objfile
*objfile
;
2271 struct section_offsets
*section_offsets
;
2273 const bfd_size_type external_sym_size
= debug_swap
->external_sym_size
;
2274 const bfd_size_type external_rfd_size
= debug_swap
->external_rfd_size
;
2275 const bfd_size_type external_ext_size
= debug_swap
->external_ext_size
;
2276 void (* const swap_ext_in
) PARAMS ((bfd
*, PTR
, EXTR
*))
2277 = debug_swap
->swap_ext_in
;
2278 void (* const swap_sym_in
) PARAMS ((bfd
*, PTR
, SYMR
*))
2279 = debug_swap
->swap_sym_in
;
2280 void (* const swap_rfd_in
) PARAMS ((bfd
*, PTR
, RFDT
*))
2281 = debug_swap
->swap_rfd_in
;
2283 HDRR
*hdr
= &debug_info
->symbolic_header
;
2284 /* Running pointers */
2289 register EXTR
*ext_in
;
2292 struct partial_symtab
*pst
;
2293 int textlow_not_set
= 1;
2294 int past_first_source_file
= 0;
2296 /* List of current psymtab's include files */
2297 char **psymtab_include_list
;
2298 int includes_allocated
;
2301 struct pst_map
*fdr_to_pst
;
2302 /* Index within current psymtab dependency list */
2303 struct partial_symtab
**dependency_list
;
2304 int dependencies_used
, dependencies_allocated
;
2305 struct cleanup
*old_chain
;
2307 enum language prev_language
;
2308 asection
*text_sect
;
2309 int relocatable
= 0;
2311 /* Irix 5.2 shared libraries have a fh->adr field of zero, but
2312 the shared libraries are prelinked at a high memory address.
2313 We have to adjust the start address of the object file for this case,
2314 by setting it to the start address of the first procedure in the file.
2315 But we should do no adjustments if we are debugging a .o file, where
2316 the text section (and fh->adr) really starts at zero. */
2317 text_sect
= bfd_get_section_by_name (cur_bfd
, ".text");
2318 if (text_sect
!= NULL
2319 && (bfd_get_section_flags (cur_bfd
, text_sect
) & SEC_RELOC
))
2322 extern_tab
= (EXTR
*) obstack_alloc (&objfile
->psymbol_obstack
,
2323 sizeof (EXTR
) * hdr
->iextMax
);
2325 includes_allocated
= 30;
2327 psymtab_include_list
= (char **) alloca (includes_allocated
*
2329 next_symbol_text_func
= mdebug_next_symbol_text
;
2331 dependencies_allocated
= 30;
2332 dependencies_used
= 0;
2334 (struct partial_symtab
**) alloca (dependencies_allocated
*
2335 sizeof (struct partial_symtab
*));
2337 last_source_file
= NULL
;
2342 * Only parse the Local and External symbols, and the Relative FDR.
2343 * Fixup enough of the loader symtab to be able to use it.
2344 * Allocate space only for the file's portions we need to
2349 max_glevel
= MIN_GLEVEL
;
2351 /* Allocate the map FDR -> PST.
2352 Minor hack: -O3 images might claim some global data belongs
2353 to FDR -1. We`ll go along with that */
2354 fdr_to_pst
= (struct pst_map
*) xzalloc ((hdr
->ifdMax
+ 1) * sizeof *fdr_to_pst
);
2355 old_chain
= make_cleanup (free
, fdr_to_pst
);
2358 struct partial_symtab
*pst
= new_psymtab ("", objfile
, section_offsets
);
2359 fdr_to_pst
[-1].pst
= pst
;
2363 /* Allocate the global pending list. */
2365 ((struct mdebug_pending
**)
2366 obstack_alloc (&objfile
->psymbol_obstack
,
2367 hdr
->ifdMax
* sizeof (struct mdebug_pending
*)));
2368 memset ((PTR
) pending_list
, 0,
2369 hdr
->ifdMax
* sizeof (struct mdebug_pending
*));
2371 /* Pass 0 over external syms: swap them in. */
2372 ext_block
= (EXTR
*) xmalloc (hdr
->iextMax
* sizeof (EXTR
));
2373 make_cleanup (free
, ext_block
);
2375 ext_out
= (char *) debug_info
->external_ext
;
2376 ext_out_end
= ext_out
+ hdr
->iextMax
* external_ext_size
;
2378 for (; ext_out
< ext_out_end
; ext_out
+= external_ext_size
, ext_in
++)
2379 (*swap_ext_in
) (cur_bfd
, ext_out
, ext_in
);
2381 /* Pass 1 over external syms: Presize and partition the list */
2383 ext_in_end
= ext_in
+ hdr
->iextMax
;
2384 for (; ext_in
< ext_in_end
; ext_in
++)
2386 /* See calls to complain below. */
2387 if (ext_in
->ifd
>= -1
2388 && ext_in
->ifd
< hdr
->ifdMax
2389 && ext_in
->asym
.iss
>= 0
2390 && ext_in
->asym
.iss
< hdr
->issExtMax
)
2391 fdr_to_pst
[ext_in
->ifd
].n_globals
++;
2394 /* Pass 1.5 over files: partition out global symbol space */
2396 for (f_idx
= -1; f_idx
< hdr
->ifdMax
; f_idx
++)
2398 fdr_to_pst
[f_idx
].globals_offset
= s_idx
;
2399 s_idx
+= fdr_to_pst
[f_idx
].n_globals
;
2400 fdr_to_pst
[f_idx
].n_globals
= 0;
2405 For ECOFF in ELF, we skip the creation of the minimal symbols.
2406 The ECOFF symbols should be a subset of the Elf symbols, and the
2407 section information of the elf symbols will be more accurate.
2408 FIXME! What about Irix 5's native linker?
2410 By default, Elf sections which don't exist in ECOFF
2411 get put in ECOFF's absolute section by the gnu linker.
2412 Since absolute sections don't get relocated, we
2413 end up calculating an address different from that of
2414 the symbol's minimal symbol (created earlier from the
2417 To fix this, either :
2418 1) don't create the duplicate symbol
2419 (assumes ECOFF symtab is a subset of the ELF symtab;
2420 assumes no side-effects result from ignoring ECOFF symbol)
2421 2) create it, only if lookup for existing symbol in ELF's minimal
2424 assumes no side-effects result from ignoring ECOFF symbol)
2425 3) create it, but lookup ELF's minimal symbol and use it's section
2426 during relocation, then modify "uniqify" phase to merge and
2427 eliminate the duplicate symbol
2428 (highly inefficient)
2430 I've implemented #1 here...
2431 Skip the creation of the minimal symbols based on the ECOFF
2434 if (ECOFF_IN_ELF(cur_bfd
))
2436 /* Pass 2 over external syms: fill in external symbols */
2438 ext_in_end
= ext_in
+ hdr
->iextMax
;
2439 for (; ext_in
< ext_in_end
; ext_in
++)
2441 enum minimal_symbol_type ms_type
= mst_text
;
2442 CORE_ADDR svalue
= ext_in
->asym
.value
;
2444 /* The Irix 5 native tools seem to sometimes generate bogus
2445 external symbols. */
2446 if (ext_in
->ifd
< -1 || ext_in
->ifd
>= hdr
->ifdMax
)
2448 complain (&bad_ext_ifd_complaint
, ext_in
->ifd
, hdr
->ifdMax
);
2451 if (ext_in
->asym
.iss
< 0 || ext_in
->asym
.iss
>= hdr
->issExtMax
)
2453 complain (&bad_ext_iss_complaint
, ext_in
->asym
.iss
,
2458 extern_tab
[fdr_to_pst
[ext_in
->ifd
].globals_offset
2459 + fdr_to_pst
[ext_in
->ifd
].n_globals
++] = *ext_in
;
2462 if (SC_IS_UNDEF(ext_in
->asym
.sc
) || ext_in
->asym
.sc
== scNil
)
2466 /* Pass 3 over files, over local syms: fill in static symbols */
2467 name
= debug_info
->ssext
+ ext_in
->asym
.iss
;
2469 /* Process ECOFF Symbol Types and Storage Classes */
2470 switch (ext_in
->asym
.st
)
2473 /* Beginnning of Procedure */
2474 svalue
+= ANOFFSET (section_offsets
, SECT_OFF_TEXT
);
2477 /* Load time only static procs */
2478 ms_type
= mst_file_text
;
2479 svalue
+= ANOFFSET (section_offsets
, SECT_OFF_TEXT
);
2482 /* External symbol */
2483 if (SC_IS_COMMON (ext_in
->asym
.sc
))
2485 /* The value of a common symbol is its size, not its address.
2489 else if (SC_IS_DATA (ext_in
->asym
.sc
))
2492 svalue
+= ANOFFSET (section_offsets
, SECT_OFF_DATA
);
2494 else if (SC_IS_BSS (ext_in
->asym
.sc
))
2497 svalue
+= ANOFFSET (section_offsets
, SECT_OFF_BSS
);
2504 if (SC_IS_TEXT (ext_in
->asym
.sc
))
2506 ms_type
= mst_file_text
;
2507 svalue
+= ANOFFSET (section_offsets
, SECT_OFF_TEXT
);
2509 else if (SC_IS_DATA (ext_in
->asym
.sc
))
2511 ms_type
= mst_file_data
;
2512 svalue
+= ANOFFSET (section_offsets
, SECT_OFF_DATA
);
2514 else if (SC_IS_BSS (ext_in
->asym
.sc
))
2516 ms_type
= mst_file_bss
;
2517 svalue
+= ANOFFSET (section_offsets
, SECT_OFF_BSS
);
2524 /* The alpha has the section start addresses in stLocal symbols
2525 whose name starts with a `.'. Skip those but complain for all
2526 other stLocal symbols.
2527 Irix6 puts the section start addresses in stNil symbols, skip
2533 ms_type
= mst_unknown
;
2534 complain (&unknown_ext_complaint
, name
);
2536 prim_record_minimal_symbol (name
, svalue
, ms_type
, objfile
);
2540 /* Pass 3 over files, over local syms: fill in static symbols */
2541 for (f_idx
= 0; f_idx
< hdr
->ifdMax
; f_idx
++)
2543 struct partial_symtab
*save_pst
;
2547 cur_fdr
= fh
= debug_info
->fdr
+ f_idx
;
2551 fdr_to_pst
[f_idx
].pst
= NULL
;
2555 /* Determine the start address for this object file from the
2556 file header and relocate it, except for Irix 5.2 zero fh->adr. */
2560 if (relocatable
|| textlow
!= 0)
2561 textlow
+= ANOFFSET (section_offsets
, SECT_OFF_TEXT
);
2565 pst
= start_psymtab_common (objfile
, section_offsets
,
2568 objfile
->global_psymbols
.next
,
2569 objfile
->static_psymbols
.next
);
2570 pst
->read_symtab_private
= ((char *)
2571 obstack_alloc (&objfile
->psymbol_obstack
,
2572 sizeof (struct symloc
)));
2573 memset ((PTR
) pst
->read_symtab_private
, 0, sizeof (struct symloc
));
2576 FDR_IDX (pst
) = f_idx
;
2577 CUR_BFD (pst
) = cur_bfd
;
2578 DEBUG_SWAP (pst
) = debug_swap
;
2579 DEBUG_INFO (pst
) = debug_info
;
2580 PENDING_LIST (pst
) = pending_list
;
2582 /* The way to turn this into a symtab is to call... */
2583 pst
->read_symtab
= mdebug_psymtab_to_symtab
;
2585 /* Set up language for the pst.
2586 The language from the FDR is used if it is unambigious (e.g. cfront
2587 with native cc and g++ will set the language to C).
2588 Otherwise we have to deduce the language from the filename.
2589 Native ecoff has every header file in a separate FDR, so
2590 deduce_language_from_filename will return language_unknown for
2591 a header file, which is not what we want.
2592 But the FDRs for the header files are after the FDR for the source
2593 file, so we can assign the language of the source file to the
2594 following header files. Then we save the language in the private
2595 pst data so that we can reuse it when building symtabs. */
2596 prev_language
= psymtab_language
;
2600 case langCplusplusV2
:
2601 psymtab_language
= language_cplus
;
2604 psymtab_language
= deduce_language_from_filename (fdr_name (fh
));
2607 if (psymtab_language
== language_unknown
)
2608 psymtab_language
= prev_language
;
2609 PST_PRIVATE (pst
)->pst_language
= psymtab_language
;
2611 pst
->texthigh
= pst
->textlow
;
2613 /* For stabs-in-ecoff files, the second symbol must be @stab.
2614 This symbol is emitted by mips-tfile to signal that the
2615 current object file uses encapsulated stabs instead of mips
2616 ecoff for local symbols. (It is the second symbol because
2617 the first symbol is the stFile used to signal the start of a
2619 processing_gcc_compilation
= 0;
2622 (*swap_sym_in
) (cur_bfd
,
2623 ((char *) debug_info
->external_sym
2624 + (fh
->isymBase
+ 1) * external_sym_size
),
2626 if (STREQ (debug_info
->ss
+ fh
->issBase
+ sh
.iss
, stabs_symbol
))
2627 processing_gcc_compilation
= 2;
2630 if (processing_gcc_compilation
!= 0)
2632 for (cur_sdx
= 2; cur_sdx
< fh
->csym
; cur_sdx
++)
2637 (*swap_sym_in
) (cur_bfd
,
2638 (((char *) debug_info
->external_sym
)
2639 + (fh
->isymBase
+ cur_sdx
) * external_sym_size
),
2641 type_code
= ECOFF_UNMARK_STAB (sh
.index
);
2642 if (!ECOFF_IS_STAB (&sh
))
2644 if (sh
.st
== stProc
|| sh
.st
== stStaticProc
)
2649 sh
.value
+= ANOFFSET (section_offsets
, SECT_OFF_TEXT
);
2650 if (sh
.st
== stStaticProc
)
2652 namestring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2653 prim_record_minimal_symbol_and_info (namestring
,
2661 procaddr
= sh
.value
;
2663 isym
= AUX_GET_ISYM (fh
->fBigendian
,
2664 (debug_info
->external_aux
2667 (*swap_sym_in
) (cur_bfd
,
2668 ((char *) debug_info
->external_sym
2669 + ((fh
->isymBase
+ isym
- 1)
2670 * external_sym_size
)),
2674 CORE_ADDR high
= procaddr
+ sh
.value
;
2676 /* Kludge for Irix 5.2 zero fh->adr. */
2678 && (pst
->textlow
== 0 || procaddr
< pst
->textlow
))
2679 pst
->textlow
= procaddr
;
2680 if (high
> pst
->texthigh
)
2681 pst
->texthigh
= high
;
2684 else if (sh
.st
== stStatic
)
2699 namestring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2700 sh
.value
+= ANOFFSET (section_offsets
, SECT_OFF_DATA
);
2701 prim_record_minimal_symbol_and_info (namestring
,
2711 /* FIXME! Shouldn't this use cases for bss,
2712 then have the default be abs? */
2713 namestring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2714 sh
.value
+= ANOFFSET (section_offsets
, SECT_OFF_BSS
);
2715 prim_record_minimal_symbol_and_info (namestring
,
2727 /* Handle stabs continuation */
2729 char *stabstring
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2730 int len
= strlen (stabstring
);
2731 while (stabstring
[len
-1] == '\\')
2734 char *stabstring1
= stabstring
;
2738 /* Ignore continuation char from 1st string */
2741 /* Read next stabstring */
2743 (*swap_sym_in
) (cur_bfd
,
2744 (((char *) debug_info
->external_sym
)
2745 + (fh
->isymBase
+ cur_sdx
)
2746 * external_sym_size
),
2748 stabstring2
= debug_info
->ss
+ fh
->issBase
+ sh2
.iss
;
2749 len2
= strlen (stabstring2
);
2751 /* Concatinate stabstring2 with stabstring1 */
2753 && stabstring
!= debug_info
->ss
+ fh
->issBase
+ sh
.iss
)
2754 stabstring
= realloc (stabstring
, len
+ len2
+ 1);
2756 stabstring
= malloc (len
+ len2
+ 1);
2757 strcpy (stabstring
, stabstring1
);
2758 strcpy (stabstring
+ len
, stabstring2
);
2761 #define SET_NAMESTRING() \
2762 namestring = stabstring
2763 #define CUR_SYMBOL_TYPE type_code
2764 #define CUR_SYMBOL_VALUE sh.value
2765 #define START_PSYMTAB(ofile,secoff,fname,low,symoff,global_syms,static_syms)\
2767 #define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps,textlow_not_set) (void)0
2768 #define HANDLE_RBRAC(val) \
2769 if ((val) > save_pst->texthigh) save_pst->texthigh = (val);
2770 #include "partial-stab.h"
2773 && stabstring
!= debug_info
->ss
+ fh
->issBase
+ sh
.iss
)
2776 /* end - Handle continuation */
2781 for (cur_sdx
= 0; cur_sdx
< fh
->csym
;)
2784 enum address_class
class;
2786 (*swap_sym_in
) (cur_bfd
,
2787 ((char *) debug_info
->external_sym
2788 + ((fh
->isymBase
+ cur_sdx
)
2789 * external_sym_size
)),
2792 if (ECOFF_IS_STAB (&sh
))
2798 /* Non absolute static symbols go into the minimal table. */
2799 if (SC_IS_UNDEF(sh
.sc
) || sh
.sc
== scNil
2800 || (sh
.index
== indexNil
2801 && (sh
.st
!= stStatic
|| sh
.sc
== scAbs
)))
2803 /* FIXME, premature? */
2808 name
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
2814 /* The value of a stEnd symbol is the displacement from the
2815 corresponding start symbol value, do not relocate it. */
2817 sh
.value
+= ANOFFSET (section_offsets
, SECT_OFF_TEXT
);
2824 sh
.value
+= ANOFFSET (section_offsets
, SECT_OFF_DATA
);
2828 sh
.value
+= ANOFFSET (section_offsets
, SECT_OFF_BSS
);
2839 prim_record_minimal_symbol_and_info (name
, sh
.value
,
2840 mst_file_text
, NULL
,
2841 SECT_OFF_TEXT
, NULL
,
2847 /* Usually there is a local and a global stProc symbol
2848 for a function. This means that the function name
2849 has already been entered into the mimimal symbol table
2850 while processing the global symbols in pass 2 above.
2851 One notable exception is the PROGRAM name from
2852 f77 compiled executables, it is only put out as
2853 local stProc symbol, and a global MAIN__ stProc symbol
2854 points to it. It doesn't matter though, as gdb is
2855 still able to find the PROGRAM name via the partial
2856 symbol table, and the MAIN__ symbol via the minimal
2858 if (sh
.st
== stProc
)
2859 add_psymbol_to_list (name
, strlen (name
),
2860 VAR_NAMESPACE
, LOC_BLOCK
,
2861 &objfile
->global_psymbols
,
2862 0, sh
.value
, psymtab_language
, objfile
);
2864 add_psymbol_to_list (name
, strlen (name
),
2865 VAR_NAMESPACE
, LOC_BLOCK
,
2866 &objfile
->static_psymbols
,
2867 0, sh
.value
, psymtab_language
, objfile
);
2869 /* Skip over procedure to next one. */
2870 if (sh
.index
>= hdr
->iauxMax
)
2872 /* Should not happen, but does when cross-compiling
2873 with the MIPS compiler. FIXME -- pull later. */
2874 complain (&index_complaint
, name
);
2875 new_sdx
= cur_sdx
+ 1; /* Don't skip at all */
2878 new_sdx
= AUX_GET_ISYM (fh
->fBigendian
,
2879 (debug_info
->external_aux
2882 procaddr
= sh
.value
;
2884 if (new_sdx
<= cur_sdx
)
2886 /* This should not happen either... FIXME. */
2887 complain (&aux_index_complaint
, name
);
2888 new_sdx
= cur_sdx
+ 1; /* Don't skip backward */
2892 (*swap_sym_in
) (cur_bfd
,
2893 ((char *) debug_info
->external_sym
2894 + ((fh
->isymBase
+ cur_sdx
- 1)
2895 * external_sym_size
)),
2900 /* Kludge for Irix 5.2 zero fh->adr. */
2902 && (pst
->textlow
== 0 || procaddr
< pst
->textlow
))
2903 pst
->textlow
= procaddr
;
2905 high
= procaddr
+ sh
.value
;
2906 if (high
> pst
->texthigh
)
2907 pst
->texthigh
= high
;
2910 case stStatic
: /* Variable */
2911 if (SC_IS_DATA (sh
.sc
))
2912 prim_record_minimal_symbol_and_info (name
, sh
.value
,
2913 mst_file_data
, NULL
,
2918 prim_record_minimal_symbol_and_info (name
, sh
.value
,
2926 case stIndirect
:/* Irix5 forward declaration */
2927 /* Skip forward declarations from Irix5 cc */
2930 case stTypedef
:/* Typedef */
2931 /* Skip typedefs for forward declarations and opaque
2932 structs from alpha and mips cc. */
2933 if (sh
.iss
== 0 || has_opaque_xref (fh
, &sh
))
2935 class = LOC_TYPEDEF
;
2938 case stConstant
: /* Constant decl */
2945 case stBlock
: /* { }, str, un, enum*/
2946 /* Do not create a partial symbol for cc unnamed aggregates
2947 and gcc empty aggregates. */
2948 if ((sh
.sc
== scInfo
2949 || SC_IS_COMMON(sh
.sc
))
2951 && sh
.index
!= cur_sdx
+ 2)
2953 add_psymbol_to_list (name
, strlen (name
),
2954 STRUCT_NAMESPACE
, LOC_TYPEDEF
,
2955 &objfile
->static_psymbols
,
2957 psymtab_language
, objfile
);
2959 handle_psymbol_enumerators (objfile
, fh
, sh
.st
, sh
.value
);
2961 /* Skip over the block */
2963 if (new_sdx
<= cur_sdx
)
2965 /* This happens with the Ultrix kernel. */
2966 complain (&block_index_complaint
, name
);
2967 new_sdx
= cur_sdx
+ 1; /* Don't skip backward */
2972 case stFile
: /* File headers */
2973 case stLabel
: /* Labels */
2974 case stEnd
: /* Ends of files */
2977 case stLocal
: /* Local variables */
2978 /* Normally these are skipped because we skip over
2979 all blocks we see. However, these can occur
2980 as visible symbols in a .h file that contains code. */
2984 /* Both complaints are valid: one gives symbol name,
2985 the other the offending symbol type. */
2986 complain (&unknown_sym_complaint
, name
);
2987 complain (&unknown_st_complaint
, sh
.st
);
2991 /* Use this gdb symbol */
2992 add_psymbol_to_list (name
, strlen (name
),
2993 VAR_NAMESPACE
, class,
2994 &objfile
->static_psymbols
,
2995 0, sh
.value
, psymtab_language
, objfile
);
2997 cur_sdx
++; /* Go to next file symbol */
3000 /* Now do enter the external symbols. */
3001 ext_ptr
= &extern_tab
[fdr_to_pst
[f_idx
].globals_offset
];
3002 cur_sdx
= fdr_to_pst
[f_idx
].n_globals
;
3003 PST_PRIVATE (save_pst
)->extern_count
= cur_sdx
;
3004 PST_PRIVATE (save_pst
)->extern_tab
= ext_ptr
;
3005 for (; --cur_sdx
>= 0; ext_ptr
++)
3007 enum address_class
class;
3012 if (ext_ptr
->ifd
!= f_idx
)
3014 psh
= &ext_ptr
->asym
;
3016 /* Do not add undefined symbols to the partial symbol table. */
3017 if (SC_IS_UNDEF(psh
->sc
) || psh
->sc
== scNil
)
3020 svalue
= psh
->value
;
3025 svalue
+= ANOFFSET (section_offsets
, SECT_OFF_TEXT
);
3032 svalue
+= ANOFFSET (section_offsets
, SECT_OFF_DATA
);
3036 svalue
+= ANOFFSET (section_offsets
, SECT_OFF_BSS
);
3043 /* These are generated for static symbols in .o files,
3048 /* External procedure symbols have been entered
3049 into the minimal symbol table in pass 2 above.
3050 Ignore them, as parse_external will ignore them too. */
3056 complain (&unknown_ext_complaint
,
3057 debug_info
->ssext
+ psh
->iss
);
3058 /* Fall through, pretend it's global. */
3060 /* Global common symbols are resolved by the runtime loader,
3062 if (SC_IS_COMMON(psh
->sc
))
3068 name
= debug_info
->ssext
+ psh
->iss
;
3069 add_psymbol_to_list (name
, strlen (name
),
3070 VAR_NAMESPACE
, class,
3071 &objfile
->global_psymbols
,
3073 psymtab_language
, objfile
);
3077 /* Link pst to FDR. end_psymtab returns NULL if the psymtab was
3078 empty and put on the free list. */
3079 fdr_to_pst
[f_idx
].pst
= end_psymtab (save_pst
,
3080 psymtab_include_list
, includes_used
,
3081 -1, save_pst
->texthigh
,
3082 dependency_list
, dependencies_used
, textlow_not_set
);
3084 dependencies_used
= 0;
3086 if (objfile
->ei
.entry_point
>= save_pst
->textlow
&&
3087 objfile
->ei
.entry_point
< save_pst
->texthigh
)
3089 objfile
->ei
.entry_file_lowpc
= save_pst
->textlow
;
3090 objfile
->ei
.entry_file_highpc
= save_pst
->texthigh
;
3093 /* The objfile has its functions reordered if this partial symbol
3094 table overlaps any other partial symbol table.
3095 We cannot assume a reordered objfile if a partial symbol table
3096 is contained within another partial symbol table, as partial symbol
3097 tables for include files with executable code are contained
3098 within the partial symbol table for the including source file,
3099 and we do not want to flag the objfile reordered for these cases.
3101 This strategy works well for Irix-5.2 shared libraries, but we
3102 might have to use a more elaborate (and slower) algorithm for
3104 save_pst
= fdr_to_pst
[f_idx
].pst
;
3105 if (save_pst
!= NULL
3106 && save_pst
->textlow
!= 0
3107 && !(objfile
->flags
& OBJF_REORDERED
))
3109 ALL_OBJFILE_PSYMTABS (objfile
, pst
)
3112 && save_pst
->textlow
>= pst
->textlow
3113 && save_pst
->textlow
< pst
->texthigh
3114 && save_pst
->texthigh
> pst
->texthigh
)
3116 objfile
->flags
|= OBJF_REORDERED
;
3123 /* Now scan the FDRs for dependencies */
3124 for (f_idx
= 0; f_idx
< hdr
->ifdMax
; f_idx
++)
3126 fh
= f_idx
+ debug_info
->fdr
;
3127 pst
= fdr_to_pst
[f_idx
].pst
;
3129 if (pst
== (struct partial_symtab
*)NULL
)
3132 /* This should catch stabs-in-ecoff. */
3136 /* Skip the first file indirect entry as it is a self dependency
3137 for source files or a reverse .h -> .c dependency for header files. */
3138 pst
->number_of_dependencies
= 0;
3140 ((struct partial_symtab
**)
3141 obstack_alloc (&objfile
->psymbol_obstack
,
3143 * sizeof (struct partial_symtab
*))));
3144 for (s_idx
= 1; s_idx
< fh
->crfd
; s_idx
++)
3148 (*swap_rfd_in
) (cur_bfd
,
3149 ((char *) debug_info
->external_rfd
3150 + (fh
->rfdBase
+ s_idx
) * external_rfd_size
),
3152 if (rh
< 0 || rh
>= hdr
->ifdMax
)
3154 complain (&bad_file_number_complaint
, rh
);
3158 /* Skip self dependencies of header files. */
3162 /* Do not add to dependeny list if psymtab was empty. */
3163 if (fdr_to_pst
[rh
].pst
== (struct partial_symtab
*)NULL
)
3165 pst
->dependencies
[pst
->number_of_dependencies
++] = fdr_to_pst
[rh
].pst
;
3169 /* Remove the dummy psymtab created for -O3 images above, if it is
3170 still empty, to enable the detection of stripped executables. */
3171 if (objfile
->psymtabs
->next
== NULL
3172 && objfile
->psymtabs
->number_of_dependencies
== 0
3173 && objfile
->psymtabs
->n_global_syms
== 0
3174 && objfile
->psymtabs
->n_static_syms
== 0)
3175 objfile
->psymtabs
= NULL
;
3176 do_cleanups (old_chain
);
3179 /* If the current psymbol has an enumerated type, we need to add
3180 all the the enum constants to the partial symbol table. */
3183 handle_psymbol_enumerators (objfile
, fh
, stype
, svalue
)
3184 struct objfile
*objfile
;
3189 const bfd_size_type external_sym_size
= debug_swap
->external_sym_size
;
3190 void (* const swap_sym_in
) PARAMS ((bfd
*, PTR
, SYMR
*))
3191 = debug_swap
->swap_sym_in
;
3192 char *ext_sym
= ((char *) debug_info
->external_sym
3193 + ((fh
->isymBase
+ cur_sdx
+ 1) * external_sym_size
));
3203 /* It is an enumerated type if the next symbol entry is a stMember
3204 and its auxiliary index is indexNil or its auxiliary entry
3205 is a plain btNil or btVoid.
3206 Alpha cc -migrate enums are recognized by a zero index and
3207 a zero symbol value.
3208 DU 4.0 cc enums are recognized by a member type of btEnum without
3209 qualifiers and a zero symbol value. */
3210 (*swap_sym_in
) (cur_bfd
, ext_sym
, &sh
);
3211 if (sh
.st
!= stMember
)
3214 if (sh
.index
== indexNil
3215 || (sh
.index
== 0 && svalue
== 0))
3217 (*debug_swap
->swap_tir_in
) (fh
->fBigendian
,
3218 &(debug_info
->external_aux
3219 + fh
->iauxBase
+ sh
.index
)->a_ti
,
3221 if ((tir
.bt
!= btNil
3223 && (tir
.bt
!= btEnum
|| svalue
!= 0))
3224 || tir
.tq0
!= tqNil
)
3236 (*swap_sym_in
) (cur_bfd
, ext_sym
, &sh
);
3237 if (sh
.st
!= stMember
)
3239 name
= debug_info
->ss
+ cur_fdr
->issBase
+ sh
.iss
;
3241 /* Note that the value doesn't matter for enum constants
3242 in psymtabs, just in symtabs. */
3243 add_psymbol_to_list (name
, strlen (name
),
3244 VAR_NAMESPACE
, LOC_CONST
,
3245 &objfile
->static_psymbols
, 0,
3246 (CORE_ADDR
) 0, psymtab_language
, objfile
);
3247 ext_sym
+= external_sym_size
;
3252 mdebug_next_symbol_text (objfile
)
3253 struct objfile
*objfile
; /* argument objfile is currently unused */
3258 (*debug_swap
->swap_sym_in
) (cur_bfd
,
3259 ((char *) debug_info
->external_sym
3260 + ((cur_fdr
->isymBase
+ cur_sdx
)
3261 * debug_swap
->external_sym_size
)),
3263 return debug_info
->ss
+ cur_fdr
->issBase
+ sh
.iss
;
3266 /* Ancillary function to psymtab_to_symtab(). Does all the work
3267 for turning the partial symtab PST into a symtab, recurring
3268 first on all dependent psymtabs. The argument FILENAME is
3269 only passed so we can see in debug stack traces what file
3272 This function has a split personality, based on whether the
3273 symbol table contains ordinary ecoff symbols, or stabs-in-ecoff.
3274 The flow of control and even the memory allocation differs. FIXME. */
3277 psymtab_to_symtab_1 (pst
, filename
)
3278 struct partial_symtab
*pst
;
3281 bfd_size_type external_sym_size
;
3282 bfd_size_type external_pdr_size
;
3283 void (*swap_sym_in
) PARAMS ((bfd
*, PTR
, SYMR
*));
3284 void (*swap_pdr_in
) PARAMS ((bfd
*, PTR
, PDR
*));
3288 struct linetable
*lines
;
3289 CORE_ADDR lowest_pdr_addr
= 0;
3295 /* Read in all partial symbtabs on which this one is dependent.
3296 NOTE that we do have circular dependencies, sigh. We solved
3297 that by setting pst->readin before this point. */
3299 for (i
= 0; i
< pst
->number_of_dependencies
; i
++)
3300 if (!pst
->dependencies
[i
]->readin
)
3302 /* Inform about additional files to be read in. */
3305 fputs_filtered (" ", gdb_stdout
);
3307 fputs_filtered ("and ", gdb_stdout
);
3309 printf_filtered ("%s...",
3310 pst
->dependencies
[i
]->filename
);
3311 wrap_here (""); /* Flush output */
3312 gdb_flush (gdb_stdout
);
3314 /* We only pass the filename for debug purposes */
3315 psymtab_to_symtab_1 (pst
->dependencies
[i
],
3316 pst
->dependencies
[i
]->filename
);
3319 /* Do nothing if this is a dummy psymtab. */
3321 if (pst
->n_global_syms
== 0 && pst
->n_static_syms
== 0
3322 && pst
->textlow
== 0 && pst
->texthigh
== 0)
3325 /* Now read the symbols for this symtab */
3327 cur_bfd
= CUR_BFD (pst
);
3328 debug_swap
= DEBUG_SWAP (pst
);
3329 debug_info
= DEBUG_INFO (pst
);
3330 pending_list
= PENDING_LIST (pst
);
3331 external_sym_size
= debug_swap
->external_sym_size
;
3332 external_pdr_size
= debug_swap
->external_pdr_size
;
3333 swap_sym_in
= debug_swap
->swap_sym_in
;
3334 swap_pdr_in
= debug_swap
->swap_pdr_in
;
3335 current_objfile
= pst
->objfile
;
3336 cur_fd
= FDR_IDX (pst
);
3337 fh
= ((cur_fd
== -1)
3339 : debug_info
->fdr
+ cur_fd
);
3342 /* See comment in parse_partial_symbols about the @stabs sentinel. */
3343 processing_gcc_compilation
= 0;
3344 if (fh
!= (FDR
*) NULL
&& fh
->csym
>= 2)
3348 (*swap_sym_in
) (cur_bfd
,
3349 ((char *) debug_info
->external_sym
3350 + (fh
->isymBase
+ 1) * external_sym_size
),
3352 if (STREQ (debug_info
->ss
+ fh
->issBase
+ sh
.iss
,
3355 /* We indicate that this is a GCC compilation so that certain
3356 features will be enabled in stabsread/dbxread. */
3357 processing_gcc_compilation
= 2;
3361 if (processing_gcc_compilation
!= 0)
3364 /* This symbol table contains stabs-in-ecoff entries. */
3366 /* Parse local symbols first */
3368 if (fh
->csym
<= 2) /* FIXME, this blows psymtab->symtab ptr */
3370 current_objfile
= NULL
;
3373 for (cur_sdx
= 2; cur_sdx
< fh
->csym
; cur_sdx
++)
3379 (*swap_sym_in
) (cur_bfd
,
3380 (((char *) debug_info
->external_sym
)
3381 + (fh
->isymBase
+ cur_sdx
) * external_sym_size
),
3383 name
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
3385 /* XXX This is a hack. It will go away! */
3386 if (ECOFF_IS_STAB (&sh
) || (name
[0] == '#'))
3388 int type_code
= ECOFF_UNMARK_STAB (sh
.index
);
3390 /* We should never get non N_STAB symbols here, but they
3391 should be harmless, so keep process_one_symbol from
3392 complaining about them. */
3393 if (type_code
& N_STAB
)
3395 process_one_symbol (type_code
, 0, valu
, name
,
3396 pst
->section_offsets
, pst
->objfile
);
3398 /* Similarly a hack. */
3399 else if (name
[0] == '#')
3401 process_one_symbol (N_SLINE
, 0, valu
, name
,
3402 pst
->section_offsets
, pst
->objfile
);
3404 if (type_code
== N_FUN
)
3406 /* Make up special symbol to contain
3407 procedure specific info */
3408 struct mips_extra_func_info
*e
=
3409 ((struct mips_extra_func_info
*)
3410 obstack_alloc (¤t_objfile
->symbol_obstack
,
3411 sizeof (struct mips_extra_func_info
)));
3412 struct symbol
*s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
3414 memset ((PTR
) e
, 0, sizeof (struct mips_extra_func_info
));
3415 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
3416 SYMBOL_CLASS (s
) = LOC_CONST
;
3417 SYMBOL_TYPE (s
) = mdebug_type_void
;
3418 SYMBOL_VALUE (s
) = (long) e
;
3419 e
->pdr
.framereg
= -1;
3420 add_symbol_to_list (s
, &local_symbols
);
3423 else if (sh
.st
== stLabel
)
3425 if (sh
.index
== indexNil
)
3427 /* This is what the gcc2_compiled and __gnu_compiled_*
3428 show up as. So don't complain. */
3433 /* Handle encoded stab line number. */
3434 valu
+= ANOFFSET (pst
->section_offsets
, SECT_OFF_TEXT
);
3435 record_line (current_subfile
, sh
.index
, valu
);
3438 else if (sh
.st
== stProc
|| sh
.st
== stStaticProc
3439 || sh
.st
== stStatic
|| sh
.st
== stEnd
)
3440 /* These are generated by gcc-2.x, do not complain */
3443 complain (&stab_unknown_complaint
, name
);
3445 st
= end_symtab (pst
->texthigh
, pst
->objfile
, SECT_OFF_TEXT
);
3448 /* Sort the symbol table now, we are done adding symbols to it.
3449 We must do this before parse_procedure calls lookup_symbol. */
3450 sort_symtab_syms (st
);
3452 /* There used to be a call to sort_blocks here, but this should not
3453 be necessary for stabs symtabs. And as sort_blocks modifies the
3454 start address of the GLOBAL_BLOCK to the FIRST_LOCAL_BLOCK,
3455 it did the wrong thing if the first procedure in a file was
3456 generated via asm statements. */
3458 /* Fill in procedure info next. */
3462 struct cleanup
*old_chain
;
3468 pr_block
= (PDR
*) xmalloc (fh
->cpd
* sizeof (PDR
));
3469 old_chain
= make_cleanup (free
, pr_block
);
3471 pdr_ptr
= ((char *) debug_info
->external_pdr
3472 + fh
->ipdFirst
* external_pdr_size
);
3473 pdr_end
= pdr_ptr
+ fh
->cpd
* external_pdr_size
;
3477 pdr_ptr
+= external_pdr_size
, pdr_in
++)
3479 (*swap_pdr_in
) (cur_bfd
, pdr_ptr
, pdr_in
);
3481 /* Determine lowest PDR address, the PDRs are not always
3483 if (pdr_in
== pr_block
)
3484 lowest_pdr_addr
= pdr_in
->adr
;
3485 else if (pdr_in
->adr
< lowest_pdr_addr
)
3486 lowest_pdr_addr
= pdr_in
->adr
;
3490 pdr_in_end
= pdr_in
+ fh
->cpd
;
3491 for (; pdr_in
< pdr_in_end
; pdr_in
++)
3492 parse_procedure (pdr_in
, st
, pst
);
3494 do_cleanups (old_chain
);
3499 /* This symbol table contains ordinary ecoff entries. */
3505 /* How many symbols will we need */
3506 /* FIXME, this does not count enum values. */
3507 f_max
= pst
->n_global_syms
+ pst
->n_static_syms
;
3511 st
= new_symtab ("unknown", f_max
, 0, pst
->objfile
);
3515 f_max
+= fh
->csym
+ fh
->cpd
;
3516 maxlines
= 2 * fh
->cline
;
3517 st
= new_symtab (pst
->filename
, 2 * f_max
, maxlines
, pst
->objfile
);
3519 /* The proper language was already determined when building
3520 the psymtab, use it. */
3521 st
->language
= PST_PRIVATE (pst
)->pst_language
;
3524 psymtab_language
= st
->language
;
3526 lines
= LINETABLE (st
);
3528 /* Get a new lexical context */
3530 push_parse_stack ();
3531 top_stack
->cur_st
= st
;
3532 top_stack
->cur_block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (st
),
3534 BLOCK_START (top_stack
->cur_block
) = pst
->textlow
;
3535 BLOCK_END (top_stack
->cur_block
) = 0;
3536 top_stack
->blocktype
= stFile
;
3537 top_stack
->maxsyms
= 2 * f_max
;
3538 top_stack
->cur_type
= 0;
3539 top_stack
->procadr
= 0;
3540 top_stack
->numargs
= 0;
3541 found_ecoff_debugging_info
= 0;
3548 /* Parse local symbols first */
3549 sym_ptr
= ((char *) debug_info
->external_sym
3550 + fh
->isymBase
* external_sym_size
);
3551 sym_end
= sym_ptr
+ fh
->csym
* external_sym_size
;
3552 while (sym_ptr
< sym_end
)
3557 (*swap_sym_in
) (cur_bfd
, sym_ptr
, &sh
);
3558 c
= parse_symbol (&sh
,
3559 debug_info
->external_aux
+ fh
->iauxBase
,
3560 sym_ptr
, fh
->fBigendian
, pst
->section_offsets
);
3561 sym_ptr
+= c
* external_sym_size
;
3564 /* Linenumbers. At the end, check if we can save memory.
3565 parse_lines has to look ahead an arbitrary number of PDR
3566 structures, so we swap them all first. */
3570 struct cleanup
*old_chain
;
3576 pr_block
= (PDR
*) xmalloc (fh
->cpd
* sizeof (PDR
));
3578 old_chain
= make_cleanup (free
, pr_block
);
3580 pdr_ptr
= ((char *) debug_info
->external_pdr
3581 + fh
->ipdFirst
* external_pdr_size
);
3582 pdr_end
= pdr_ptr
+ fh
->cpd
* external_pdr_size
;
3586 pdr_ptr
+= external_pdr_size
, pdr_in
++)
3588 (*swap_pdr_in
) (cur_bfd
, pdr_ptr
, pdr_in
);
3590 /* Determine lowest PDR address, the PDRs are not always
3592 if (pdr_in
== pr_block
)
3593 lowest_pdr_addr
= pdr_in
->adr
;
3594 else if (pdr_in
->adr
< lowest_pdr_addr
)
3595 lowest_pdr_addr
= pdr_in
->adr
;
3598 parse_lines (fh
, pr_block
, lines
, maxlines
, pst
, lowest_pdr_addr
);
3599 if (lines
->nitems
< fh
->cline
)
3600 lines
= shrink_linetable (lines
);
3602 /* Fill in procedure info next. */
3604 pdr_in_end
= pdr_in
+ fh
->cpd
;
3605 for (; pdr_in
< pdr_in_end
; pdr_in
++)
3606 parse_procedure (pdr_in
, 0, pst
);
3608 do_cleanups (old_chain
);
3612 LINETABLE (st
) = lines
;
3614 /* .. and our share of externals.
3615 XXX use the global list to speed up things here. how?
3616 FIXME, Maybe quit once we have found the right number of ext's? */
3617 top_stack
->cur_st
= st
;
3618 top_stack
->cur_block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack
->cur_st
),
3620 top_stack
->blocktype
= stFile
;
3622 = (debug_info
->symbolic_header
.isymMax
3623 + debug_info
->symbolic_header
.ipdMax
3624 + debug_info
->symbolic_header
.iextMax
);
3626 ext_ptr
= PST_PRIVATE (pst
)->extern_tab
;
3627 for (i
= PST_PRIVATE (pst
)->extern_count
; --i
>= 0; ext_ptr
++)
3628 parse_external (ext_ptr
, fh
->fBigendian
, pst
->section_offsets
);
3630 /* If there are undefined symbols, tell the user.
3631 The alpha has an undefined symbol for every symbol that is
3632 from a shared library, so tell the user only if verbose is on. */
3633 if (info_verbose
&& n_undef_symbols
)
3635 printf_filtered ("File %s contains %d unresolved references:",
3636 st
->filename
, n_undef_symbols
);
3637 printf_filtered ("\n\t%4d variables\n\t%4d procedures\n\t%4d labels\n",
3638 n_undef_vars
, n_undef_procs
, n_undef_labels
);
3639 n_undef_symbols
= n_undef_labels
= n_undef_vars
= n_undef_procs
= 0;
3646 /* Sort the symbol table now, we are done adding symbols to it.*/
3647 sort_symtab_syms (st
);
3652 /* Now link the psymtab and the symtab. */
3655 current_objfile
= NULL
;
3658 /* Ancillary parsing procedures. */
3660 /* Return 1 if the symbol pointed to by SH has a cross reference
3661 to an opaque aggregate type, else 0. */
3664 has_opaque_xref (fh
, sh
)
3673 if (sh
->index
== indexNil
)
3676 ax
= debug_info
->external_aux
+ fh
->iauxBase
+ sh
->index
;
3677 (*debug_swap
->swap_tir_in
) (fh
->fBigendian
, &ax
->a_ti
, &tir
);
3678 if (tir
.bt
!= btStruct
&& tir
.bt
!= btUnion
&& tir
.bt
!= btEnum
)
3682 (*debug_swap
->swap_rndx_in
) (fh
->fBigendian
, &ax
->a_rndx
, rn
);
3683 if (rn
->rfd
== 0xfff)
3684 rf
= AUX_GET_ISYM (fh
->fBigendian
, ax
+ 1);
3692 /* Lookup the type at relative index RN. Return it in TPP
3693 if found and in any event come up with its name PNAME.
3694 BIGEND says whether aux symbols are big-endian or not (from fh->fBigendian).
3695 Return value says how many aux symbols we ate. */
3698 cross_ref (fd
, ax
, tpp
, type_code
, pname
, bigend
, sym_name
)
3702 enum type_code type_code
; /* Use to alloc new type if none is found. */
3714 struct mdebug_pending
*pend
;
3716 *tpp
= (struct type
*)NULL
;
3718 (*debug_swap
->swap_rndx_in
) (bigend
, &ax
->a_rndx
, rn
);
3720 /* Escape index means 'the next one' */
3721 if (rn
->rfd
== 0xfff)
3724 rf
= AUX_GET_ISYM (bigend
, ax
+ 1);
3731 /* mips cc uses a rf of -1 for opaque struct definitions.
3732 Set TYPE_FLAG_STUB for these types so that check_typedef will
3733 resolve them if the struct gets defined in another compilation unit. */
3736 *pname
= "<undefined>";
3737 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
3738 TYPE_FLAGS (*tpp
) |= TYPE_FLAG_STUB
;
3742 /* mips cc uses an escaped rn->index of 0 for struct return types
3743 of procedures that were compiled without -g. These will always remain
3745 if (rn
->rfd
== 0xfff && rn
->index
== 0)
3747 *pname
= "<undefined>";
3751 /* Find the relative file descriptor and the symbol in it. */
3752 fh
= get_rfd (fd
, rf
);
3753 xref_fd
= fh
- debug_info
->fdr
;
3755 if (rn
->index
>= fh
->csym
)
3757 /* File indirect entry is corrupt. */
3758 *pname
= "<illegal>";
3759 complain (&bad_rfd_entry_complaint
,
3760 sym_name
, xref_fd
, rn
->index
);
3764 /* If we have processed this symbol then we left a forwarding
3765 pointer to the type in the pending list. If not, we`ll put
3766 it in a list of pending types, to be processed later when
3767 the file will be. In any event, we collect the name for the
3770 esh
= ((char *) debug_info
->external_sym
3771 + ((fh
->isymBase
+ rn
->index
)
3772 * debug_swap
->external_sym_size
));
3773 (*debug_swap
->swap_sym_in
) (cur_bfd
, esh
, &sh
);
3775 /* Make sure that this type of cross reference can be handled. */
3776 if ((sh
.sc
!= scInfo
3777 || (sh
.st
!= stBlock
&& sh
.st
!= stTypedef
&& sh
.st
!= stIndirect
3778 && sh
.st
!= stStruct
&& sh
.st
!= stUnion
3779 && sh
.st
!= stEnum
))
3780 && (sh
.st
!= stBlock
|| !SC_IS_COMMON(sh
.sc
)))
3782 /* File indirect entry is corrupt. */
3783 *pname
= "<illegal>";
3784 complain (&bad_rfd_entry_complaint
,
3785 sym_name
, xref_fd
, rn
->index
);
3789 *pname
= debug_info
->ss
+ fh
->issBase
+ sh
.iss
;
3791 pend
= is_pending_symbol (fh
, esh
);
3796 /* We have not yet seen this type. */
3798 if ((sh
.iss
== 0 && sh
.st
== stTypedef
) || sh
.st
== stIndirect
)
3802 /* alpha cc puts out a stTypedef with a sh.iss of zero for
3804 a) forward declarations of structs/unions/enums which are not
3805 defined in this compilation unit.
3806 For these the type will be void. This is a bad design decision
3807 as cross referencing across compilation units is impossible
3808 due to the missing name.
3809 b) forward declarations of structs/unions/enums/typedefs which
3810 are defined later in this file or in another file in the same
3811 compilation unit. Irix5 cc uses a stIndirect symbol for this.
3812 Simply cross reference those again to get the true type.
3813 The forward references are not entered in the pending list and
3814 in the symbol table. */
3816 (*debug_swap
->swap_tir_in
) (bigend
,
3817 &(debug_info
->external_aux
3818 + fh
->iauxBase
+ sh
.index
)->a_ti
,
3820 if (tir
.tq0
!= tqNil
)
3821 complain (&illegal_forward_tq0_complaint
, sym_name
);
3825 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
,
3827 *pname
= "<undefined>";
3834 (debug_info
->external_aux
3835 + fh
->iauxBase
+ sh
.index
+ 1),
3836 tpp
, type_code
, pname
,
3837 fh
->fBigendian
, sym_name
);
3841 /* Follow a forward typedef. This might recursively
3842 call cross_ref till we get a non typedef'ed type.
3843 FIXME: This is not correct behaviour, but gdb currently
3844 cannot handle typedefs without type copying. Type
3845 copying is impossible as we might have mutual forward
3846 references between two files and the copied type would not
3847 get filled in when we later parse its definition. */
3848 *tpp
= parse_type (xref_fd
,
3849 debug_info
->external_aux
+ fh
->iauxBase
,
3853 debug_info
->ss
+ fh
->issBase
+ sh
.iss
);
3854 add_pending (fh
, esh
, *tpp
);
3858 complain (&illegal_forward_bt_complaint
, tir
.bt
, sym_name
);
3859 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
,
3865 else if (sh
.st
== stTypedef
)
3867 /* Parse the type for a normal typedef. This might recursively call
3868 cross_ref till we get a non typedef'ed type.
3869 FIXME: This is not correct behaviour, but gdb currently
3870 cannot handle typedefs without type copying. But type copying is
3871 impossible as we might have mutual forward references between
3872 two files and the copied type would not get filled in when
3873 we later parse its definition. */
3874 *tpp
= parse_type (xref_fd
,
3875 debug_info
->external_aux
+ fh
->iauxBase
,
3879 debug_info
->ss
+ fh
->issBase
+ sh
.iss
);
3883 /* Cross reference to a struct/union/enum which is defined
3884 in another file in the same compilation unit but that file
3885 has not been parsed yet.
3886 Initialize the type only, it will be filled in when
3887 it's definition is parsed. */
3888 *tpp
= init_type (type_code
, 0, 0, (char *) NULL
, current_objfile
);
3890 add_pending (fh
, esh
, *tpp
);
3893 /* We used one auxent normally, two if we got a "next one" rf. */
3898 /* Quick&dirty lookup procedure, to avoid the MI ones that require
3899 keeping the symtab sorted */
3901 static struct symbol
*
3902 mylookup_symbol (name
, block
, namespace, class)
3904 register struct block
*block
;
3905 namespace_enum
namespace;
3906 enum address_class
class;
3908 register int bot
, top
, inc
;
3909 register struct symbol
*sym
;
3912 top
= BLOCK_NSYMS (block
);
3916 sym
= BLOCK_SYM (block
, bot
);
3917 if (SYMBOL_NAME (sym
)[0] == inc
3918 && SYMBOL_NAMESPACE (sym
) == namespace
3919 && SYMBOL_CLASS (sym
) == class
3920 && strcmp (SYMBOL_NAME (sym
), name
) == 0)
3924 block
= BLOCK_SUPERBLOCK (block
);
3926 return mylookup_symbol (name
, block
, namespace, class);
3931 /* Add a new symbol S to a block B.
3932 Infrequently, we will need to reallocate the block to make it bigger.
3933 We only detect this case when adding to top_stack->cur_block, since
3934 that's the only time we know how big the block is. FIXME. */
3941 int nsyms
= BLOCK_NSYMS (b
)++;
3942 struct block
*origb
;
3943 struct parse_stack
*stackp
;
3945 if (b
== top_stack
->cur_block
&&
3946 nsyms
>= top_stack
->maxsyms
)
3948 complain (&block_overflow_complaint
, SYMBOL_NAME (s
));
3949 /* In this case shrink_block is actually grow_block, since
3950 BLOCK_NSYMS(b) is larger than its current size. */
3952 b
= shrink_block (top_stack
->cur_block
, top_stack
->cur_st
);
3954 /* Now run through the stack replacing pointers to the
3955 original block. shrink_block has already done this
3956 for the blockvector and BLOCK_FUNCTION. */
3957 for (stackp
= top_stack
; stackp
; stackp
= stackp
->next
)
3959 if (stackp
->cur_block
== origb
)
3961 stackp
->cur_block
= b
;
3962 stackp
->maxsyms
= BLOCK_NSYMS (b
);
3966 BLOCK_SYM (b
, nsyms
) = s
;
3969 /* Add a new block B to a symtab S */
3976 struct blockvector
*bv
= BLOCKVECTOR (s
);
3978 bv
= (struct blockvector
*) xrealloc ((PTR
) bv
,
3979 (sizeof (struct blockvector
)
3980 + BLOCKVECTOR_NBLOCKS (bv
)
3981 * sizeof (bv
->block
)));
3982 if (bv
!= BLOCKVECTOR (s
))
3983 BLOCKVECTOR (s
) = bv
;
3985 BLOCKVECTOR_BLOCK (bv
, BLOCKVECTOR_NBLOCKS (bv
)++) = b
;
3988 /* Add a new linenumber entry (LINENO,ADR) to a linevector LT.
3989 MIPS' linenumber encoding might need more than one byte
3990 to describe it, LAST is used to detect these continuation lines.
3992 Combining lines with the same line number seems like a bad idea.
3993 E.g: There could be a line number entry with the same line number after the
3994 prologue and GDB should not ignore it (this is a better way to find
3995 a prologue than mips_skip_prologue).
3996 But due to the compressed line table format there are line number entries
3997 for the same line which are needed to bridge the gap to the next
3998 line number entry. These entries have a bogus address info with them
3999 and we are unable to tell them from intended duplicate line number
4001 This is another reason why -ggdb debugging format is preferable. */
4004 add_line (lt
, lineno
, adr
, last
)
4005 struct linetable
*lt
;
4010 /* DEC c89 sometimes produces zero linenos which confuse gdb.
4011 Change them to something sensible. */
4015 last
= -2; /* make sure we record first line */
4017 if (last
== lineno
) /* skip continuation lines */
4020 lt
->item
[lt
->nitems
].line
= lineno
;
4021 lt
->item
[lt
->nitems
++].pc
= adr
<< 2;
4025 /* Sorting and reordering procedures */
4027 /* Blocks with a smaller low bound should come first */
4030 compare_blocks (arg1
, arg2
)
4034 register int addr_diff
;
4035 struct block
**b1
= (struct block
**) arg1
;
4036 struct block
**b2
= (struct block
**) arg2
;
4038 addr_diff
= (BLOCK_START ((*b1
))) - (BLOCK_START ((*b2
)));
4040 return (BLOCK_END ((*b2
))) - (BLOCK_END ((*b1
)));
4044 /* Sort the blocks of a symtab S.
4045 Reorder the blocks in the blockvector by code-address,
4046 as required by some MI search routines */
4052 struct blockvector
*bv
= BLOCKVECTOR (s
);
4054 if (BLOCKVECTOR_NBLOCKS (bv
) <= 2)
4057 if (BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) == 0)
4058 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) = 0;
4059 if (BLOCK_END (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) == 0)
4060 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) = 0;
4064 * This is very unfortunate: normally all functions are compiled in
4065 * the order they are found, but if the file is compiled -O3 things
4066 * are very different. It would be nice to find a reliable test
4067 * to detect -O3 images in advance.
4069 if (BLOCKVECTOR_NBLOCKS (bv
) > 3)
4070 qsort (&BLOCKVECTOR_BLOCK (bv
, FIRST_LOCAL_BLOCK
),
4071 BLOCKVECTOR_NBLOCKS (bv
) - FIRST_LOCAL_BLOCK
,
4072 sizeof (struct block
*),
4076 register CORE_ADDR high
= 0;
4077 register int i
, j
= BLOCKVECTOR_NBLOCKS (bv
);
4079 for (i
= FIRST_LOCAL_BLOCK
; i
< j
; i
++)
4080 if (high
< BLOCK_END (BLOCKVECTOR_BLOCK (bv
, i
)))
4081 high
= BLOCK_END (BLOCKVECTOR_BLOCK (bv
, i
));
4082 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) = high
;
4085 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
)) =
4086 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, FIRST_LOCAL_BLOCK
));
4088 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) =
4089 BLOCK_START (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
));
4090 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, STATIC_BLOCK
)) =
4091 BLOCK_END (BLOCKVECTOR_BLOCK (bv
, GLOBAL_BLOCK
));
4095 /* Constructor/restructor/destructor procedures */
4097 /* Allocate a new symtab for NAME. Needs an estimate of how many symbols
4098 MAXSYMS and linenumbers MAXLINES we'll put in it */
4100 static struct symtab
*
4101 new_symtab (name
, maxsyms
, maxlines
, objfile
)
4105 struct objfile
*objfile
;
4107 struct symtab
*s
= allocate_symtab (name
, objfile
);
4109 LINETABLE (s
) = new_linetable (maxlines
);
4111 /* All symtabs must have at least two blocks */
4112 BLOCKVECTOR (s
) = new_bvect (2);
4113 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), GLOBAL_BLOCK
) = new_block (maxsyms
);
4114 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), STATIC_BLOCK
) = new_block (maxsyms
);
4115 BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), STATIC_BLOCK
)) =
4116 BLOCKVECTOR_BLOCK (BLOCKVECTOR (s
), GLOBAL_BLOCK
);
4118 s
->free_code
= free_linetable
;
4119 s
->debugformat
= obsavestring ("ECOFF", 5,
4120 &objfile
-> symbol_obstack
);
4124 /* Allocate a new partial_symtab NAME */
4126 static struct partial_symtab
*
4127 new_psymtab (name
, objfile
, section_offsets
)
4129 struct objfile
*objfile
;
4130 struct section_offsets
*section_offsets
;
4132 struct partial_symtab
*psymtab
;
4134 psymtab
= allocate_psymtab (name
, objfile
);
4135 psymtab
->section_offsets
= section_offsets
;
4137 /* Keep a backpointer to the file's symbols */
4139 psymtab
->read_symtab_private
= ((char *)
4140 obstack_alloc (&objfile
->psymbol_obstack
,
4141 sizeof (struct symloc
)));
4142 memset ((PTR
) psymtab
->read_symtab_private
, 0, sizeof (struct symloc
));
4143 CUR_BFD (psymtab
) = cur_bfd
;
4144 DEBUG_SWAP (psymtab
) = debug_swap
;
4145 DEBUG_INFO (psymtab
) = debug_info
;
4146 PENDING_LIST (psymtab
) = pending_list
;
4148 /* The way to turn this into a symtab is to call... */
4149 psymtab
->read_symtab
= mdebug_psymtab_to_symtab
;
4154 /* Allocate a linetable array of the given SIZE. Since the struct
4155 already includes one item, we subtract one when calculating the
4156 proper size to allocate. */
4158 static struct linetable
*
4159 new_linetable (size
)
4162 struct linetable
*l
;
4164 size
= (size
- 1) * sizeof (l
->item
) + sizeof (struct linetable
);
4165 l
= (struct linetable
*) xmalloc (size
);
4170 /* Oops, too big. Shrink it. This was important with the 2.4 linetables,
4171 I am not so sure about the 3.4 ones.
4173 Since the struct linetable already includes one item, we subtract one when
4174 calculating the proper size to allocate. */
4176 static struct linetable
*
4177 shrink_linetable (lt
)
4178 struct linetable
*lt
;
4181 return (struct linetable
*) xrealloc ((PTR
) lt
,
4182 (sizeof (struct linetable
)
4184 * sizeof (lt
->item
))));
4187 /* Allocate and zero a new blockvector of NBLOCKS blocks. */
4189 static struct blockvector
*
4193 struct blockvector
*bv
;
4196 size
= sizeof (struct blockvector
) + nblocks
* sizeof (struct block
*);
4197 bv
= (struct blockvector
*) xzalloc (size
);
4199 BLOCKVECTOR_NBLOCKS (bv
) = nblocks
;
4204 /* Allocate and zero a new block of MAXSYMS symbols */
4206 static struct block
*
4210 int size
= sizeof (struct block
) + (maxsyms
- 1) * sizeof (struct symbol
*);
4212 return (struct block
*) xzalloc (size
);
4215 /* Ooops, too big. Shrink block B in symtab S to its minimal size.
4216 Shrink_block can also be used by add_symbol to grow a block. */
4218 static struct block
*
4224 struct blockvector
*bv
= BLOCKVECTOR (s
);
4227 /* Just reallocate it and fix references to the old one */
4229 new = (struct block
*) xrealloc ((PTR
) b
,
4230 (sizeof (struct block
)
4231 + ((BLOCK_NSYMS (b
) - 1)
4232 * sizeof (struct symbol
*))));
4234 /* Should chase pointers to old one. Fortunately, that`s just
4235 the block`s function and inferior blocks */
4236 if (BLOCK_FUNCTION (new) && SYMBOL_BLOCK_VALUE (BLOCK_FUNCTION (new)) == b
)
4237 SYMBOL_BLOCK_VALUE (BLOCK_FUNCTION (new)) = new;
4238 for (i
= 0; i
< BLOCKVECTOR_NBLOCKS (bv
); i
++)
4239 if (BLOCKVECTOR_BLOCK (bv
, i
) == b
)
4240 BLOCKVECTOR_BLOCK (bv
, i
) = new;
4241 else if (BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv
, i
)) == b
)
4242 BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv
, i
)) = new;
4246 /* Create a new symbol with printname NAME */
4248 static struct symbol
*
4252 struct symbol
*s
= ((struct symbol
*)
4253 obstack_alloc (¤t_objfile
->symbol_obstack
,
4254 sizeof (struct symbol
)));
4256 memset ((PTR
) s
, 0, sizeof (*s
));
4257 SYMBOL_NAME (s
) = obsavestring (name
, strlen (name
),
4258 ¤t_objfile
->symbol_obstack
);
4259 SYMBOL_LANGUAGE (s
) = psymtab_language
;
4260 SYMBOL_INIT_DEMANGLED_NAME (s
, ¤t_objfile
->symbol_obstack
);
4264 /* Create a new type with printname NAME */
4266 static struct type
*
4272 t
= alloc_type (current_objfile
);
4273 TYPE_NAME (t
) = name
;
4274 TYPE_CPLUS_SPECIFIC (t
) = (struct cplus_struct_type
*) &cplus_struct_default
;
4278 /* Read ECOFF debugging information from a BFD section. This is
4279 called from elfread.c. It parses the section into a
4280 ecoff_debug_info struct, and then lets the rest of the file handle
4284 elfmdebug_build_psymtabs (objfile
, swap
, sec
, section_offsets
)
4285 struct objfile
*objfile
;
4286 const struct ecoff_debug_swap
*swap
;
4288 struct section_offsets
*section_offsets
;
4290 bfd
*abfd
= objfile
->obfd
;
4291 struct ecoff_debug_info
*info
;
4293 info
= ((struct ecoff_debug_info
*)
4294 obstack_alloc (&objfile
->psymbol_obstack
,
4295 sizeof (struct ecoff_debug_info
)));
4297 if (!(*swap
->read_debug_info
) (abfd
, sec
, info
))
4298 error ("Error reading ECOFF debugging information: %s",
4299 bfd_errmsg (bfd_get_error ()));
4301 mdebug_build_psymtabs (objfile
, swap
, info
, section_offsets
);
4305 /* Things used for calling functions in the inferior.
4306 These functions are exported to our companion
4307 mips-tdep.c file and are here because they play
4308 with the symbol-table explicitly. */
4310 /* Sigtramp: make sure we have all the necessary information
4311 about the signal trampoline code. Since the official code
4312 from MIPS does not do so, we make up that information ourselves.
4313 If they fix the library (unlikely) this code will neutralize itself. */
4315 /* FIXME: This function is called only by mips-tdep.c. It needs to be
4316 here because it calls functions defined in this file, but perhaps
4317 this could be handled in a better way. Only compile it in when
4318 tm-mips.h is included. */
4327 struct block
*b
, *b0
= NULL
;
4329 sigtramp_address
= -1;
4331 /* We have to handle the following cases here:
4332 a) The Mips library has a sigtramp label within sigvec.
4333 b) Irix has a _sigtramp which we want to use, but it also has sigvec. */
4334 s
= lookup_symbol ("sigvec", 0, VAR_NAMESPACE
, 0, NULL
);
4337 b0
= SYMBOL_BLOCK_VALUE (s
);
4338 s
= lookup_symbol ("sigtramp", b0
, VAR_NAMESPACE
, 0, NULL
);
4342 /* No sigvec or no sigtramp inside sigvec, try _sigtramp. */
4343 s
= lookup_symbol ("_sigtramp", 0, VAR_NAMESPACE
, 0, NULL
);
4346 /* But maybe this program uses its own version of sigvec */
4350 /* Did we or MIPSco fix the library ? */
4351 if (SYMBOL_CLASS (s
) == LOC_BLOCK
)
4353 sigtramp_address
= BLOCK_START (SYMBOL_BLOCK_VALUE (s
));
4354 sigtramp_end
= BLOCK_END (SYMBOL_BLOCK_VALUE (s
));
4358 sigtramp_address
= SYMBOL_VALUE (s
);
4359 sigtramp_end
= sigtramp_address
+ 0x88; /* black magic */
4361 /* But what symtab does it live in ? */
4362 st
= find_pc_symtab (SYMBOL_VALUE (s
));
4365 * Ok, there goes the fix: turn it into a procedure, with all the
4366 * needed info. Note we make it a nested procedure of sigvec,
4367 * which is the way the (assembly) code is actually written.
4369 SYMBOL_NAMESPACE (s
) = VAR_NAMESPACE
;
4370 SYMBOL_CLASS (s
) = LOC_BLOCK
;
4371 SYMBOL_TYPE (s
) = init_type (TYPE_CODE_FUNC
, 4, 0, (char *) NULL
,
4373 TYPE_TARGET_TYPE (SYMBOL_TYPE (s
)) = mdebug_type_void
;
4375 /* Need a block to allocate MIPS_EFI_SYMBOL_NAME in */
4377 SYMBOL_BLOCK_VALUE (s
) = b
;
4378 BLOCK_START (b
) = sigtramp_address
;
4379 BLOCK_END (b
) = sigtramp_end
;
4380 BLOCK_FUNCTION (b
) = s
;
4381 BLOCK_SUPERBLOCK (b
) = BLOCK_SUPERBLOCK (b0
);
4385 /* Make a MIPS_EFI_SYMBOL_NAME entry for it */
4387 struct mips_extra_func_info
*e
=
4388 ((struct mips_extra_func_info
*)
4389 xzalloc (sizeof (struct mips_extra_func_info
)));
4391 e
->numargs
= 0; /* the kernel thinks otherwise */
4392 e
->pdr
.frameoffset
= 32;
4393 e
->pdr
.framereg
= SP_REGNUM
;
4394 /* Note that setting pcreg is no longer strictly necessary as
4395 mips_frame_saved_pc is now aware of signal handler frames. */
4396 e
->pdr
.pcreg
= PC_REGNUM
;
4397 e
->pdr
.regmask
= -2;
4398 /* Offset to saved r31, in the sigtramp case the saved registers
4399 are above the frame in the sigcontext.
4400 We have 4 alignment bytes, 12 bytes for onstack, mask and pc,
4401 32 * 4 bytes for the general registers, 12 bytes for mdhi, mdlo, ownedfp
4402 and 32 * 4 bytes for the floating point registers. */
4403 e
->pdr
.regoffset
= 4 + 12 + 31 * 4;
4404 e
->pdr
.fregmask
= -1;
4405 /* Offset to saved f30 (first saved *double* register). */
4406 e
->pdr
.fregoffset
= 4 + 12 + 32 * 4 + 12 + 30 * 4;
4407 e
->pdr
.isym
= (long) s
;
4408 e
->pdr
.adr
= sigtramp_address
;
4410 current_objfile
= st
->objfile
; /* Keep new_symbol happy */
4411 s
= new_symbol (MIPS_EFI_SYMBOL_NAME
);
4412 SYMBOL_VALUE (s
) = (long) e
;
4413 SYMBOL_NAMESPACE (s
) = LABEL_NAMESPACE
;
4414 SYMBOL_CLASS (s
) = LOC_CONST
;
4415 SYMBOL_TYPE (s
) = mdebug_type_void
;
4416 current_objfile
= NULL
;
4419 BLOCK_SYM (b
, BLOCK_NSYMS (b
)++) = s
;
4422 #endif /* TM_MIPS_H */
4425 _initialize_mdebugread ()
4428 init_type (TYPE_CODE_VOID
, 1,
4430 "void", (struct objfile
*) NULL
);
4432 init_type (TYPE_CODE_INT
, 1,
4434 "char", (struct objfile
*) NULL
);
4435 mdebug_type_unsigned_char
=
4436 init_type (TYPE_CODE_INT
, 1,
4438 "unsigned char", (struct objfile
*) NULL
);
4440 init_type (TYPE_CODE_INT
, 2,
4442 "short", (struct objfile
*) NULL
);
4443 mdebug_type_unsigned_short
=
4444 init_type (TYPE_CODE_INT
, 2,
4446 "unsigned short", (struct objfile
*) NULL
);
4447 mdebug_type_int_32
=
4448 init_type (TYPE_CODE_INT
, 4,
4450 "int", (struct objfile
*) NULL
);
4451 mdebug_type_unsigned_int_32
=
4452 init_type (TYPE_CODE_INT
, 4,
4454 "unsigned int", (struct objfile
*) NULL
);
4455 mdebug_type_int_64
=
4456 init_type (TYPE_CODE_INT
, 8,
4458 "int", (struct objfile
*) NULL
);
4459 mdebug_type_unsigned_int_64
=
4460 init_type (TYPE_CODE_INT
, 8,
4462 "unsigned int", (struct objfile
*) NULL
);
4463 mdebug_type_long_32
=
4464 init_type (TYPE_CODE_INT
, 4,
4466 "long", (struct objfile
*) NULL
);
4467 mdebug_type_unsigned_long_32
=
4468 init_type (TYPE_CODE_INT
, 4,
4470 "unsigned long", (struct objfile
*) NULL
);
4471 mdebug_type_long_64
=
4472 init_type (TYPE_CODE_INT
, 8,
4474 "long", (struct objfile
*) NULL
);
4475 mdebug_type_unsigned_long_64
=
4476 init_type (TYPE_CODE_INT
, 8,
4478 "unsigned long", (struct objfile
*) NULL
);
4479 mdebug_type_long_long_64
=
4480 init_type (TYPE_CODE_INT
, 8,
4482 "long long", (struct objfile
*) NULL
);
4483 mdebug_type_unsigned_long_long_64
=
4484 init_type (TYPE_CODE_INT
, 8,
4486 "unsigned long long", (struct objfile
*) NULL
);
4487 mdebug_type_adr_32
=
4488 init_type (TYPE_CODE_PTR
, 4,
4490 "adr_32", (struct objfile
*) NULL
);
4491 TYPE_TARGET_TYPE (mdebug_type_adr_32
) = mdebug_type_void
;
4492 mdebug_type_adr_64
=
4493 init_type (TYPE_CODE_PTR
, 8,
4495 "adr_64", (struct objfile
*) NULL
);
4496 TYPE_TARGET_TYPE (mdebug_type_adr_64
) = mdebug_type_void
;
4498 init_type (TYPE_CODE_FLT
, TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
4500 "float", (struct objfile
*) NULL
);
4501 mdebug_type_double
=
4502 init_type (TYPE_CODE_FLT
, TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
4504 "double", (struct objfile
*) NULL
);
4505 mdebug_type_complex
=
4506 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_FLOAT_BIT
/ TARGET_CHAR_BIT
,
4508 "complex", (struct objfile
*) NULL
);
4509 TYPE_TARGET_TYPE (mdebug_type_complex
) = mdebug_type_float
;
4510 mdebug_type_double_complex
=
4511 init_type (TYPE_CODE_COMPLEX
, 2 * TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
4513 "double complex", (struct objfile
*) NULL
);
4514 TYPE_TARGET_TYPE (mdebug_type_double_complex
) = mdebug_type_double
;
4516 /* Is a "string" the way btString means it the same as TYPE_CODE_STRING?
4518 mdebug_type_string
=
4519 init_type (TYPE_CODE_STRING
,
4520 TARGET_CHAR_BIT
/ TARGET_CHAR_BIT
,
4522 (struct objfile
*) NULL
);
4524 /* We use TYPE_CODE_INT to print these as integers. Does this do any
4525 good? Would we be better off with TYPE_CODE_ERROR? Should
4526 TYPE_CODE_ERROR print things in hex if it knows the size? */
4527 mdebug_type_fixed_dec
=
4528 init_type (TYPE_CODE_INT
,
4529 TARGET_INT_BIT
/ TARGET_CHAR_BIT
,
4531 (struct objfile
*) NULL
);
4533 mdebug_type_float_dec
=
4534 init_type (TYPE_CODE_ERROR
,
4535 TARGET_DOUBLE_BIT
/ TARGET_CHAR_BIT
,
4536 0, "floating decimal",
4537 (struct objfile
*) NULL
);
4539 nodebug_func_symbol_type
= init_type (TYPE_CODE_FUNC
, 1, 0,
4540 "<function, no debug info>", NULL
);
4541 TYPE_TARGET_TYPE (nodebug_func_symbol_type
) = mdebug_type_int
;
4542 nodebug_var_symbol_type
=
4543 init_type (TYPE_CODE_INT
, TARGET_INT_BIT
/ HOST_CHAR_BIT
, 0,
4544 "<variable, no debug info>", NULL
);