shrink_linetable PARAMS ((struct linetable *));
static void
-handle_psymbol_enumerators PARAMS ((struct objfile *, FDR *, int));
+handle_psymbol_enumerators PARAMS ((struct objfile *, FDR *, int, CORE_ADDR));
static char *
mdebug_next_symbol_text PARAMS ((void));
if (nfields == 0 && type_code == TYPE_CODE_UNDEF)
/* If the type of the member is Nil (or Void),
without qualifiers, assume the tag is an
- enumeration. */
- if (tsym.index == indexNil)
+ enumeration.
+ Alpha cc -migrate enums are recognized by a zero
+ index and a zero symbol value. */
+ if (tsym.index == indexNil
+ || (tsym.index == 0 && sh->value == 0))
type_code = TYPE_CODE_ENUM;
else
{
}
fh = get_rfd (fd, rf);
- indx = parse_type (fd, debug_info->external_aux + fh->iauxBase,
+ indx = parse_type (fh - debug_info->fdr,
+ debug_info->external_aux + fh->iauxBase,
id, (int *) NULL, bigend, sym_name);
/* The bounds type should be an integer type, but might be anything
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 *, unsigned long,
+static void parse_procedure PARAMS ((PDR *, struct symtab *, CORE_ADDR,
struct partial_symtab *));
static void
-parse_procedure (pr, search_symtab, first_off, pst)
+parse_procedure (pr, search_symtab, lowest_pdr_addr, pst)
PDR *pr;
struct symtab *search_symtab;
- unsigned long first_off;
+ 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 - first_off;
+ e->pdr.adr += pst->textlow - lowest_pdr_addr;
/* Correct incorrect setjmp procedure descriptor from the library
to make backtrace through setjmp work. */
with that and do not need to reorder our linetables */
static void parse_lines PARAMS ((FDR *, PDR *, struct linetable *, int,
- struct partial_symtab *));
+ struct partial_symtab *, CORE_ADDR));
static void
-parse_lines (fh, pr, lt, maxlines, pst)
+parse_lines (fh, pr, lt, maxlines, pst, lowest_pdr_addr)
FDR *fh;
PDR *pr;
struct linetable *lt;
int maxlines;
struct partial_symtab *pst;
+ CORE_ADDR lowest_pdr_addr;
{
unsigned char *base;
int j, k;
int delta, count, lineno = 0;
- unsigned long first_off = pr->adr;
if (fh->cbLine == 0)
return;
k = 0;
for (j = 0; j < fh->cpd; j++, pr++)
{
- long l;
- unsigned long adr;
+ CORE_ADDR l;
+ CORE_ADDR adr;
unsigned char *halt;
/* No code for this one */
halt = base + fh->cbLine;
base += pr->cbLineOffset;
- adr = pst->textlow + pr->adr - first_off;
+ adr = pst->textlow + pr->adr - lowest_pdr_addr;
l = adr >> 2; /* in words */
for (lineno = pr->lnLow; base < halt; )
sh.value,
psymtab_language, objfile);
}
- handle_psymbol_enumerators (objfile, fh, sh.st);
+ handle_psymbol_enumerators (objfile, fh, sh.st, sh.value);
/* Skip over the block */
new_sdx = sh.index;
all the the enum constants to the partial symbol table. */
static void
-handle_psymbol_enumerators (objfile, fh, stype)
+handle_psymbol_enumerators (objfile, fh, stype, svalue)
struct objfile *objfile;
FDR *fh;
int stype;
+ CORE_ADDR svalue;
{
const bfd_size_type external_sym_size = debug_swap->external_sym_size;
void (* const swap_sym_in) PARAMS ((bfd *, PTR, SYMR *))
case stBlock:
/* It is an enumerated type if the next symbol entry is a stMember
and its auxiliary index is indexNil or its auxiliary entry
- is a plain btNil or btVoid. */
+ is a plain btNil or btVoid.
+ Alpha cc -migrate enums are recognized by a zero index and
+ a zero symbol value. */
(*swap_sym_in) (cur_bfd, ext_sym, &sh);
if (sh.st != stMember)
return;
- if (sh.index == indexNil)
+ if (sh.index == indexNil
+ || (sh.index == 0 && svalue == 0))
break;
(*debug_swap->swap_tir_in) (fh->fBigendian,
&(debug_info->external_aux
struct symtab *st;
FDR *fh;
struct linetable *lines;
+ CORE_ADDR lowest_pdr_addr = 0;
if (pst->readin)
return;
if (processing_gcc_compilation != 0)
{
- char *pdr_ptr;
- char *pdr_end;
- int first_pdr;
- unsigned long first_off = 0;
/* This symbol table contains stabs-in-ecoff entries. */
generated via asm statements. */
/* Fill in procedure info next. */
- first_pdr = 1;
- pdr_ptr = ((char *) debug_info->external_pdr
- + fh->ipdFirst * external_pdr_size);
- pdr_end = pdr_ptr + fh->cpd * external_pdr_size;
- for (; pdr_ptr < pdr_end; pdr_ptr += external_pdr_size)
+ if (fh->cpd > 0)
{
- PDR pr;
-
- (*swap_pdr_in) (cur_bfd, pdr_ptr, &pr);
- if (first_pdr)
+ PDR *pr_block;
+ struct cleanup *old_chain;
+ char *pdr_ptr;
+ char *pdr_end;
+ PDR *pdr_in;
+ PDR *pdr_in_end;
+
+ pr_block = (PDR *) xmalloc (fh->cpd * sizeof (PDR));
+ old_chain = make_cleanup (free, pr_block);
+
+ pdr_ptr = ((char *) debug_info->external_pdr
+ + fh->ipdFirst * external_pdr_size);
+ pdr_end = pdr_ptr + fh->cpd * external_pdr_size;
+ pdr_in = pr_block;
+ for (;
+ pdr_ptr < pdr_end;
+ pdr_ptr += external_pdr_size, pdr_in++)
{
- first_off = pr.adr;
- first_pdr = 0;
+ (*swap_pdr_in) (cur_bfd, pdr_ptr, pdr_in);
+
+ /* Determine lowest PDR address, the PDRs are not always
+ sorted. */
+ if (pdr_in == pr_block)
+ lowest_pdr_addr = pdr_in->adr;
+ else if (pdr_in->adr < lowest_pdr_addr)
+ lowest_pdr_addr = pdr_in->adr;
}
- parse_procedure (&pr, st, first_off, pst);
+
+ 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);
+
+ do_cleanups (old_chain);
}
}
else
for (;
pdr_ptr < pdr_end;
pdr_ptr += external_pdr_size, pdr_in++)
- (*swap_pdr_in) (cur_bfd, pdr_ptr, pdr_in);
+ {
+ (*swap_pdr_in) (cur_bfd, pdr_ptr, pdr_in);
+
+ /* Determine lowest PDR address, the PDRs are not always
+ sorted. */
+ if (pdr_in == pr_block)
+ lowest_pdr_addr = pdr_in->adr;
+ else if (pdr_in->adr < lowest_pdr_addr)
+ lowest_pdr_addr = pdr_in->adr;
+ }
- parse_lines (fh, pr_block, lines, maxlines, pst);
+ parse_lines (fh, pr_block, lines, maxlines, pst, lowest_pdr_addr);
if (lines->nitems < fh->cline)
lines = shrink_linetable (lines);
pdr_in = pr_block;
pdr_in_end = pdr_in + fh->cpd;
for (; pdr_in < pdr_in_end; pdr_in++)
- parse_procedure (pdr_in, 0, pr_block->adr, pst);
+ parse_procedure (pdr_in, 0, lowest_pdr_addr, pst);
do_cleanups (old_chain);
}
/* Symbol table lookup for the GNU debugger, GDB.
- Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994
+ Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995
Free Software Foundation, Inc.
This file is part of GDB.
cplusplus_hint (name)
char *name;
{
+ while (*name == '\'')
+ name++;
printf_filtered ("Hint: try '%s<TAB> or '%s<ESC-?>\n", name, name);
printf_filtered ("(Note leading single quote.)\n");
}
/* Maybe arg is FILE : LINENUM or FILE : FUNCTION */
s = NULL;
- is_quoted = (strchr(gdb_completer_quote_characters, **argptr) != NULL);
- has_parens = (( pp = strchr(*argptr, '(')) != NULL &&
- (pp = strchr(pp, ')')) != NULL);
+ is_quoted = (**argptr
+ && strchr (gdb_completer_quote_characters, **argptr) != NULL);
+ has_parens = ((pp = strchr (*argptr, '(')) != NULL
+ && (pp = strchr (pp, ')')) != NULL);
for (p = *argptr; *p; p++)
{
{
/* Arg token is not digits => try it as a function name
Find the next token(everything up to end or next blank). */
- if (strchr(gdb_completer_quote_characters, **argptr) != NULL)
+ if (**argptr
+ && strchr (gdb_completer_quote_characters, **argptr) != NULL)
{
p = skip_quoted(*argptr);
*argptr = *argptr + 1;
copy = (char *) alloca (p - *argptr + 1 );
memcpy (copy, *argptr, p - *argptr);
copy[p - *argptr] = '\0';
- if (strchr(gdb_completer_quote_characters, copy[p-*argptr-1]) != NULL)
- copy[p - *argptr -1] = '\0';
+ if (p != *argptr
+ && copy[p - *argptr - 1]
+ && strchr (gdb_completer_quote_characters,
+ copy[p - *argptr - 1]) != NULL)
+ copy[p - *argptr - 1] = '\0';
}
/* no line number may be specified */
memcpy (copy, *argptr, p - *argptr);
copy[p - *argptr] = '\0';
if (p != *argptr
- && (copy[0] == copy [p - *argptr - 1])
+ && copy[0]
+ && copy[0] == copy [p - *argptr - 1]
&& strchr (gdb_completer_quote_characters, copy[0]) != NULL)
{
copy [p - *argptr - 1] = '\0';
/* Determine if PC is in the prologue of a function. The prologue is the area
between the first instruction of a function, and the first executable line.
Returns 1 if PC *might* be in prologue, 0 if definately *not* in prologue.
+
+ If non-zero, func_start is where we thing the prologue starts, possibly
+ by previous examination of symbol table information.
*/
int
nosyms:
+/* If func_start is zero (meaning unknown) then we don't know whether pc is
+ in the prologue or not. I.E. it might be. */
+
+ if (!func_start) return 1;
+
/* We need to call the target-specific prologue skipping functions with the
function's start address because PC may be pointing at an instruction that
could be mistakenly considered part of the prologue. */