From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31156 invoked by alias); 28 Aug 2012 00:41:49 -0000 Received: (qmail 31144 invoked by uid 22791); 28 Aug 2012 00:41:48 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,MSGID_FROM_MTA_HEADER,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,TW_FD X-Spam-Check-By: sourceware.org Received: from e06smtp16.uk.ibm.com (HELO e06smtp16.uk.ibm.com) (195.75.94.112) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Aug 2012 00:41:34 +0000 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 28 Aug 2012 01:41:33 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp16.uk.ibm.com (192.168.101.146) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 28 Aug 2012 01:41:30 +0100 Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7S0fNn437879944 for ; Tue, 28 Aug 2012 00:41:23 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7S0fTFO026980 for ; Mon, 27 Aug 2012 18:41:29 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id q7S0fRb3026972; Mon, 27 Aug 2012 18:41:28 -0600 Message-Id: <201208280041.q7S0fRb3026972@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Tue, 28 Aug 2012 02:41:27 +0200 Subject: Re: info registers output To: palves@redhat.com (Pedro Alves) Date: Tue, 28 Aug 2012 00:41:00 -0000 From: "Ulrich Weigand" Cc: palves@redhat.com (Pedro Alves), sergiodj@redhat.com (Sergio Durigan Junior), gdb-patches@sourceware.org (GDB Patches), tromey@redhat.com (Tom Tromey), jan.kratochvil@redhat.com (Jan Kratochvil) In-Reply-To: <503BB123.50500@redhat.com> from "Pedro Alves" at Aug 27, 2012 06:40:51 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit x-cbid: 12082800-3548-0000-0000-000002F1670D 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-08/txt/msg00821.txt.bz2 Pedro Alves wrote: > On 08/01/2012 09:49 PM, Ulrich Weigand wrote: > > Would make sense to me. (In fact, there probably ought to be a single > > routine to print a register, called by both code paths, to avoid having > > the code diverge again in the future ...) > > Here's a patch that does that. If some arch wants to print user regs > differently, we'll either have to add a new gdbarch, or make > gdbarch_print_registers_info handle user regs. > > We now get, for amd64: > > (gdb) info registers pc rip sp rsp fp rbp > pc 0x45762b 0x45762b > rip 0x45762b 0x45762b > sp 0x7fffffffdbe0 0x7fffffffdbe0 > rsp 0x7fffffffdbe0 0x7fffffffdbe0 > fp 0x7fffffffdc10 0x7fffffffdc10 > rbp 0x7fffffffdc10 0x7fffffffdc10 > > Before we'd get: > > (gdb) info registers pc rip sp rsp fp rbp > pc: 0x45762b > rip 0x45762b 0x45762b > sp: 0x7fffffffdbe0 > rsp 0x7fffffffdbe0 0x7fffffffdbe0 > fp: 0x7fffffffdc10 > rbp 0x7fffffffdc10 0x7fffffffdc10 > > How does it look? Looks good to me. The only minor nit would be: > +/* Print out the register NAME, of GDBARCH, with value VAL, to FILE, > + in the default fashion. */ > + > +static void > +default_print_one_register_info (struct gdbarch *gdbarch, > + struct ui_file *file, > + const char *name, > + struct value *val) Does this really need a GDBARCH argument? It's only used here: > + for (j = 0; j < TYPE_LENGTH (regtype); j++) > + { > + int idx; > + > + if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) > + idx = j; > + else > + idx = TYPE_LENGTH (regtype) - 1 - j; > + fprintf_filtered (file, "%02x", (unsigned char) valaddr[idx]); > + } where we really want the type's byte order anyway ... Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com