From patchwork Mon Jun 5 16:25:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 20803 Received: (qmail 119879 invoked by alias); 5 Jun 2017 16:25:31 -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 119779 invoked by uid 89); 5 Jun 2017 16:25:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.8 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-ve1eur01on0072.outbound.protection.outlook.com (HELO EUR01-VE1-obe.outbound.protection.outlook.com) (104.47.1.72) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Jun 2017 16:25: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:25: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:25:16 +0000 From: Alan Hayward To: Yao Qi CC: "gdb-patches@sourceware.org" , nd Subject: Re: [PATCH 6/11] Add ALPHA_MAX_REGISTER_SIZE Date: Mon, 5 Jun 2017 16:25:16 +0000 Message-ID: References: <772F5764-0F2A-4F53-BC41-C36AF15BED21@arm.com> <86bms3wbh5.fsf@gmail.com> In-Reply-To: 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:IPDZOhEkxXfrcUnNnpTBUYhwJnV9h5NXJl+irPJkmaD2PyBp3wYnaoO82MTuehYWAYKK6QxJgvOk/7LMXmVdsIYi77fePBrtAKe+2vAZxvY4qijSs2W7zAbQok2F7ki9BdGg2kLogF/wr5jUEaQLQ1LeMg+uDNuDvRKyaZCQrJ0/M24Kk1wi57sqiEHD9W+OUf29T+TbxdYkDJwQFc7dXmBeTTXqQS0x789NiTKyX1u9qIwx7xrSmRsdJaYaYjmASIkZko7klY6Nu9/OEGyvzHUduYSCbLKC+unZzYPI6bd8n2XTj76wrKWmDZkKQ+o7UTdQm2KhS7cjYy+99g/+qA== x-ms-traffictypediagnostic: AM3PR08MB0101: x-ms-office365-filtering-correlation-id: 2de5a12d-7ad6-4014-9658-08d4ac2f7355 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081)(201702281549075); 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)(575784001)(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); 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:25:16.2949 (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:25, Alan Hayward wrote: > >> >> On 11 Apr 2017, at 10:16, Yao Qi wrote: >> >> Alan Hayward writes: >> I’ve rebased this patch due to Yao’s unit test changes. Added two asserts a well. I don't have a ALPHA 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-05-30 Alan Hayward * alpha-tdep.c (alpha_register_to_value): Use get_frame_register_value. (alpha_value_to_register): Use ALPHA_REGISTER_SIZE. diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index d7cc0f4974362af89c2b42f4d5934fa8cd5d8a39..06ee90cbc7785d8277e773bdb6b98065e2e19568 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -244,17 +244,26 @@ alpha_register_to_value (struct frame_info *frame, int regnum, int *optimizedp, int *unavailablep) { struct gdbarch *gdbarch = get_frame_arch (frame); - gdb_byte in[MAX_REGISTER_SIZE]; + struct value *value = get_frame_register_value (frame, regnum); - /* Convert to TYPE. */ - if (!get_frame_register_bytes (frame, regnum, 0, - register_size (gdbarch, regnum), - in, optimizedp, unavailablep)) - return 0; + gdb_assert (value != NULL); + *optimizedp = value_optimized_out (value); + *unavailablep = !value_entirely_available (value); + + if (*optimizedp || *unavailablep) + { + release_value (value); + value_free (value); + return 0; + } + + /* Convert to VALTYPE. */ gdb_assert (TYPE_LENGTH (valtype) == 4); - alpha_sts (gdbarch, out, in); - *optimizedp = *unavailablep = 0; + alpha_sts (gdbarch, out, value_contents_all (value)); + + release_value (value); + value_free (value); return 1; } @@ -262,9 +271,11 @@ static void alpha_value_to_register (struct frame_info *frame, int regnum, struct type *valtype, const gdb_byte *in) { - gdb_byte out[MAX_REGISTER_SIZE]; + gdb_byte out[ALPHA_REGISTER_SIZE]; gdb_assert (TYPE_LENGTH (valtype) == 4); + gdb_assert (register_size (get_frame_arch (frame), regnum) + <= ALPHA_REGISTER_SIZE); alpha_lds (get_frame_arch (frame), out, in); put_frame_register (frame, regnum, out);