From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12457 invoked by alias); 19 May 2003 15:14:32 -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 12447 invoked from network); 19 May 2003 15:14:31 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 19 May 2003 15:14:31 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h4JFEVH31384 for ; Mon, 19 May 2003 11:14:31 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h4JFEVI19856 for ; Mon, 19 May 2003 11:14:31 -0400 Received: from localhost.redhat.com (IDENT:KaKCCS2fr8wIP6t5CorIAKYnKJjrY2rT@tooth.toronto.redhat.com [172.16.14.29]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h4JFEUo10326; Mon, 19 May 2003 11:14:30 -0400 Received: by localhost.redhat.com (Postfix, from userid 469) id 8B3432C43C; Mon, 19 May 2003 11:19:50 -0400 (EDT) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16072.62998.398450.521135@localhost.redhat.com> Date: Mon, 19 May 2003 15:14:00 -0000 To: David Carlton Cc: gdb-patches@sources.redhat.com, Elena Zannoni Subject: Re: [rfa] language hooks for lookup_symbol In-Reply-To: References: X-SW-Source: 2003-05/txt/msg00335.txt.bz2 David Carlton writes: > Here's a patch to add language hooks to lookup_symbol. I settled on > two hooks: one of them is a boolean saying whether or not to do the > field of this check, and the other is a function that replaces the > static/global lookup part of lookup_symbol_aux. The reason why I > broke these up into two separate parts is that the field of this part > doesn't return a symbol, so it's a little hard to do it gracefully and > without duplicating code. It also provides some functions that other > languages can use to build nonlocal hook functions if necessary. > > The only potential behavior change (I hope) is that I turned off the > field of this check for the C, asm, and minimal languages. Doubtless > it should be turned off for other languages, too, but I didn't want to > tamper with them. This patch tells all languages to use a function > basic_lookup_symbol_nonlocal that implements the standard C behavior > that lookup_symbol_aux had been doing. (I'll submit the C++ namespace > stuff in my next patch.) > > It also deletes the strange #if 0 hunk from lookup_symbol_aux; if you > want, I can commit that change as a separate patch. > > This is my first time playing around with struct language_defn, so > please let me know if I did anything wrong. I like this idea; I > really should spend time thinking about where else we should use it. > For example, should lookup_symbol call language_demangle instead of > cplus_demangle? Hmm. Yes. I like it. A couple of comments. 1. check in the if0 elimination by itself, then the deletion of static_block parameter and teh addition of the block_static_bloc function. After that check in the rest (which is really the big change). 2. I think that instead of: int la_lookup_symbol_this; We can just have the new field be a function pointer to NULL or to the value_of_this function itself. This function itself can be split in 2, one for objc and one for c++. 3. move the comments as well, instead of deleting them. demangle? probably so, it will be much cleaner if that gets moved too (eventually). Other thought, Adam added a few if language == objc checks in other parts of generic code. Those are also candidate for hooks, if you feel lucky! At the very least, they should not conflict with your changes, and should be included in the 'grand plan'. At a first look I don't think they will create any problems. > +/* Lookup a symbol in all files' global blocks (searching psymtabs if > + necessary). */ > + > +struct symbol *lookup_symbol_global (const char *name, > + const char *linkage_name, > + const domain_enum domain, > + struct symtab **symtab) watch out for grep ^func.....