+Wed Mar 9 21:43:24 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
+
+ * mdebugread.c (parse_type): Do not complain for types with
+ an `indexNil' aux index, these are simply undefined types.
+ Remove indexNil check from caller of parse_type.
+ * mdebugread.c (parse_partial_symbols): Do not enter
+ stGlobal, scCommon symbols into the minimal symbol table, their
+ value is the size of the common, not its address.
+ Handle scInit, scFini, scPData and scXData sections.
+ Use minimal symbol type mst_file_* for stLabel symbols, instead of
+ mst_*.
+ Enter stProc symbols into the global_psymbols list once, not into
+ the static_psymbols_list.
+ Get rid of dummy psymtab if it is empty, to allow proper detection
+ of stripped executables.
+ * mdebugread.c (cross_ref): Allow cross references to Fortran
+ common blocks.
+
Wed Mar 9 15:23:19 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabsread.c (common_block_end, fix_common_block): Stash the
add_symbol (s, b);
/* Type could be missing in a number of cases */
- if (sh->sc == scUndefined || sh->sc == scNil ||
- sh->index == 0xfffff)
+ if (sh->sc == scUndefined || sh->sc == scNil)
SYMBOL_TYPE (s) = builtin_type_int; /* undefined? */
else
SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);
struct type *tp = 0;
enum type_code type_code = TYPE_CODE_UNDEF;
+ /* Handle undefined types, they have indexNil. */
+ if (aux_index == indexNil)
+ return builtin_type_int;
+
/* Handle corrupt aux indices. */
if (aux_index >= (debug_info->fdr + fd)->caux)
{
ms_type = mst_file_text;
break;
case stGlobal:
- if (ext_in->asym.sc == scData
+ if (ext_in->asym.sc == scCommon)
+ {
+ /* The value of a common symbol is its size, not its address.
+ Ignore it. */
+ continue;
+ }
+ else if (ext_in->asym.sc == scData
|| ext_in->asym.sc == scSData
- || ext_in->asym.sc == scRData)
+ || ext_in->asym.sc == scRData
+ || ext_in->asym.sc == scPData
+ || ext_in->asym.sc == scXData)
ms_type = mst_data;
else
ms_type = mst_bss;
case stLabel:
if (ext_in->asym.sc == scAbs)
ms_type = mst_abs;
- else if (ext_in->asym.sc == scText)
- ms_type = mst_text;
+ else if (ext_in->asym.sc == scText
+ || ext_in->asym.sc == scInit
+ || ext_in->asym.sc == scFini)
+ ms_type = mst_file_text;
else if (ext_in->asym.sc == scData
|| ext_in->asym.sc == scSData
- || ext_in->asym.sc == scRData)
- ms_type = mst_data;
+ || ext_in->asym.sc == scRData
+ || ext_in->asym.sc == scPData
+ || ext_in->asym.sc == scXData)
+ ms_type = mst_file_data;
else
- ms_type = mst_bss;
+ ms_type = mst_file_bss;
break;
case stLocal:
/* The alpha has the section start addresses in stLocal symbols
long procaddr;
int new_sdx;
- case stStaticProc: /* Function */
- /* I believe this is used only for file-local functions.
- The comment in symconst.h ("load time only static procs")
- isn't particularly clear on this point. */
+ case stStaticProc:
prim_record_minimal_symbol (name, sh.value, mst_file_text,
objfile);
+
/* FALLTHROUGH */
- case stProc: /* Asm labels apparently */
+ case stProc:
+ /* Usually there is a local and a global stProc symbol
+ for a function. This means that the function name
+ has already been entered into the mimimal symbol table
+ while processing the global symbols in pass 2 above.
+ One notable exception is the PROGRAM name from
+ f77 compiled executables, it is only put out as
+ local stProc symbol, and a global MAIN__ stProc symbol
+ points to it. It doesn't matter though, as gdb is
+ still able to find the PROGRAM name via the partial
+ symbol table, and the MAIN__ symbol via the minimal
+ symbol table. */
ADD_PSYMBOL_TO_LIST (name, strlen (name),
VAR_NAMESPACE, LOC_BLOCK,
- objfile->static_psymbols, sh.value,
- psymtab_language, objfile);
+ (sh.st == stProc)
+ ? objfile->global_psymbols
+ : objfile->static_psymbols,
+ sh.value, psymtab_language, objfile);
/* Skip over procedure to next one. */
if (sh.index >= hdr->iauxMax)
{
continue;
case stStatic: /* Variable */
- if (sh.sc == scData || sh.sc == scSData || sh.sc == scRData)
+ if (sh.sc == scData
+ || sh.sc == scSData
+ || sh.sc == scRData
+ || sh.sc == scPData
+ || sh.sc == scXData)
prim_record_minimal_symbol (name, sh.value, mst_file_data,
objfile);
else
continue;
case stProc:
case stStaticProc:
+ /* If the index of the global symbol is not indexNil,
+ it points to the local stProc symbol with the same
+ name, which has already been entered into the
+ partial symbol table above. */
+ if (psh->index != indexNil)
+ continue;
class = LOC_BLOCK;
break;
case stLabel:
pst->dependencies[pst->number_of_dependencies++] = fdr_to_pst[rh].pst;
}
}
+
+ /* Remove the dummy psymtab created for -O3 images above, if it is
+ still empty, to enable the detection of stripped executables. */
+ if (objfile->psymtabs->next == NULL
+ && objfile->psymtabs->number_of_dependencies == 0
+ && objfile->psymtabs->n_global_syms == 0
+ && objfile->psymtabs->n_static_syms == 0)
+ objfile->psymtabs = NULL;
do_cleanups (old_chain);
}
(*debug_swap->swap_sym_in) (cur_bfd, esh, &sh);
/* Make sure that this type of cross reference can be handled. */
- if (sh.sc != scInfo
- || (sh.st != stBlock && sh.st != stTypedef
- && sh.st != stStruct && sh.st != stUnion
- && sh.st != stEnum))
+ if ((sh.sc != scInfo
+ || (sh.st != stBlock && sh.st != stTypedef
+ && sh.st != stStruct && sh.st != stUnion
+ && sh.st != stEnum))
+ && (sh.sc != scCommon || sh.st != stBlock))
{
/* File indirect entry is corrupt. */
*pname = "<illegal>";