From patchwork Mon Jun 5 16:33:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 20806 Received: (qmail 8603 invoked by alias); 5 Jun 2017 16:33:46 -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 8590 invoked by uid 89); 5 Jun 2017 16:33:45 -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, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR02-HE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr10087.outbound.protection.outlook.com (HELO EUR02-HE1-obe.outbound.protection.outlook.com) (40.107.1.87) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Jun 2017 16:33:43 +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:33:45 +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:33:45 +0000 From: Alan Hayward To: "gdb-patches@sourceware.org" CC: nd Subject: [PATCH] Remove a MAX_REGISTER_SIZE from frame.c Date: Mon, 5 Jun 2017 16:33:45 +0000 Message-ID: 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:Lf25x5fHMDbNOUK4yCFs+eUimomqznFIziQ5CWY0LE+kLUzfEYrJ2ZGIntVFaKIPQ4RJGKMLz3alfIYxTMcXA9K7wMLAtBdOoFAF1xuOj+rubKRy6PNryxtj9sjQ+ab37oxKqCl2Q7GhOOOHRE82HtG1KCssQpS3hdnTlL2SIJDatvvZFzFbdtMYI8CcWS7S6uWJ6Lt5+kuW0Pl4RfkLCHXnnnodtdYYxBRqNPPDxNos3FJ5P33mGQRsmHx+k2izBSvgtFcQKMsEckXxz0qmMXX7KyHqVBCY5YoFuVOdwdGynmTBSPuFPnLCETp/UkUy13FlUEp1c6wqWobZH9tj/w== x-ms-traffictypediagnostic: AM3PR08MB0101: x-ms-office365-filtering-correlation-id: f3ca5eaf-7e90-4b1e-da60-08d4ac30a2a3 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)(39410400002)(39450400003)(39850400002)(39860400002)(39400400002)(39840400002)(377424004)(50986999)(5660300001)(5640700003)(3846002)(6116002)(86362001)(6916009)(575784001)(102836003)(189998001)(6512007)(305945005)(4326008)(38730400002)(53936002)(110136004)(54356999)(33656002)(7736002)(99286003)(25786009)(6486002)(2501003)(72206003)(36756003)(6506006)(5250100002)(3660700001)(14454004)(3280700002)(508600001)(66066001)(2906002)(2351001)(6436002)(8676002)(2900100001)(82746002)(83716003)(8936002)(81166006); 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: <0F806235D567F44A9E7528815DA6AC95@eurprd08.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jun 2017 16:33:45.1106 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR08MB0101 Make frame_unwind_register_signed look the same as frame_unwind_register_unsigned. This change got missed in a previous patch. Tested on a --enable-targets=all build using make check with board files unix and native-gdbserver. Ok to commit? Alan. 2017-06-05 Alan Hayward * frame.c (frame_unwind_register_signed): Use frame_unwind_register_value. diff --git a/gdb/frame.c b/gdb/frame.c index efe5a20591dd2667200f85e0cff07dbe79ee3e87..30e4aeab7e2901074c289ac4d96ebda885805a29 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1252,10 +1252,27 @@ frame_unwind_register_signed (struct frame_info *frame, int regnum) struct gdbarch *gdbarch = frame_unwind_arch (frame); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int size = register_size (gdbarch, regnum); - gdb_byte buf[MAX_REGISTER_SIZE]; + struct value *value = frame_unwind_register_value (frame, regnum); + + gdb_assert (value != NULL); + + if (value_optimized_out (value)) + { + throw_error (OPTIMIZED_OUT_ERROR, + _("Register %d was not saved"), regnum); + } + if (!value_entirely_available (value)) + { + throw_error (NOT_AVAILABLE_ERROR, + _("Register %d is not available"), regnum); + } - frame_unwind_register (frame, regnum, buf); - return extract_signed_integer (buf, size, byte_order); + LONGEST r = extract_signed_integer (value_contents_all (value), size, + byte_order); + + release_value (value); + value_free (value); + return r; } LONGEST