From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6337 invoked by alias); 2 Nov 2012 18:45:56 -0000 Received: (qmail 6327 invoked by uid 22791); 2 Nov 2012 18:45:55 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-qa0-f41.google.com (HELO mail-qa0-f41.google.com) (209.85.216.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Nov 2012 18:45:50 +0000 Received: by mail-qa0-f41.google.com with SMTP id c4so1302265qae.0 for ; Fri, 02 Nov 2012 11:45:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-system-of-record:x-gm-message-state; bh=0WqAsaSYKOKT2n0nWZuxbi3PJVgBB16ZAHJS6x8zrvM=; b=BuBO+9uZeXe9jEaID2XNGO/kyTFNGyfQorVN/R77c0YCwojSK8yINC98+yr8dCS5Hp RN4ha6jLZpl7jdjDnn1fITIXBhmGnof2qjDz7flqTp5L6qOck7CVSzj2ZpOdv1bu6lWm 7n11S91S7QjtBYvsklH+ZF5PS7kOm5PjpvaQ8i8E197sHUH64gE91GgrVAHBBLk6w153 kp/LpvOAcBZklh1Fgg1eGEwdaWWnHRHhDdQsMM0rTNlGTA1rVIpwsHWXoqjMu/aBpkwq axfM67R+N53xGliOKvfnDx1IetXw8VkS8GxU219KCx5M4laOKzyDMuF2KCSSx9KOLVfd xOkg== MIME-Version: 1.0 Received: by 10.224.191.73 with SMTP id dl9mr3655147qab.18.1351881949182; Fri, 02 Nov 2012 11:45:49 -0700 (PDT) Received: by 10.224.10.207 with HTTP; Fri, 2 Nov 2012 11:45:49 -0700 (PDT) In-Reply-To: <87r4ocosah.fsf@fleche.redhat.com> References: <87y5ilqdoz.fsf@fleche.redhat.com> <87r4ocosah.fsf@fleche.redhat.com> Date: Fri, 02 Nov 2012 18:45:00 -0000 Message-ID: Subject: Re: [RFC] Fix for gdb.parameter('architecture') returning empty string From: Siva Chandra To: Tom Tromey Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-System-Of-Record: true X-Gm-Message-State: ALoCoQk6kMsZhcN6OVvtE3joeTmm9WVZC5g1JUKSyO45a2O8GXJRWAITaDG1iF1Y9bA+ydeUhcS0MSK2SYsjIFhDdNQd7eOtSjiEY+kHAMo58J2oGZVjWqU4NILeWke9UNxWTEButAgUc9oF/Y5NYgq7eODFJHkoiFqgyY6RE67Pj+pQy+MQQsAArEmcZhGbDeYW43pRS8bO6tD8CzKMqETGUrAT4M0GXA== 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: 2012-11/txt/msg00065.txt.bz2 On Fri, Nov 2, 2012 at 9:58 AM, Tom Tromey wrote: > 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. This is for my understanding: Can you give an example where this can give incorrect results. Is it only for the case when the arch can change from frame to frame? I have tested for all cases that I could think of and it seems fine. > 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. For now, I have been using gdb.execute("show architecture", to_string=True) and getting the value from the resulting string. I am trying to tidy that up by using gdb.parameter(...). And, for my work, exposing arch from frames will work as I need the arch during an active frame only. I see two items here then: 1. Fix gdb.parameter by the way of using methods on CLI objects. 2. Expose current frame arch through the gdb.Frame class. Do they seem reasonable? Thanks, Siva Chandra