/* 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.
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 */
switch (sh->sc)
{
case scText:
+ case scRConst:
/* Do not relocate relative values.
The value of a stEnd symbol is the displacement from the
corresponding start symbol value.
add_symbol (s, b);
/* Type could be missing if file is compiled without debugging info. */
- if (sh->sc == scUndefined || sh->sc == scNil || sh->index == indexNil)
+ if (sh->sc == scUndefined || sh->sc == scSUndefined
+ || sh->sc == scNil || sh->index == indexNil)
SYMBOL_TYPE (s) = nodebug_var_symbol_type;
else
SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);
SYMBOL_NAMESPACE (s) = VAR_NAMESPACE;
SYMBOL_CLASS (s) = LOC_BLOCK;
/* Type of the return value */
- if (sh->sc == scUndefined || sh->sc == scNil)
+ if (sh->sc == scUndefined || sh->sc == scSUndefined || sh->sc == scNil)
t = mdebug_type_int;
else
{
add_block (b, top_stack->cur_st);
/* Not if we only have partial info */
- if (sh->sc == scUndefined || sh->sc == scNil)
+ if (sh->sc == scUndefined || sh->sc == scSUndefined || sh->sc == scNil)
break;
push_parse_stack ();
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. */
}
/* Reading .o files */
- if (es->asym.sc == scUndefined || es->asym.sc == scNil)
+ if (es->asym.sc == scUndefined || es->asym.sc == scSUndefined
+ || es->asym.sc == scNil)
{
char *what;
switch (es->asym.st)
extern_tab[fdr_to_pst[ext_in->ifd].globals_offset
+ fdr_to_pst[ext_in->ifd].n_globals++] = *ext_in;
- if (ext_in->asym.sc == scUndefined || ext_in->asym.sc == scNil)
+ if (ext_in->asym.sc == scUndefined || ext_in->asym.sc == scSUndefined
+ || ext_in->asym.sc == scNil)
continue;
name = debug_info->ssext + ext_in->asym.iss;
mst_file_text,
NULL,
SECT_OFF_TEXT,
+ NULL,
objfile);
}
procaddr = sh.value;
switch (sh.sc)
{
case scUndefined:
+ case scSUndefined:
case scNil:
case scAbs:
break;
mst_file_data,
NULL,
SECT_OFF_DATA,
+ NULL,
objfile);
break;
mst_file_bss,
NULL,
SECT_OFF_BSS,
+ NULL,
objfile);
break;
}
}
/* Non absolute static symbols go into the minimal table. */
- if (sh.sc == scUndefined || sh.sc == scNil
+ if (sh.sc == scUndefined || sh.sc == scSUndefined
+ || sh.sc == scNil
|| (sh.index == indexNil
&& (sh.st != stStatic || sh.sc == scAbs)))
{
switch (sh.sc)
{
case scText:
+ case scRConst:
/* The value of a stEnd symbol is the displacement from the
corresponding start symbol value, do not relocate it. */
if (sh.st != stEnd)
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 */
}
psh = &ext_ptr->asym;
/* Do not add undefined symbols to the partial symbol table. */
- if (psh->sc == scUndefined || psh->sc == scNil)
+ if (psh->sc == scUndefined || psh->sc == scSUndefined
+ || psh->sc == scNil)
continue;
svalue = psh->value;
switch (psh->sc)
{
case scText:
+ case scRConst:
svalue += ANOFFSET (section_offsets, SECT_OFF_TEXT);
break;
case scData:
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;
}
}
&sh);
name = debug_info->ss + fh->issBase + sh.iss;
valu = sh.value;
- if (ECOFF_IS_STAB (&sh))
+ /* XXX This is a hack. It will go away! */
+ if (ECOFF_IS_STAB (&sh) || (name[0] == '#'))
{
int type_code = ECOFF_UNMARK_STAB (sh.index);
process_one_symbol (type_code, 0, valu, name,
pst->section_offsets, pst->objfile);
}
+ /* Similarly a hack. */
+ else if (name[0] == '#')
+ {
+ process_one_symbol (N_SLINE, 0, valu, name,
+ pst->section_offsets, pst->objfile);
+ }
if (type_code == N_FUN)
{
/* Make up special symbol to contain
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);
}