From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30367 invoked by alias); 2 Nov 2012 16:59:01 -0000 Received: (qmail 30357 invoked by uid 22791); 2 Nov 2012 16:59:00 -0000 X-SWARE-Spam-Status: No, hits=-7.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Nov 2012 16:58:49 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qA2Gwm8G031092 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 2 Nov 2012 12:58:48 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qA2Gwl5x010175 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 2 Nov 2012 12:58:47 -0400 From: Tom Tromey To: Siva Chandra Cc: gdb-patches@sourceware.org Subject: Re: [RFC] Fix for gdb.parameter('architecture') returning empty string References: <87y5ilqdoz.fsf@fleche.redhat.com> Date: Fri, 02 Nov 2012 16:59:00 -0000 In-Reply-To: (Siva Chandra's message of "Fri, 2 Nov 2012 06:44:43 -0700") Message-ID: <87r4ocosah.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: 2012-11/txt/msg00052.txt.bz2 >>>>> "Siva" == Siva Chandra writes: Tom> I suspect this means that gdb.parameter('architecture') will not always Tom> show the same result as "show architecture". Siva> I do not understand this completely. In my patch, show_architecture Siva> only prints 'architecture_string'. Hence, Siva> gdb.parameter('architecture') and "show architecture" should always Siva> show the same result. Did I miss something? Ok, I see. Your patch removes the call to get_current_arch. I missed that somehow before, sorry about that. I think this just means that "show architecture" will now show incorrect results, though. Tom> But from what I can tell, the architecture-change observer is not Tom> notified in every situation that might cause that function to return a Tom> different result. Siva> Pardon my ignorance here, does target arch change between frames? I'm reasonably ignorant here myself. I believe the answer is "yes", albeit AFAIK just on SPU systems. Tom> I think a better approach might be to address the problem of "auto" gdb Tom> parameters more globally. For example, we could add a method to the Tom> appropriate CLI object so that the Python could call this to get the Tom> correct current value. Siva> Do you mean that the CLI object should have a method (which can Siva> evaluate the property value on the go), rather than a property like Siva> 'architecture_string' and 'endian_string'? If yes, do you envision Siva> that Python make use of the method if it exists, otherwise use the Siva> property? Yes. In this example, the method would resemble the current show_architecture, but it would just return the name of the current architecture, rather than all the surrounding text. This method is only needed for "auto-capable" parameters. One wrinkle in this plan is that the method in question would have to return a union type, since parameters have different underlying representations. BTW, what is it you are using this for? I think in many cases it is preferable for us to expose more API directly rather than rely on CLI settings. E.g., if your code needs the architecture, find a way to intelligently expose gdbarch on frames, types, etc. Tom