From patchwork Mon Nov 28 12:27:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tremblay X-Patchwork-Id: 17986 Received: (qmail 22367 invoked by alias); 28 Nov 2016 12:28:48 -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 22316 invoked by uid 89); 28 Nov 2016 12:28:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy= X-HELO: usplmg20.ericsson.net Received: from usplmg20.ericsson.net (HELO usplmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 28 Nov 2016 12:28:34 +0000 Received: from EUSAAHC007.ericsson.se (Unknown_Domain [147.117.188.93]) by (Symantec Mail Security) with SMTP id 69.8C.29529.3A72C385; Mon, 28 Nov 2016 13:48:35 +0100 (CET) Received: from elxa4wqvvz1.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.93) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 28 Nov 2016 07:28:11 -0500 From: Antoine Tremblay To: CC: Antoine Tremblay Subject: [PATCH 3/3] Fix inferior memory reading in GDBServer for sparc. Date: Mon, 28 Nov 2016 07:27:58 -0500 Message-ID: <20161128122758.7762-3-antoine.tremblay@ericsson.com> In-Reply-To: <20161128122758.7762-1-antoine.tremblay@ericsson.com> References: <20161128122758.7762-1-antoine.tremblay@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes Before this patch, sparc_store_gregset_from_stack would read the inferior memory with (*the_target)->read_memory, which returns the raw memory, rather than the shadowed memory. This is wrong since this function does not expect to read a breakpoint instruction and can lead to invalid behavior. Note I could not test or build this patch. gdb/gdbserver/ChangeLog: * linux-sparc-low.c (sparc_store_gregset_from_stack): Use target_read_memory. --- gdb/gdbserver/linux-sparc-low.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/gdbserver/linux-sparc-low.c b/gdb/gdbserver/linux-sparc-low.c index 70c5c93..31ef791 100644 --- a/gdb/gdbserver/linux-sparc-low.c +++ b/gdb/gdbserver/linux-sparc-low.c @@ -184,7 +184,7 @@ sparc_store_gregset_from_stack (struct regcache *regcache, const void *buf) for (i = l0_regno; i <= i7_regno; i++) { - (*the_target->read_memory) (addr, tmp_reg_buf, sizeof (tmp_reg_buf)); + target_read_memory (addr, tmp_reg_buf, sizeof (tmp_reg_buf)); supply_register (regcache, i, tmp_reg_buf); addr += sizeof (tmp_reg_buf); }