From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6371 invoked by alias); 2 Oct 2002 19:10:39 -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 6363 invoked from network); 2 Oct 2002 19:10:36 -0000 Received: from unknown (HELO jackfruit.Stanford.EDU) (171.64.38.136) by sources.redhat.com with SMTP; 2 Oct 2002 19:10:36 -0000 Received: (from carlton@localhost) by jackfruit.Stanford.EDU (8.11.6/8.11.6) id g92JATw01428; Wed, 2 Oct 2002 12:10:29 -0700 X-Authentication-Warning: jackfruit.Stanford.EDU: carlton set sender to carlton@math.stanford.edu using -f To: Daniel Jacobowitz Cc: Jim Blandy , gdb-patches@sources.redhat.com Subject: Re: RFA: Search for symbol names the same way they're hashed. References: <200210020329.g923TE702388@zenia.red-bean.com> <20021002180515.GA8880@nevyn.them.org> From: David Carlton Date: Wed, 02 Oct 2002 12:10:00 -0000 In-Reply-To: <20021002180515.GA8880@nevyn.them.org> Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-10/txt/msg00068.txt.bz2 On Wed, 2 Oct 2002 14:05:15 -0400, Daniel Jacobowitz said: > (What is the right solution? Simple. While lookup_block_symbol > presumably only returns one symbol, all of GDB needs to be aware > that lookup_symbol can find more than one. We need a way to > distinguish them (for static functions in multiple files - often all > with the same filename! This happens in BFD) and a way to collapse > them (for cloned constructors, breaking on one should probably break > on all of them). Yup. For what it's worth, in my current version of the dictionary stuff for blocks, I've basically given up on having a dict_lookup function that returns "the" match: instead, I have dict_iter_name_{first,next} that allow you to iterate through all entries in a dictionary whose SYMBOL_BEST_NAME strcmp_iw's to what you're looking for. Of course, I still have lookup_block_symbol return a single value, so, for example, the relevant code in the non-function case for my version of lookup_block_symbol looks like this: if (!BLOCK_FUNCTION (block)) { for (sym = dict_iter_name_first (BLOCK_DICT (block), name, &iter); sym; sym = dict_iter_name_next (name, &iter)) { if (SYMBOL_NAMESPACE (sym) == namespace && (mangled_name ? strcmp (SYMBOL_NAME (sym), mangled_name) == 0 : 1)) return sym; } return NULL; } (the BLOCK_FUNCTION (block) case is a little more complicated), but it should be friendly to adding variants that might find multiple symbols. David Carlton carlton@math.stanford.edu