From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fernando Nasser To: Jim Ingham Cc: gdb-patches@sources.redhat.com, insight@sources.redhat.com Subject: Re: [patch] fix for infinite recursion in lookup_symbol Date: Fri, 12 Jan 2001 12:13:00 -0000 Message-id: <3A5F6548.A54F0B6C@cygnus.com> References: <200101121935.LAA03678@scv2.apple.com> X-SW-Source: 2001-q1/msg00051.html Jim, You saved my life! This causes Insight to crash. One case I saw is that there were C++ methods starting with "main", so the look for main to show in the Source Window would cause a memory exhaust situation. The other case is when a the Variable Balloons try to show some overloaded symbol and it also goes into loop. TO THE INSIGHT LIST FOLKS WHO WERE HAVING THOSE PROBLEMS: Can you please try Jim's patch and let us know if it fixed your problems? Thanks. Fernando Jim Ingham wrote: > > Hi, all, > > The following patch fixes an infinite recursion in the variable lookup > code for C++ objects that are specified in mangled form. The old code > would take the mangled name into lookup_symbol, unmangle it, and then in > this bit pass the mangled name BACK to lookup_symbol, which would > unmangle it and come right back here... Not a good thing. The bug > crept in when lookup_symbol was broken up into lookup_symbol and > lookup_symbol_aux, the correction is clearly what was meant. > > 2001-01-09 James Ingham > > * symtab.c (lookup_symbol_aux): Call lookup_symbol_aux to > lookup a > mangled symbol rather than recursing into lookup_symbol, since > this > will just re-unmangle the name & call lookup_symbol_aux - > leading to > an infinite recursion. > > Index: symtab.c > =================================================================== > RCS file: /cvs/src/src/gdb/symtab.c,v > retrieving revision 1.15 > diff -c -w -r1.15 symtab.c > *** symtab.c 2000/09/04 08:29:25 1.15 > --- symtab.c 2001/01/12 19:29:21 > *************** > *** 754,760 **** > { > /* 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 > --- 754,760 ---- > { > /* 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 -- Fernando Nasser Red Hat - Toronto E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9