From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19139 invoked by alias); 19 Mar 2002 22:47:29 -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 19019 invoked from network); 19 Mar 2002 22:47:26 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 19 Mar 2002 22:47:26 -0000 Received: from localhost.redhat.com (cse.cygnus.com [205.180.230.236]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id OAA00486 for ; Tue, 19 Mar 2002 14:47:23 -0800 (PST) Received: by localhost.redhat.com (Postfix, from userid 469) id 7A19F112E4; Tue, 19 Mar 2002 17:46:59 -0500 (EST) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15511.49122.884934.467080@localhost.redhat.com> Date: Tue, 19 Mar 2002 14:47:00 -0000 To: Daniel Jacobowitz Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] Select a particular mangling of a demangled symbol in lookup_block_symbol In-Reply-To: <15511.47485.557533.258275@localhost.redhat.com> References: <20020214185503.A28610@nevyn.them.org> <15511.47485.557533.258275@localhost.redhat.com> X-Mailer: VM 7.00 under Emacs 20.7.1 X-SW-Source: 2002-03/txt/msg00368.txt.bz2 Elena Zannoni writes: > Daniel Jacobowitz writes: > > I just described the problem this patch addresses in my testsuite patch; > > perhaps not the best place :) Here's the relevant bit: > > > > - Multiple symbols with the same demangled name. We can work around this > > for stabs, because we have the physname. We don't have that option for > > DWARF-2, and we shouldn't need to for stabs. I have a patch for the > > workaround. We get the [not-in-charge] constructor by default, > > unfortunately. > > > > > > What this means is that we call lookup_block_symbol on something like: > > _ZN3fooC1ERS_ > > but get the information for: > > _ZN3fooC2ERS_ > > > > The breakpoint ends up on the base-not-in-charge constructor. > > > > What we really SHOULD do is set it on both constructors silently, without > > even acknowledging that they are different functions, or else offer the user > > the choice. My preference is actually for the former. That requires > > support for a single function existing in multiple places, which will also > > give us nice things like better support for inlined functions with DWARF-2 > > (which will always be somewhat shoddy due to the nature of inlining, in that > > it only occurs with lots of other optimization - but we can do much better > > than we do). > > > > Is this patch OK, or is it deemed too gross? > > > > -- > > Daniel Jacobowitz Carnegie Mellon University > > MontaVista Software Debian GNU/Linux Developer > > > > 2002-02-14 Daniel Jacobowitz > > > > * symtab.h (lookup_block_symbol): Add mangled_name argument > > to prototype. > > > > * symmisc.c (maintenance_check_symtabs): Call lookup_block_symbol > > with new mangled_name argument. > > * linespec.c (decode_line_1): Likewise. > > * valops (value_of_this): Likewise. > > * symtab.c (lookup_transparent_type): Likewise. > > (lookup_symbol_aux): Likewise. Accept new mangled_name argument. > > (lookup_symbol): If we are given a mangled name, pass it down > > to lookup_symbol_aux. > > (lookup_block_symbol): If we are given a mangled name to check > > against, only return symbols which match it. > > > > @@ -567,6 +568,7 @@ lookup_symbol (const char *name, const s > > { > > char *modified_name = NULL; > > char *modified_name2 = NULL; > > + const char *mangled_name = NULL; > > int needtofreename = 0; > > struct symbol *returnval; > > > > @@ -592,13 +594,14 @@ lookup_symbol (const char *name, const s > > 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, block, namespace, > > - is_a_field_of_this, symtab); > > + returnval = lookup_symbol_aux (modified_name, mangled_name, block, > > + namespace, is_a_field_of_this, symtab); > > if (needtofreename) > > xfree (modified_name2); > > > > > OK, approved. But I have my usual couple of questions: > > Was the corresponding testsuite patch sorted out? Looks like it > wasn't. Does this patch have any effect on the testsuite results w/o > the testsuite patch? > > In the above, should it be mangled_name = name or mangled_name = > modified_name? It would seem more uniform with the rest of the > function if we just used modified_name. Unless there is some problem > with case sensitivity, in which case, calling cplus_demangle with > modified_name seems wrong anyway. I.e. is it guaranteed that > case_sensitive_off is NOT in effect? Just out of curiosity What > would happen if the user sets the case sensitivity off? > Wouldn't it change _ZN3fooC1ERS_ to _zn3fooc1ers_ ? (of course the user > can always do a lot of things to screw himself up) > > I guess what I am really asking is when is lookup_symbol called with a > mangled name. I tried to do "break foo::foo", and I never saw it called > with a mangled name. > > Elena > > 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? Elena