* c-exp.y (yylex): Handle nested template parameter lists.

* symtab.c (decode_line_2):  Fix test for valid choice number.
This commit is contained in:
Peter Schauer 1997-03-22 10:50:18 +00:00
parent c81a76b311
commit 0742270560
3 changed files with 46 additions and 23 deletions

View file

@ -1,3 +1,8 @@
Sat Mar 22 02:48:11 1997 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* c-exp.y (yylex): Handle nested template parameter lists.
* symtab.c (decode_line_2): Fix test for valid choice number.
Fri Mar 21 19:10:05 1997 Mark Alexander <marka@cygnus.com> Fri Mar 21 19:10:05 1997 Mark Alexander <marka@cygnus.com>
* mips-tdep.c (mips_push_arguments): On non-EABI architectures, * mips-tdep.c (mips_push_arguments): On non-EABI architectures,

View file

@ -1,5 +1,5 @@
/* YACC parser for C expressions, for GDB. /* YACC parser for C expressions, for GDB.
Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1996 Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1996, 1997
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -1409,12 +1409,27 @@ yylex ()
(c == '_' || c == '$' || (c >= '0' && c <= '9') (c == '_' || c == '$' || (c >= '0' && c <= '9')
|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');) || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
{ {
/* Template parameter lists are part of the name.
FIXME: This mishandles `print $a<4&&$a>3'. */
if (c == '<') if (c == '<')
{ {
int i = namelen; int i = namelen;
while (tokstart[++i] && tokstart[i] != '>'); int nesting_level = 1;
while (tokstart[++i])
{
if (tokstart[i] == '<')
nesting_level++;
else if (tokstart[i] == '>')
{
if (--nesting_level == 0)
break;
}
}
if (tokstart[i] == '>') if (tokstart[i] == '>')
namelen = i; namelen = i;
else
break;
} }
c = tokstart[++namelen]; c = tokstart[++namelen];
} }

View file

@ -1,5 +1,5 @@
/* Symbol table lookup for the GNU debugger, GDB. /* Symbol table lookup for the GNU debugger, GDB.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 1997
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -472,6 +472,9 @@ fixup_symbol_section (sym, objfile)
{ {
struct minimal_symbol *msym; struct minimal_symbol *msym;
if (!sym)
return NULL;
if (SYMBOL_BFD_SECTION (sym)) if (SYMBOL_BFD_SECTION (sym))
return sym; return sym;
@ -1196,15 +1199,15 @@ find_pc_line (pc, notcurrent)
But what we want is the statement containing the instruction. But what we want is the statement containing the instruction.
Fudge the pc to make sure we get that. */ Fudge the pc to make sure we get that. */
if (notcurrent) pc -= 1; INIT_SAL (&val); /* initialize to zeroes */
if (notcurrent)
pc -= 1;
s = find_pc_symtab (pc); s = find_pc_symtab (pc);
if (!s) if (!s)
{ {
val.symtab = 0;
val.line = 0;
val.pc = pc; val.pc = pc;
val.end = 0;
return val; return val;
} }
@ -1275,10 +1278,7 @@ find_pc_line (pc, notcurrent)
if (!alt_symtab) if (!alt_symtab)
{ /* If we didn't find any line # info, just { /* If we didn't find any line # info, just
return zeros. */ return zeros. */
val.symtab = 0;
val.line = 0;
val.pc = pc; val.pc = pc;
val.end = 0;
} }
else else
{ {
@ -1921,6 +1921,8 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
char *saved_arg = *argptr; char *saved_arg = *argptr;
extern char *gdb_completer_quote_characters; extern char *gdb_completer_quote_characters;
INIT_SAL (&val); /* initialize to zeroes */
/* Defaults have defaults. */ /* Defaults have defaults. */
if (default_symtab == 0) if (default_symtab == 0)
@ -2340,15 +2342,14 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
msymbol = lookup_minimal_symbol (copy, NULL, NULL); msymbol = lookup_minimal_symbol (copy, NULL, NULL);
if (msymbol != NULL) if (msymbol != NULL)
{ {
val.symtab = 0;
val.line = 0;
val.pc = SYMBOL_VALUE_ADDRESS (msymbol); val.pc = SYMBOL_VALUE_ADDRESS (msymbol);
if (funfirstline) if (funfirstline)
{ {
val.pc += FUNCTION_START_OFFSET; val.pc += FUNCTION_START_OFFSET;
SKIP_PROLOGUE (val.pc); SKIP_PROLOGUE (val.pc);
} }
values.sals = (struct symtab_and_line *)xmalloc (sizeof (struct symtab_and_line)); values.sals = (struct symtab_and_line *)
xmalloc (sizeof (struct symtab_and_line));
values.sals[0] = val; values.sals[0] = val;
values.nelts = 1; values.nelts = 1;
return values; return values;
@ -2414,6 +2415,8 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
printf_unfiltered("[0] cancel\n[1] all\n"); printf_unfiltered("[0] cancel\n[1] all\n");
while (i < nelts) while (i < nelts)
{ {
INIT_SAL (&return_values.sals[i]); /* initialize to zeroes */
INIT_SAL (&values.sals[i]);
if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK) if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK)
{ {
values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline); values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline);
@ -2474,7 +2477,7 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
return return_values; return return_values;
} }
if (num > nelts + 2) if (num >= nelts + 2)
{ {
printf_unfiltered ("No choice number %d.\n", num); printf_unfiltered ("No choice number %d.\n", num);
} }