From patchwork Tue Jul 10 15:05:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 28294 Received: (qmail 71163 invoked by alias); 10 Jul 2018 15:05:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 71153 invoked by uid 89); 10 Jul 2018 15:05:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR02-AM5-obe.outbound.protection.outlook.com Received: from mail-eopbgr00073.outbound.protection.outlook.com (HELO EUR02-AM5-obe.outbound.protection.outlook.com) (40.107.0.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Jul 2018 15:05:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NMC5PRzhnVhad1gLlSZ3RijfUKGvRllfmC6q933dj+A=; b=KkmiI/R14ZIhvu+94jblnldSTo5A5bPIGNvDnOoumwEeefmGut01sTinW9+UK28412v7qeKeXYdDDZKmUjkhwoJYclMerOOknRw0Q9ypm9WYtfM84nIhOKqM43MoBxjWuQ4J0HE0ZA8Bb1OlCf5p3vGmA+HUB5mWtMOSIH0YDIE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; Received: from C02TF0U7HF1T.manchester.arm.com (217.140.96.140) by DB6PR0802MB2136.eurprd08.prod.outlook.com (2603:10a6:4:83::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.21; Tue, 10 Jul 2018 15:05:49 +0000 From: Alan Hayward To: gdb-patches@sourceware.org Cc: nd@arm.com, Alan Hayward Subject: [PATCH] Return bytes for tdesc_register_size() Date: Tue, 10 Jul 2018 16:05:42 +0100 Message-Id: <20180710150542.93363-1-alan.hayward@arm.com> MIME-Version: 1.0 Return-Path: alan.hayward@arm.com Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-IsSubscribed: yes tdesc_register_size returns number of bits. Change this to use bytes, the same as regcache::register_size, memcpy and sizeof. This fixes a bug in aarch64_get_tdesc_vq which assumed bytes. Update all other calls to tdesc_register_size. I originally planned to fix aarch64_get_tdesc_vq and push as OBV. However, this seemed the better fix. Required for 8.2 Tested with make check on a target all build. I don't have a rs6000 machine, however change is simple enough. 2018-07-10 Alan Hayward * target-descriptions.c (tdesc_register_size): Return bytes. * target-descriptions.h (tdesc_register_size): Update comment. * rs6000-tdep.c (rs6000_gdbarch_init): Assume bytes. --- gdb/rs6000-tdep.c | 4 ++-- gdb/target-descriptions.c | 4 ++-- gdb/target-descriptions.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 4eeb62ac52..9801665723 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -5953,7 +5953,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) have_mq = tdesc_numbered_register (feature, tdesc_data, PPC_MQ_REGNUM, "mq"); - tdesc_wordsize = tdesc_register_size (feature, "pc") / 8; + tdesc_wordsize = tdesc_register_size (feature, "pc"); if (wordsize == -1) wordsize = tdesc_wordsize; @@ -5984,7 +5984,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* The fpscr register was expanded in isa 2.05 to 64 bits along with the addition of the decimal floating point facility. */ - if (tdesc_register_size (feature, "fpscr") > 32) + if (tdesc_register_size (feature, "fpscr") > 4) have_dfp = 1; } else diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index 3d7aa2582e..8c987fb88d 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -813,7 +813,7 @@ tdesc_numbered_register_choices (const struct tdesc_feature *feature, } /* Search FEATURE for a register named NAME, and return its size in - bits. The register must exist. */ + bytes. The register must exist. */ int tdesc_register_size (const struct tdesc_feature *feature, @@ -822,7 +822,7 @@ tdesc_register_size (const struct tdesc_feature *feature, struct tdesc_reg *reg = tdesc_find_register_early (feature, name); gdb_assert (reg != NULL); - return reg->bitsize; + return reg->bitsize / 8; } /* Look up a register by its GDB internal register number. */ diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h index 3ba71b1add..4284f23fe0 100644 --- a/gdb/target-descriptions.h +++ b/gdb/target-descriptions.h @@ -123,7 +123,7 @@ int tdesc_unnumbered_register (const struct tdesc_feature *feature, const char *name); /* Search FEATURE for a register named NAME, and return its size in - bits. The register must exist. */ + bytes. The register must exist. */ int tdesc_register_size (const struct tdesc_feature *feature, const char *name);