From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26275 invoked by alias); 10 Jun 2009 16:49:08 -0000 Received: (qmail 26246 invoked by uid 22791); 10 Jun 2009 16:49:08 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Jun 2009 16:49:02 +0000 Received: (qmail 12599 invoked from network); 10 Jun 2009 16:48:59 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 10 Jun 2009 16:48:59 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [01/15] Introduce get_current_arch () function Date: Wed, 10 Jun 2009 16:49:00 -0000 User-Agent: KMail/1.9.10 Cc: "Ulrich Weigand" , tromey@redhat.com References: <200906101536.n5AFaEDM000676@d12av02.megacenter.de.ibm.com> In-Reply-To: <200906101536.n5AFaEDM000676@d12av02.megacenter.de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906101750.03206.pedro@codesourcery.com> 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: 2009-06/txt/msg00262.txt.bz2 On Wednesday 10 June 2009 16:36:14, Ulrich Weigand wrote: > Tom Tromey wrote: > > >>>>> "Ulrich" == Ulrich Weigand writes: > > > > Ulrich> printf_command (char *arg, int from_tty) > > Ulrich> { > > Ulrich> + struct gdbarch *gdbarch = get_current_arch (); > > > > I think that perhaps the printf command should use the arch from the > > values it is trying to print. > > > > Ulrich> struct type *wctype = lookup_typename (current_language, > > Ulrich> - current_gdbarch, > > Ulrich> + gdbarch, > > Ulrich> "wchar_t", NULL, 0); > > > > E.g., here it could use the architecture from val_args[i]. > > > > The benefit here would be that you could print out two wide strings, > > each from a different architecture, using a single printf. This seems > > like a reasonable thing to want to do. > > There wouldn't really be much of a difference today, as the architecture > of val_args[i] is the architecture of the expression from which it was > evaluated, which is likewise get_current_arch (). > > However, you're right that it would be more straightforward to use the > value arch here, in case we might later decide to allow evaluation of > an expression to return values in a different arch. I haven't actually studied the patch set, so sorry if this sounds way off, but Tom's remark made me wonder how does this interact with re-printing values from the history ($1, $2, $nnn) or convenience variables? As in, what would be the arch used to print $nnn? Should it be the current arch, or the arch that was used when the value was produced? A simple example where it can be a different arch is if you debug inferior/target foo, print something, kill/disconnect, debug inferior/target 2, reprint value from history. I see from the hunk above that the language used is always the current language, so it may be right to always use the current arch... -- Pedro Alves