From patchwork Mon Jun 12 09:34:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 20942 Received: (qmail 84244 invoked by alias); 12 Jun 2017 09:34:32 -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 84173 invoked by uid 89); 12 Jun 2017 09:34:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No 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: EUR01-VE1-obe.outbound.protection.outlook.com Received: from mail-ve1eur01on0083.outbound.protection.outlook.com (HELO EUR01-VE1-obe.outbound.protection.outlook.com) (104.47.1.83) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Jun 2017 09:34:29 +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.1157.12; Mon, 12 Jun 2017 09:34:31 +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.017; Mon, 12 Jun 2017 09:34:31 +0000 From: Alan Hayward To: "gdb-patches@sourceware.org" CC: nd Subject: [PATCH] Remove an instance of MAX_REGISTER_SIZE from record-full.c Date: Mon, 12 Jun 2017 09:34:30 +0000 Message-ID: <69EEE46A-D88C-4B4F-86A2-E35F6DAFD90A@arm.com> authentication-results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM3PR08MB0101; 7:GUE9w0vy4IR6hytps3ZSb87P7nZBSRNf7qVwg8nEdy9p1XAmMGfBnYpHcvZonrl2aB3jKxqbzTOtHgKf5l7bQahR1j4o774fr0EfMkt6bC2TbjjROep6Q6qDvbdUiBS11vglpgKlN8pQUoMcDrhKRf2f5A1qQtm72H8FsJSD3brCaRYI6hk3s8iy8M1pX2GEUaWtczWisklGHwc1GRQjKxOiJVN0lmvNzlBBDSWIWXr4Zjp/NMBlUaicuR0k7PfWoAk1yqsqtOkxHtjNuZib5Im6sW/NczH9Oiz1+VXyaXUeDkSZh85kZwMrF2Hfr8r6+ptlf10XENMRdRQa93JgBg== x-ms-traffictypediagnostic: AM3PR08MB0101: x-ms-office365-filtering-correlation-id: 40428001-79a5-4844-eaf2-08d4b1763a65 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)(5005006)(8121501046)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6041248)(20161123555025)(20161123562025)(20161123558100)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(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: 03361FCC43 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39400400002)(39410400002)(39840400002)(39850400002)(39450400003)(39860400002)(377424004)(8936002)(3846002)(6486002)(8676002)(81166006)(6512007)(5660300001)(7736002)(5250100002)(6436002)(72206003)(2906002)(305945005)(2900100001)(5640700003)(6506006)(86362001)(53936002)(4326008)(6916009)(102836003)(478600001)(82746002)(99286003)(36756003)(189998001)(83716003)(50986999)(2351001)(54356999)(25786009)(38730400002)(110136004)(33656002)(3280700002)(14454004)(3660700001)(2501003)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR08MB0101; H:AM3PR08MB0101.eurprd08.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <098D35456787374C8A0B7FD4A8B08ED3@eurprd08.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jun 2017 09:34:30.8378 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR08MB0101 In record_full_exec_insn use cooked_read_value instead of creating a temp buffer. Code to remove MAX_REGISTER_SIZE from uses of record_full_core_regbuf will be in a different patch (I'm debugging some issues with it). Tested on a --enable-targets=all build with board files unix and native-gdbserver. Ok to commit? Alan. 2017-06-12 Alan Hayward * gdb/record-full.c (record_full_exec_insn): Use regcache->cooked_read_value. diff --git a/gdb/record-full.c b/gdb/record-full.c index 31ff558d2a633cff71d3e6082e42f5d6fb88bcf1..2f09e2fc316d7d3073de035f961f7c3bf9d3002c 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -698,7 +698,7 @@ record_full_exec_insn (struct regcache *regcache, { case record_full_reg: /* reg */ { - gdb_byte reg[MAX_REGISTER_SIZE]; + struct value *value; if (record_debug > 1) fprintf_unfiltered (gdb_stdlog, @@ -707,10 +707,13 @@ record_full_exec_insn (struct regcache *regcache, host_address_to_string (entry), entry->u.reg.num); - regcache_cooked_read (regcache, entry->u.reg.num, reg); - regcache_cooked_write (regcache, entry->u.reg.num, - record_full_get_loc (entry)); - memcpy (record_full_get_loc (entry), reg, entry->u.reg.len); + value = regcache->cooked_read_value (entry->u.reg.num); + gdb_assert (value != NULL); + regcache->cooked_write (entry->u.reg.num, record_full_get_loc (entry)); + memcpy (record_full_get_loc (entry), value_contents_all (value), + entry->u.reg.len); + release_value (value); + value_free (value); } break;