From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10912 invoked by alias); 22 Mar 2002 22:53:02 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 10894 invoked from network); 22 Mar 2002 22:52:59 -0000 Received: from unknown (HELO nevyn.them.org) (128.2.145.6) by sources.redhat.com with SMTP; 22 Mar 2002 22:52:59 -0000 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 16oXRS-0000ho-00; Fri, 22 Mar 2002 17:23:22 -0500 Date: Fri, 22 Mar 2002 14:53:00 -0000 From: Daniel Jacobowitz To: Elena Zannoni Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] Select a particular mangling of a demangled symbol in lookup_block_symbol Message-ID: <20020322172322.A1684@nevyn.them.org> Mail-Followup-To: Elena Zannoni , gdb-patches@sources.redhat.com References: <20020214185503.A28610@nevyn.them.org> <15511.47485.557533.258275@localhost.redhat.com> <15511.49122.884934.467080@localhost.redhat.com> <20020322135330.C24693@nevyn.them.org> <15515.36821.518905.440825@localhost.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15515.36821.518905.440825@localhost.redhat.com> User-Agent: Mutt/1.3.23i X-SW-Source: 2002-03/txt/msg00438.txt.bz2 On Fri, Mar 22, 2002 at 03:11:01PM -0500, Elena Zannoni wrote: > Daniel Jacobowitz writes: > > On Tue, Mar 19, 2002 at 05:46:58PM -0500, Elena Zannoni wrote: > > > Replying to myself. I was testing with dwarf2, but using stabs I can > > > see it. I can also see that we call cplus_demangle (__3foor3foo, ...) > > > instead of cplus_demangle (__3fooR3foo, ...), if 'set case off'. But > > > it returns foo::foo(long double, foo) anyway. So it works? > > > > Absolutely not: > > > > drow@nevyn:~% c++filt > > __3fooR3foo > > foo::foo(foo &) > > __3foor3foo > > foo::foo(long double, foo) > > > > Ah, I didn't think twice when I saw it not core dumping! > > > Those aren't the same function at all :) > > > > Indeed. Then I think we definitely should use the uppercase parameter. Is this what you had in mind? -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer 2002-03-22 Daniel Jacobowitz * symtab.c (lookup_symbol): Demangled before lowercasing. Index: symtab.c =================================================================== RCS file: /cvs/src/src/gdb/symtab.c,v retrieving revision 1.58 diff -u -p -r1.58 symtab.c --- symtab.c 2002/03/22 18:57:08 1.58 +++ symtab.c 2002/03/22 22:22:23 @@ -569,12 +569,27 @@ lookup_symbol (const char *name, const s const namespace_enum namespace, int *is_a_field_of_this, struct symtab **symtab) { - char *modified_name = NULL; - char *modified_name2 = NULL; + char *demangled_name = NULL; + const char *modified_name = NULL; const char *mangled_name = NULL; int needtofreename = 0; struct symbol *returnval; + modified_name = name; + + /* If we are using C++ language, demangle the name before doing a lookup, so + we can always binary search. */ + if (current_language->la_language == language_cplus) + { + demangled_name = cplus_demangle (name, DMGL_ANSI | DMGL_PARAMS); + if (demangled_name) + { + mangled_name = name; + modified_name = demangled_name; + needtofreename = 1; + } + } + if (case_sensitivity == case_sensitive_off) { char *copy; @@ -587,26 +602,11 @@ lookup_symbol (const char *name, const s copy[len] = 0; modified_name = copy; } - else - modified_name = (char *) name; - - /* If we are using C++ language, demangle the name before doing a lookup, so - we can always binary search. */ - if (current_language->la_language == language_cplus) - { - modified_name2 = cplus_demangle (modified_name, DMGL_ANSI | DMGL_PARAMS); - if (modified_name2) - { - mangled_name = name; - modified_name = modified_name2; - needtofreename = 1; - } - } returnval = lookup_symbol_aux (modified_name, mangled_name, block, namespace, is_a_field_of_this, symtab); if (needtofreename) - xfree (modified_name2); + xfree (demangled_name); return returnval; }