From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21489 invoked by alias); 28 Nov 2016 12:28:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 21473 invoked by uid 89); 28 Nov 2016 12:28:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham 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:24 +0000 Received: from EUSAAHC007.ericsson.se (Unknown_Domain [147.117.188.93]) by (Symantec Mail Security) with SMTP id 29.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 2/3] Fix inferior memory reading in GDBServer for ppc. Date: Mon, 28 Nov 2016 12:28:00 -0000 Message-ID: <20161128122758.7762-2-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 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00915.txt.bz2 Before this patch, parse_spufs_run 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. This patch is built tested but not regression tested. gdb/gdbserver/ChangeLog: * linux-ppc-low.c (parse_spufs_run): Use target_read_memory. (ppc_get_pc): Likewise. --- gdb/gdbserver/linux-ppc-low.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c index 1d013f1..6fcad84 100644 --- a/gdb/gdbserver/linux-ppc-low.c +++ b/gdb/gdbserver/linux-ppc-low.c @@ -231,8 +231,8 @@ parse_spufs_run (struct regcache *regcache, int *fd, CORE_ADDR *addr) } /* Fetch instruction preceding current NIP. */ - if ((*the_target->read_memory) (curr_pc - 4, - (unsigned char *) &curr_insn, 4) != 0) + if (target_read_memory (curr_pc - 4, + (unsigned char *) &curr_insn, 4) != 0) return 0; /* It should be a "sc" instruction. */ if (curr_insn != INSTR_SC) @@ -253,7 +253,7 @@ ppc_get_pc (struct regcache *regcache) if (parse_spufs_run (regcache, &fd, &addr)) { unsigned int pc; - (*the_target->read_memory) (addr, (unsigned char *) &pc, 4); + target_read_memory (addr, (unsigned char *) &pc, 4); return ((CORE_ADDR)1 << 63) | ((CORE_ADDR)fd << 32) | (CORE_ADDR) (pc - 4); } -- 2.9.2