From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6342 invoked by alias); 22 Apr 2008 01:35:58 -0000 Received: (qmail 6325 invoked by uid 22791); 22 Apr 2008 01:35:57 -0000 X-Spam-Check-By: sourceware.org Received: from rn-out-0910.google.com (HELO rn-out-0910.google.com) (64.233.170.187) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 22 Apr 2008 01:35:39 +0000 Received: by rn-out-0910.google.com with SMTP id i24so688999rng.0 for ; Mon, 21 Apr 2008 18:35:37 -0700 (PDT) Received: by 10.142.171.6 with SMTP id t6mr1996221wfe.117.1208828136936; Mon, 21 Apr 2008 18:35:36 -0700 (PDT) Received: by 10.142.111.16 with HTTP; Mon, 21 Apr 2008 18:35:36 -0700 (PDT) Message-ID: Date: Tue, 22 Apr 2008 05:16:00 -0000 From: Tea To: "Michael Snyder" Subject: Re: about current_gdbarch Cc: "Thiago Jung Bauermann" , gdb-patches@sourceware.org In-Reply-To: <1208801950.4615.97.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1208801950.4615.97.camel@localhost.localdomain> 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: 2008-04/txt/msg00460.txt.bz2 I see. Thank you Michael. :) teawater On Tue, Apr 22, 2008 at 2:19 AM, Michael Snyder wrote: > > On Mon, 2008-04-21 at 17:59 +0800, Tea wrote: > > Hi Thiago, > > > > In your mail, you want me remove the "current_gdbarch" from my patch. > > But it's so hard to me. > > Because most of "current_gdbarch" is used in function "record_message" > > and sub-function of it(such as i386_record and mips_record). > > "record_message" will be called by function "resume" that use a lot of > > "current_gdbarch" in it. So I think get current gdbarch without > > "current_gdbarch" is so hard. > > > > Could you please help me about it? Or let me keep "current_gdbarch" in > > current time. Maybe I can remove it in the future. > > gdbarch is a data structure that's meant to be passed around > as a token to the various functions that will use it. It's > a relatively new interface (though it's been in place for a > number of years now). > > "current_gdbarch" is a cheat -- a global constant -- that > we have allowed ourselves to use while we transition various > parts of gdb into using the gdbarch interface. > > I think what you are being encouraged to do is, rather than > just using the global constant whenever you need it, start > at highest possible level of calling into your code (eg. > "record_message" in infrun.c) and pass in a pointer to > current_gdbarch (assuming an actual gdbarch pointer is not > available). Then let the rest of your code pass that pointer > around, and use it instead of using the global. > > That way, eventually, we only have one reference to the > global "current_gdbarch" to get rid of, instead of many. > > Michael > > > >