From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119660 invoked by alias); 20 Oct 2018 21:38:12 -0000 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 Received: (qmail 119648 invoked by uid 89); 20 Oct 2018 21:38:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS autolearn=no version=3.3.2 spammy=Jim, wilson, Wilson, Hx-languages-length:1263 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 20 Oct 2018 21:38:11 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0352E356EC; Sat, 20 Oct 2018 21:38:10 +0000 (UTC) Received: from pinnacle.lan (ovpn-116-78.phx2.redhat.com [10.3.116.78]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CDD971810D; Sat, 20 Oct 2018 21:38:09 +0000 (UTC) Date: Sat, 20 Oct 2018 21:38:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Cc: Jim Wilson Subject: Re: [PATCH 1/2] RISC-V: Print FP regs as union of float types. Message-ID: <20181020143808.3f66c381@pinnacle.lan> In-Reply-To: <20181019214907.8939-1-jimw@sifive.com> References: <20181019214907.8939-1-jimw@sifive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00455.txt.bz2 On Fri, 19 Oct 2018 14:49:07 -0700 Jim Wilson wrote: > A 64-bit FP register can hold either a single or double float value, so > print it as both types by using a union type for FP registers. Likewise > for 128-bit regs which can also hold long double. > > gdb/ > * riscv-tdep.c (riscv_fpreg_d_type, riscv_fpreg_q_type): New. > (riscv_register_type): Use them. > (riscv_print_one_register_info): Handle union of floats same as float. > * riscv-tdep.h (struct gdbarch_tdep): Add riscv_fpreg_d_type and > riscv_fpreg_q_type fields. This is okay, except for the following nits... > +static struct type * > +riscv_fpreg_d_type (struct gdbarch *gdbarch) > +{ > + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); > + > + if (!tdep->riscv_fpreg_d_type) The GDB coding standard say that this must be coded as: if (tdep->riscv_fpreg_d_type == NULL) Though I think we prefer nullptr over NULL these days. (I realize that there's code in GDB which does not conform to this standard.) Likewise, here: > +static struct type * > +riscv_fpreg_q_type (struct gdbarch *gdbarch) > +{ > + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); > + > + if (!tdep->riscv_fpreg_q_type) Kevin