[RFA] symtab.c: Fix for infinite GDB recursion in gdb.c++/classes.exp
Peter.Schauer
Peter.Schauer@regent.e-technik.tu-muenchen.de
Fri Oct 27 03:46:00 GMT 2000
Current CVS GDB gets into an infinite recursion in gdb.c++/classes.exp
(print Foo::st) if a stock gcc-2.95.2 with DWARF2 debugging info is used
on Solaris and Linux x86.
The scenario is as follows:
lookup_symbol is called with a request for Foo::st, we find a matching
minimal symbol, detect that it is a mangled variable and call lookup_symbol
with the mangled name. Then lookup_symbol demangles the mangled name again,
calls lookup_symbol with Foo::st and off we go till the stack overflows.
Here is a fix:
* symtab.c (lookup_symbol_aux): Call lookup_symbol_aux, not
lookup_symbol, when trying to find a symbol with a mangled name,
to avoid infinite recursion.
*** gdb/symtab.c.orig Wed Oct 25 16:13:13 2000
--- gdb/symtab.c Thu Oct 26 20:03:48 2000
***************
*** 780,787 ****
{
/* This is a mangled variable, look it up by its
mangled name. */
! return lookup_symbol (SYMBOL_NAME (msymbol), block,
! namespace, is_a_field_of_this, symtab);
}
/* There are no debug symbols for this file, or we are looking
for an unmangled variable.
--- 780,787 ----
{
/* This is a mangled variable, look it up by its
mangled name. */
! return lookup_symbol_aux (SYMBOL_NAME (msymbol), block,
! namespace, is_a_field_of_this, symtab);
}
/* There are no debug symbols for this file, or we are looking
for an unmangled variable.
***************
*** 958,965 ****
&& MSYMBOL_TYPE (msymbol) != mst_file_text
&& !STREQ (name, SYMBOL_NAME (msymbol)))
{
! return lookup_symbol (SYMBOL_NAME (msymbol), block,
! namespace, is_a_field_of_this, symtab);
}
}
}
--- 958,965 ----
&& MSYMBOL_TYPE (msymbol) != mst_file_text
&& !STREQ (name, SYMBOL_NAME (msymbol)))
{
! return lookup_symbol_aux (SYMBOL_NAME (msymbol), block,
! namespace, is_a_field_of_this, symtab);
}
}
}
--
Peter Schauer pes@regent.e-technik.tu-muenchen.de
More information about the Gdb-patches
mailing list