From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30150 invoked by alias); 2 Nov 2012 13:44:50 -0000 Received: (qmail 30142 invoked by uid 22791); 2 Nov 2012 13:44:49 -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-qc0-f182.google.com (HELO mail-qc0-f182.google.com) (209.85.216.182) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Nov 2012 13:44:44 +0000 Received: by mail-qc0-f182.google.com with SMTP id k19so3071808qcs.13 for ; Fri, 02 Nov 2012 06:44:44 -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=+abPeEjHGA3BngkfOhDt5o6t6xLDmXaL/czavycKGvI=; b=I6tLMnhxR1GqgkLv7jJZzQKC/l/9FJMKsHvLFFdxfHmUbrDUG4kKVORLrHZzvgWknT lPFDIbWDahzdW/1mEUjd94Gsg/LJg2y98y7lsqnMaacpnck/0G4c5KD6GbqnVm137TLM xu/2cOoi2Nh0EOnEpYIf/smGuph3VyCtIqjqKFEbnk+xCeWKYyJ9hk6H+fN1EZKLeoIu o46Hcuxy7aR9QXPSSJxn/X+lRmspzMrUg7/gKdN1y1OO2akASOR+PFrXwBWHTo57Mvw/ 1qRGcE2HQOdJeq11rwLdX8BGXbwuxQcFu7q470xJispgv5kqldHS0OVLuH2xIe6t9ge+ kcog== MIME-Version: 1.0 Received: by 10.224.31.20 with SMTP id w20mr2311208qac.3.1351863883870; Fri, 02 Nov 2012 06:44:43 -0700 (PDT) Received: by 10.224.10.207 with HTTP; Fri, 2 Nov 2012 06:44:43 -0700 (PDT) In-Reply-To: <87y5ilqdoz.fsf@fleche.redhat.com> References: <87y5ilqdoz.fsf@fleche.redhat.com> Date: Fri, 02 Nov 2012 13:44: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: ALoCoQkH/EAZ0J/IiVB8q+LxkZ0y1lxMlT/xvBZMXSf7CvqgNcThZiBYrIfu7yQ3e5619GMOKjJFof+jU9P8CDXmxWwlOdjwNfYJ77ZpBsp0w9y1c41CpGDFn94F/+urhVVUB/ZA9BQ2ojQJBFSp5woESr+s3NX0qZjEL0QvQxBoDaTEEEn46lHDG+RCaMQcrzv2sR3m9wV0a933pR0Bz65OparRFF01AA== 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/msg00039.txt.bz2 On Thu, Nov 1, 2012 at 1:18 PM, Tom Tromey wrote: > I'm not certain that this patch is correct. Also I tend to think (but > of course I am willing to be convinced otherwise) that a different > direction would be preferable. > > Siva> +static void > Siva> +on_architecture_change (struct gdbarch *arch) > Siva> +{ > Siva> + architecture_string = gdbarch_bfd_arch_info (arch)->printable_name; > Siva> + set_endian_string (arch); > Siva> +} > > Siva> + observer_attach_architecture_changed (on_architecture_change); > > I suspect this means that gdb.parameter('architecture') will not always > show the same result as "show architecture". I do not understand this completely. In my patch, show_architecture only prints 'architecture_string'. Hence, gdb.parameter('architecture') and "show architecture" should always show the same result. Did I miss something? > Right now, in the auto case show_architecture will call > get_current_arch: > > struct gdbarch * > get_current_arch (void) > { > if (has_stack_frames ()) > return get_frame_arch (get_selected_frame (NULL)); > else > return target_gdbarch; > } > > But from what I can tell, the architecture-change observer is not > notified in every situation that might cause that function to return a > different result. Pardon my ignorance here, does target arch change between frames? > I think a better approach might be to address the problem of "auto" gdb > parameters more globally. For example, we could add a method to the > appropriate CLI object so that the Python could call this to get the > correct current value. Do you mean that the CLI object should have a method (which can evaluate the property value on the go), rather than a property like 'architecture_string' and 'endian_string'? If yes, do you envision that Python make use of the method if it exists, otherwise use the property? Thanks, Siva Chandra