/* Read a symbol table in ECOFF format (Third-Eye).
- Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
+ Copyright 1986, 87, 89, 90, 91, 92, 93, 94, 95, 96, 1997
Free Software Foundation, Inc.
Original version contributed by Alessandro Forin (af@cs.cmu.edu) at
CMU. Major work by Per Bothner, John Gilmore and Ian Lance Taylor
/* Note how much "debuggable" this image is. We would like
to see at least one FDR with full symbols */
-static max_gdbinfo;
-static max_glevel;
+static int max_gdbinfo;
+static int max_glevel;
/* When examining .o files, report on undefined symbols */
without qualifiers, assume the tag is an
enumeration.
Alpha cc -migrate enums are recognized by a zero
- index and a zero symbol value. */
+ index and a zero symbol value.
+ DU 4.0 cc enums are recognized by a member type of
+ btEnum without qualifiers and a zero symbol value. */
if (tsym.index == indexNil
|| (tsym.index == 0 && sh->value == 0))
type_code = TYPE_CODE_ENUM;
(*debug_swap->swap_tir_in) (bigend,
&ax[tsym.index].a_ti,
&tir);
- if ((tir.bt == btNil || tir.bt == btVoid)
+ if ((tir.bt == btNil || tir.bt == btVoid
+ || (tir.bt == btEnum && sh->value == 0))
&& tir.tq0 == tqNil)
type_code = TYPE_CODE_ENUM;
}
if (tsym.st != stMember)
break;
- f->bitpos = tsym.value;
- f->type = t;
- f->name = debug_info->ss + cur_fdr->issBase + tsym.iss;
- f->bitsize = 0;
+ FIELD_BITPOS (*f) = tsym.value;
+ FIELD_TYPE (*f) = t;
+ FIELD_NAME (*f) = debug_info->ss + cur_fdr->issBase + tsym.iss;
+ FIELD_BITSIZE (*f) = 0;
enum_sym = ((struct symbol *)
obstack_alloc (¤t_objfile->symbol_obstack,
case stMember: /* member of struct or union */
f = &TYPE_FIELDS (top_stack->cur_type)[top_stack->cur_field++];
- f->name = name;
- f->bitpos = sh->value;
+ FIELD_NAME (*f) = name;
+ FIELD_BITPOS (*f) = sh->value;
bitsize = 0;
- f->type = parse_type (cur_fd, ax, sh->index, &bitsize, bigend, name);
- f->bitsize = bitsize;
+ FIELD_TYPE (*f) = parse_type (cur_fd, ax, sh->index, &bitsize, bigend, name);
+ FIELD_BITSIZE (*f) = bitsize;
break;
case stIndirect: /* forward declaration on Irix5 */
to look for the function which contains the MIPS_EFI_SYMBOL_NAME symbol
in question, or NULL to use top_stack->cur_block. */
-static void parse_procedure PARAMS ((PDR *, struct symtab *, CORE_ADDR,
+static void parse_procedure PARAMS ((PDR *, struct symtab *,
struct partial_symtab *));
static void
-parse_procedure (pr, search_symtab, lowest_pdr_addr, pst)
+parse_procedure (pr, search_symtab, pst)
PDR *pr;
struct symtab *search_symtab;
- CORE_ADDR lowest_pdr_addr;
struct partial_symtab *pst;
{
struct symbol *s, *i;
e = (struct mips_extra_func_info *) SYMBOL_VALUE (i);
e->pdr = *pr;
e->pdr.isym = (long) s;
- e->pdr.adr += pst->textlow - lowest_pdr_addr;
+
+ /* GDB expects the absolute function start address for the
+ procedure descriptor in e->pdr.adr.
+ As the address in the procedure descriptor is usually relative,
+ we would have to relocate e->pdr.adr with cur_fdr->adr and
+ ANOFFSET (pst->section_offsets, SECT_OFF_TEXT).
+ Unfortunately cur_fdr->adr and e->pdr.adr are both absolute
+ in shared libraries on some systems, and on other systems
+ e->pdr.adr is sometimes offset by a bogus value.
+ To work around these problems, we replace e->pdr.adr with
+ the start address of the function. */
+ e->pdr.adr = BLOCK_START (b);
/* Correct incorrect setjmp procedure descriptor from the library
to make backtrace through setjmp work. */
cur_fdr = fh = debug_info->fdr + f_idx;
+ /* If a partial symbol table has already been read for this file,
+ don't make another one. This works around a problem with some
+ compilers that emit both DWARF and mdebug sections for a single
+ module. */
+ if (lookup_partial_symtab (fdr_name (fh)))
+ continue;
+
if (fh->csym == 0)
{
fdr_to_pst[f_idx].pst = NULL;
mst_file_text,
NULL,
SECT_OFF_TEXT,
+ NULL,
objfile);
}
procaddr = sh.value;
mst_file_data,
NULL,
SECT_OFF_DATA,
+ NULL,
objfile);
break;
mst_file_bss,
NULL,
SECT_OFF_BSS,
+ NULL,
objfile);
break;
}
case stStaticProc:
prim_record_minimal_symbol_and_info (name, sh.value,
mst_file_text, NULL,
- SECT_OFF_TEXT, objfile);
+ SECT_OFF_TEXT, NULL,
+ objfile);
/* FALLTHROUGH */
add_psymbol_to_list (name, strlen (name),
VAR_NAMESPACE, LOC_BLOCK,
&objfile->global_psymbols,
- sh.value, 0, psymtab_language, objfile);
+ 0, sh.value, psymtab_language, objfile);
else
add_psymbol_to_list (name, strlen (name),
VAR_NAMESPACE, LOC_BLOCK,
&objfile->static_psymbols,
- sh.value, 0, psymtab_language, objfile);
+ 0, sh.value, psymtab_language, objfile);
/* Skip over procedure to next one. */
if (sh.index >= hdr->iauxMax)
prim_record_minimal_symbol_and_info (name, sh.value,
mst_file_data, NULL,
SECT_OFF_DATA,
+ NULL,
objfile);
else
prim_record_minimal_symbol_and_info (name, sh.value,
mst_file_bss, NULL,
SECT_OFF_BSS,
+ NULL,
objfile);
class = LOC_STATIC;
break;
add_psymbol_to_list (name, strlen (name),
STRUCT_NAMESPACE, LOC_TYPEDEF,
&objfile->static_psymbols,
- sh.value, 0,
+ 0, (CORE_ADDR) 0,
psymtab_language, objfile);
}
handle_psymbol_enumerators (objfile, fh, sh.st, sh.value);
/* Use this gdb symbol */
add_psymbol_to_list (name, strlen (name),
VAR_NAMESPACE, class,
- &objfile->static_psymbols, sh.value,
- 0, psymtab_language, objfile);
+ &objfile->static_psymbols,
+ 0, sh.value, psymtab_language, objfile);
skip:
cur_sdx++; /* Go to next file symbol */
}
and its auxiliary index is indexNil or its auxiliary entry
is a plain btNil or btVoid.
Alpha cc -migrate enums are recognized by a zero index and
- a zero symbol value. */
+ a zero symbol value.
+ DU 4.0 cc enums are recognized by a member type of btEnum without
+ qualifiers and a zero symbol value. */
(*swap_sym_in) (cur_bfd, ext_sym, &sh);
if (sh.st != stMember)
return;
&(debug_info->external_aux
+ fh->iauxBase + sh.index)->a_ti,
&tir);
- if ((tir.bt != btNil && tir.bt != btVoid) || tir.tq0 != tqNil)
+ if ((tir.bt != btNil
+ && tir.bt != btVoid
+ && (tir.bt != btEnum || svalue != 0))
+ || tir.tq0 != tqNil)
return;
break;
add_psymbol_to_list (name, strlen (name),
VAR_NAMESPACE, LOC_CONST,
&objfile->static_psymbols, 0,
- 0, psymtab_language, objfile);
+ (CORE_ADDR) 0, psymtab_language, objfile);
ext_sym += external_sym_size;
}
}
pdr_in = pr_block;
pdr_in_end = pdr_in + fh->cpd;
for (; pdr_in < pdr_in_end; pdr_in++)
- parse_procedure (pdr_in, st, lowest_pdr_addr, pst);
+ parse_procedure (pdr_in, st, pst);
do_cleanups (old_chain);
}
pdr_in = pr_block;
pdr_in_end = pdr_in + fh->cpd;
for (; pdr_in < pdr_in_end; pdr_in++)
- parse_procedure (pdr_in, 0, lowest_pdr_addr, pst);
+ parse_procedure (pdr_in, 0, pst);
do_cleanups (old_chain);
}
BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
s->free_code = free_linetable;
-
+ s->debugformat = obsavestring ("ECOFF", 5,
+ &objfile -> symbol_obstack);
return (s);
}