From patchwork Thu Jun 8 09:41:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 20845 Received: (qmail 101725 invoked by alias); 8 Jun 2017 09:42:02 -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 100043 invoked by uid 89); 8 Jun 2017 09:42:01 -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= X-HELO: EUR01-VE1-obe.outbound.protection.outlook.com Received: from mail-ve1eur01on0060.outbound.protection.outlook.com (HELO EUR01-VE1-obe.outbound.protection.outlook.com) (104.47.1.60) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Jun 2017 09:41:59 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com (10.160.211.19) by AM3PR08MB0103.eurprd08.prod.outlook.com (10.160.211.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1157.12; Thu, 8 Jun 2017 09:42:00 +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.1157.012; Thu, 8 Jun 2017 09:42:00 +0000 From: Alan Hayward To: Yao Qi , "gdb-patches@sourceware.org" CC: nd Subject: Re: [PATCH 9/11] Add MN10300_MAX_REGISTER_SIZE (2) Date: Thu, 8 Jun 2017 09:41:59 +0000 Message-ID: <3D24BC4E-EF3E-4ED2-89D5-EB6FE7983313@arm.com> References: <466CF7AB-4D05-4A4B-9FB9-80513E7ABF1C@arm.com> <8A16DE9D-BE32-4CEF-9144-8D78F3A803B4@arm.com> In-Reply-To: <8A16DE9D-BE32-4CEF-9144-8D78F3A803B4@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; AM3PR08MB0103; 7:mnnMBK47U+IyGhZWMJbLseAhX86n+noV3bUESlNm0tWiiZ6uXTM6IcE4uaQVRRwx6ThOlvJCDseeJ24XdDQLGoA4eSFqFZjwinPLJlLXLI+EilPzG1DI+llMG1YUY2u8wTV/1OWwOfzBGvIL0cnuxKII3o1+s90y97pZ2wEpK/X2YqohH9zMVomUvv7yFddYDHnQvwP1pwlstBpeZw/tcm+62QQWPDJDWnbqQiNsc/0oF9PRjTWAGzp0rbzEx85YbHcSt+7wLILGSq8ruFPz1gBmxzkLfDdeEHoHIwoV495/q+2XKh0KfKthHquc30Vhpf1HQJ7+vi/gki2dPUUcnA== x-ms-traffictypediagnostic: AM3PR08MB0103: x-ms-office365-filtering-correlation-id: d641b901-3d6d-4e1f-af6d-08d4ae529c66 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081)(201702281549075); SRVR:AM3PR08MB0103; 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)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6041248)(20161123562025)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM3PR08MB0103; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM3PR08MB0103; x-forefront-prvs: 0332AACBC3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39850400002)(39400400002)(39840400002)(39410400002)(39450400003)(377424004)(24454002)(53546009)(6246003)(229853002)(6436002)(6506006)(36756003)(8936002)(25786009)(6486002)(81166006)(5660300001)(189998001)(5250100002)(14454004)(2501003)(8676002)(66066001)(478600001)(39060400002)(38730400002)(72206003)(305945005)(4326008)(7736002)(76176999)(50986999)(3280700002)(2900100001)(3660700001)(33656002)(99286003)(3846002)(86362001)(83716003)(2906002)(53936002)(102836003)(6116002)(82746002)(6512007)(2950100002)(54356999)(575784001)(15760500002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR08MB0103; H:AM3PR08MB0101.eurprd08.prod.outlook.com; FPR:; SPF:None; MLV:ovrnspm; PTR:InfoNoRecords; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <5E972513CEB07344B055E2F227BCC485@eurprd08.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2017 09:41:59.7927 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR08MB0103 > On 4 May 2017, at 16:17, Alan Hayward wrote: > > >> On 4 Apr 2017, at 11:15, Alan Hayward wrote: >> I’ve rebased this patch due to Yao’s unit test changes. MN10300_MAX_REGISTER_SIZE is set to 64 to ensure nothing breaks. I don't have a MN10300 machine to test on. Tested on a --enable-targets=all and asan build using make check with board files unix, native-gdbserver and unittest Ok to commit? Alan. 2017-06-08 Alan Hayward * mn10300-tdep.c (MN10300_MAX_REGISTER_SIZE): Add. (mn10300_extract_return_value): Use MN10300_MAX_REGISTER_SIZE. (mn10300_push_dummy_call): Likewise. diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index f8dd762cf0a27d6e84c28da3021a9c7971743b9e..669bfa1bce5cdeb4d4b9a357f4e5e520ce5de730 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -40,6 +40,9 @@ /* The am33-2 has 64 registers. */ #define MN10300_MAX_NUM_REGS 64 +/* Big enough to hold the size of the largest register in bytes. */ +#define MN10300_MAX_REGISTER_SIZE 64 + /* This structure holds the results of a prologue analysis. */ struct mn10300_prologue { @@ -196,7 +199,7 @@ static void mn10300_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, void *valbuf) { - gdb_byte buf[MAX_REGISTER_SIZE]; + gdb_byte buf[MN10300_MAX_REGISTER_SIZE]; int len = TYPE_LENGTH (type); int reg, regsz; @@ -206,6 +209,7 @@ mn10300_extract_return_value (struct gdbarch *gdbarch, struct type *type, reg = 0; regsz = register_size (gdbarch, reg); + gdb_assert (regsz <= MN10300_MAX_REGISTER_SIZE); if (len <= regsz) { regcache_raw_read (regcache, reg, buf); @@ -1224,7 +1228,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch, int stack_offset = 0; int argnum; const gdb_byte *val; - gdb_byte valbuf[MAX_REGISTER_SIZE]; + gdb_byte valbuf[MN10300_MAX_REGISTER_SIZE]; /* This should be a nop, but align the stack just in case something went wrong. Stacks are four byte aligned on the mn10300. */ @@ -1266,6 +1270,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch, { /* Change to pointer-to-type. */ arg_len = push_size; + gdb_assert (push_size <= MN10300_MAX_REGISTER_SIZE); store_unsigned_integer (valbuf, push_size, byte_order, value_address (*args)); val = &valbuf[0];