From patchwork Mon Jun 5 16:30:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 20805 Received: (qmail 1905 invoked by alias); 5 Jun 2017 16:30:41 -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 1612 invoked by uid 89); 5 Jun 2017 16:30:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, MIME_BASE64_BLANKS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=Enough, 15287 X-HELO: EUR01-VE1-obe.outbound.protection.outlook.com Received: from mail-ve1eur01on0066.outbound.protection.outlook.com (HELO EUR01-VE1-obe.outbound.protection.outlook.com) (104.47.1.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Jun 2017 16:30:21 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com (10.160.211.19) by AM3PR08MB0101.eurprd08.prod.outlook.com (10.160.211.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Mon, 5 Jun 2017 16:30:22 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::f0a8:fd0f:69e1:e280]) by AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::f0a8:fd0f:69e1:e280%17]) with mapi id 15.01.1143.018; Mon, 5 Jun 2017 16:30:22 +0000 From: Alan Hayward To: Yao Qi CC: "gdb-patches@sourceware.org" , nd Subject: Re: [PATCH 11/11] Add SH_MAX_REGISTER_SIZE and SH64_MAX_REGISTER_SIZE Date: Mon, 5 Jun 2017 16:30:22 +0000 Message-ID: <44AA3E84-BCF8-4A36-ADF5-83C0DE7771BE@arm.com> References: <8637dfw5kl.fsf@gmail.com> <45FE08DA-87EC-48FB-97EC-8463A473126F@arm.com> In-Reply-To: <45FE08DA-87EC-48FB-97EC-8463A473126F@arm.com> authentication-results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM3PR08MB0101; 7:u8ziv85viz8iQwKLp4obSxb5oaf5Tvh6hMJDHqR0qwkU8ElI/1sKarUPiheDt7D/lxht/PJ1TOa61XKWdECKu1V6/yBIu10IisfzXRudqqW16KY5tN3m2Sin8ZntL7KO2y9gLRWVsBKyFk97QOyvH8YOeNOQl8KOWsVzRqtKsi8PDg7BfytPXI4CPWuumAMX/3sbYgywm9YtWBlo8wkjloD6FyWbvvnsGvTG06Fnl2UvNs9Lg4kIXpTBkH8MPSEjxMWUzJiq28zXrUVcAB7pDFl9jAvMoYZ2srmog9bie44PpaZ05k8HPT72duRdFFG0m919BVD2YeCyWjAIwxAc9A== x-ms-traffictypediagnostic: AM3PR08MB0101: x-ms-office365-filtering-correlation-id: c48a11cf-97f5-44c0-ed61-08d4ac3029c0 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081); SRVR:AM3PR08MB0101; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(201703131423075)(201703011903075)(201702281528075)(201703061421075)(20161123555025)(20161123562025)(20161123558100)(20161123560025)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM3PR08MB0101; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM3PR08MB0101; x-forefront-prvs: 0329B15C8A x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39410400002)(39450400003)(39850400002)(39860400002)(39400400002)(39840400002)(24454002)(377424004)(6246003)(50986999)(76176999)(5660300001)(3846002)(2950100002)(6116002)(86362001)(6916009)(102836003)(189998001)(6512007)(305945005)(54906002)(4326008)(38730400002)(53936002)(110136004)(54356999)(33656002)(39060400002)(7736002)(99286003)(25786009)(229853002)(6486002)(72206003)(36756003)(6506006)(1411001)(5250100002)(3660700001)(14454004)(3280700002)(508600001)(66066001)(2906002)(6436002)(8676002)(53546009)(2900100001)(82746002)(83716003)(8936002)(81166006)(15760500002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR08MB0101; H:AM3PR08MB0101.eurprd08.prod.outlook.com; FPR:; SPF:None; MLV:ovrnspm; PTR:InfoNoRecords; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jun 2017 16:30:22.1249 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR08MB0101 > On 12 Apr 2017, at 09:34, Alan Hayward wrote: > > >> On 11 Apr 2017, at 12:23, Yao Qi wrote: >> >> Alan Hayward writes: >> I’ve rebased this patch due to Yao’s unit test changes. I don't have a SH machine to test on. Tested on a --enable-targets=all and --enable-libsanitizer build using make check with board files unix and native-gdbserver. Ok to commit? Alan. 2017-06-05 Alan Hayward * gdb/sh-tdep.c (sh_pseudo_register_read): Remove MAX_REGISTER_SIZE. (sh_pseudo_register_write): Likewise. * gdb/sh64-tdep.c (SH64_MAX_REGISTER_SIZE): Add. (sh64_pseudo_register_read): Use SH64_MAX_REGISTER_SIZE. (sh64_pseudo_register_write): Likewise diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 2c2b26847d58808ef912ed4969bc28c799ad9bbd..a87547d4ceda1b6db4157d181ae1b982444a867c 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1648,13 +1648,14 @@ sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int reg_nr, gdb_byte *buffer) { int base_regnum; - gdb_byte temp_buffer[MAX_REGISTER_SIZE]; enum register_status status; if (reg_nr == PSEUDO_BANK_REGNUM) return regcache_raw_read (regcache, BANK_REGNUM, buffer); else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM) { + /* Enough space for two float registers. */ + gdb_byte temp_buffer[4 * 2]; base_regnum = dr_reg_base_num (gdbarch, reg_nr); /* Build the value in the provided buffer. */ @@ -1687,7 +1688,6 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int reg_nr, const gdb_byte *buffer) { int base_regnum, portion; - gdb_byte temp_buffer[MAX_REGISTER_SIZE]; if (reg_nr == PSEUDO_BANK_REGNUM) { @@ -1703,6 +1703,8 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, } else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM) { + /* Enough space for two float registers. */ + gdb_byte temp_buffer[4 * 2]; base_regnum = dr_reg_base_num (gdbarch, reg_nr); /* We must pay attention to the endiannes. */ diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index 06ae04e9da1eff6e2b9e3e977e4f52fa398f69f2..244029501aed1837097f5eb73e6a141cf928d009 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -122,6 +122,9 @@ enum FP_LAST_REGNUM = SIM_SH64_FR0_REGNUM + SIM_SH64_NR_FP_REGS - 1 }; +/* Big enough to hold the size of the largest register in bytes. */ +#define SH64_MAX_REGISTER_SIZE 12 + static const char * sh64_register_name (struct gdbarch *gdbarch, int reg_nr) { @@ -1528,7 +1531,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int base_regnum; int offset = 0; - gdb_byte temp_buffer[MAX_REGISTER_SIZE]; + gdb_byte temp_buffer[SH64_MAX_REGISTER_SIZE]; enum register_status status; if (reg_nr >= DR0_REGNUM @@ -1704,7 +1707,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int base_regnum, portion; int offset; - gdb_byte temp_buffer[MAX_REGISTER_SIZE]; + gdb_byte temp_buffer[SH64_MAX_REGISTER_SIZE]; if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)