From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27609 invoked by alias); 27 Mar 2007 18:58:07 -0000 Received: (qmail 27601 invoked by uid 22791); 27 Mar 2007 18:58:07 -0000 X-Spam-Check-By: sourceware.org Received: from return.false.org (HELO return.false.org) (66.207.162.98) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 27 Mar 2007 19:58:04 +0100 Received: from return.false.org (localhost [127.0.0.1]) by return.false.org (Postfix) with ESMTP id 651134B26F; Tue, 27 Mar 2007 13:58:03 -0500 (CDT) Received: from caradoc.them.org (dsl093-172-095.pit1.dsl.speakeasy.net [66.93.172.95]) by return.false.org (Postfix) with ESMTP id 437F04B267; Tue, 27 Mar 2007 13:58:03 -0500 (CDT) Received: from drow by caradoc.them.org with local (Exim 4.63) (envelope-from ) id 1HWGrq-0000uJ-P2; Tue, 27 Mar 2007 14:58:02 -0400 Date: Tue, 27 Mar 2007 18:58:00 -0000 From: Daniel Jacobowitz To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: Breaking in a c++ method with current language set to c. Message-ID: <20070327185802.GD28164@caradoc.them.org> Mail-Followup-To: Pedro Alves , gdb-patches@sourceware.org References: <45EB906B.6070408@portugalmail.pt> <20070305124143.GA14835@caradoc.them.org> <45F46F5A.5020906@portugalmail.pt> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45F46F5A.5020906@portugalmail.pt> User-Agent: Mutt/1.5.14+cvs20070313 (2007-03-13) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00263.txt.bz2 On Sun, Mar 11, 2007 at 09:06:34PM +0000, Pedro Alves wrote: > >How much invasive? I don't like the global "current language"; like > >the global "selected frame", it's prone to this sort of problem when > >we'd really rather be looking at a different language. > As my first approach I had added a new parameter to lookup_symbol, and > changed all the calls throughout to pass the language that seemed to > make sense or current_language otherwise. I ended up touching many > files I wouldn't be able to test, like fortran, scheme, java and ada > support. It was more invasive than I could afford :) (,and probably wrong). > As an intermediate step, I came up with this version. It adds a new > lookup_symbol_in_language, and tweaks a few worker functions to accept > the language by parameter, instead of relying on the current language. > lookup_symbol is then a simple wrapper that passes the current_language > to the new lookup_symbol_in_language. I needed to tweak ada-lang.c, > because the lookup_symbol_in_language name was already taken there. The > approach implemented there was similar to my previous patch, that is, it > temporarily switched the current language [1]. As I don't have an ada > compiler (and I can't fit any on my machine), I can't be be sure I caught > all the hard coded current_language uses, so I've just make the ada > function static and added a FIXME. Maybe someone will be able to try > with the new version in symtab.c. > What do you think of this approach? I like this much better. I tested using your version for Ada, and it seemed to work - but we don't have test coverage for the problem case, apparently, since commenting out the set_language call in ada_lookup_symbol_in_language did not cause any test failures. I think you should go ahead and remove the Ada-specific version. If there's a problem we can fix it. Could you do that, and also check for overly long lines in your patch? Thanks in advance. -- Daniel Jacobowitz CodeSourcery