From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25360 invoked by alias); 2 Mar 2010 14:13:33 -0000 Received: (qmail 25292 invoked by uid 22791); 2 Mar 2010 14:13:32 -0000 X-Spam-Check-By: sourceware.org Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.83/v0.83-20-g38e4449) with ESMTP; Tue, 02 Mar 2010 14:13:27 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id A5C726D42F5; Tue, 2 Mar 2010 15:13:24 +0100 (CET) Date: Tue, 02 Mar 2010 14:13:00 -0000 From: Corinna Vinschen To: gdb-patches@sourceware.org Subject: Re: [RFA] defs.h: Define GDB_DEFAULT_TARGET_[WIDE_]CHARSET for Cygwin and MingW builds Message-ID: <20100302141324.GA27721@calimero.vinschen.de> Reply-To: gdb-patches@sourceware.org Mail-Followup-To: gdb-patches@sourceware.org References: <20100228222702.GC29360@caradoc.them.org> <20100301103125.GB9730@calimero.vinschen.de> <20100301173054.GD5683@calimero.vinschen.de> <20100301193126.GA9416@caradoc.them.org> <83eik34vr8.fsf@gnu.org> <20100301215033.GB17815@caradoc.them.org> <20100302104358.GA26083@calimero.vinschen.de> <20100302135405.GA16596@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100302135405.GA16596@caradoc.them.org> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-03/txt/msg00047.txt.bz2 On Mar 2 08:54, Daniel Jacobowitz wrote: > On Tue, Mar 02, 2010 at 11:43:58AM +0100, Corinna Vinschen wrote: > > The target specifies charset and wide charset. So we need two > > target-specific variables. As I mentioned above, both variables would > > replace the auto_target...charset variables. > > That makes sense. > > > How do I access the current gdbarch from show_target_charset_name, > > show_target_wide_charset_name, and all the other functions in charset.c > > which refer to the target charsets? > > >From the show functions, which are called by the CLI infrastructure, I > think you're supposed to use get_current_arch (in arch-utils.h). > > >From other functions, mostly, you need the caller to pass an > architecture. An increasing portion of GDB is parameterized > this way. That'll work for e.g. target_wide_charset (). > > I don't think you can do either from _initialize_charset. That may > have to happen lazily... It looks to me as if a call to get_current_arch() in target_charset() is the way to go. Otherwise, I don't see how this can be set up. The problem here are the various places which call the target_charset() function. The one call in c-lang.c, function charset_for_string_type() looks simple, but the calls in util.c and python/py-utils.c look pretty tricky. Or can I just refer to get_current_arch() in these places? Corinna -- Corinna Vinschen Cygwin Project Co-Leader Red Hat