From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45310 invoked by alias); 1 Dec 2016 14:44:22 -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 45223 invoked by uid 89); 1 Dec 2016 14:44:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=weather X-HELO: mail-wj0-f193.google.com Received: from mail-wj0-f193.google.com (HELO mail-wj0-f193.google.com) (209.85.210.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Dec 2016 14:44:16 +0000 Received: by mail-wj0-f193.google.com with SMTP id xy5so26651124wjc.1 for ; Thu, 01 Dec 2016 06:44:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=2WXL9hrZefLMZsNV2kvjiSZE0iPvZW0gsK0m0sA5J/U=; b=cx6XYbj7yYlB21X4H0+SglcAhmbzlOq8IFk1G06P4AlMctGgaM7W46cgHPUb2HSzhb 4te/HtKVm0RMuOKcpTwkbG0qJsWczpzEksDtcgG64B489bxMnFbVld8Amm/Gtr1jedQ+ oXUAnsTm+GKAHEbnf9XTaWpOx11uVijMBZrHOEc6zSf3FKhiEsZ6AYirvGTRfH1z1oq2 DOotmK9t6YFiky4/5Eck0+a11jF2XXKz9IzysbkJUAnQ+Va1kUaHRZFCuvCx3GULOKFb zjlXYpdTHD++VQil5XydesHzQJokFuVWw6/zaxLCyw6Yko0ZlZAVUSRdQj5a/AIVmEcR BkQg== X-Gm-Message-State: AKaTC00s8fX/t5SpzxHPaVZtehixp5+6q2bfUBaXhxgeG3nRm9+mFmhQdxb872x0FqXNpg== X-Received: by 10.194.90.135 with SMTP id bw7mr32552665wjb.34.1480603454199; Thu, 01 Dec 2016 06:44:14 -0800 (PST) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id v2sm562665wja.41.2016.12.01.06.44.12 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 01 Dec 2016 06:44:13 -0800 (PST) Date: Thu, 01 Dec 2016 14:44:00 -0000 From: Yao Qi To: Antoine Tremblay Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 1/3] Fix inferior memory reading in GDBServer for arm/aarch32. Message-ID: <20161201144401.GA19289@E107787-LIN> References: <20161128122758.7762-1-antoine.tremblay@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20161128122758.7762-1-antoine.tremblay@ericsson.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg00037.txt.bz2 On Mon, Nov 28, 2016 at 07:27:56AM -0500, Antoine Tremblay wrote: > Before this patch, some functions would read the inferior memory with > (*the_target)->read_memory, which returns the raw memory, rather than the > shadowed memory. > > This is wrong since these functions do not expect to read a breakpoint > instruction and can lead to invalid behavior. > > Use of raw memory in get_next_pcs_read_memory_unsigned_integer for example > could lead to get_next_pc returning an invalid pc. Can you elaborate under what circumstance breakpoints are still in memory when these functions are called? Can we have a test case? > @@ -769,15 +770,15 @@ arm_sigreturn_next_pc (struct regcache *regcache, int svc_number, > gdb_assert (svc_number == __NR_sigreturn || svc_number == __NR_rt_sigreturn); > > collect_register_by_name (regcache, "sp", &sp); > - (*the_target->read_memory) (sp, (unsigned char *) &sp_data, 4); > + target_read_memory (sp, (unsigned char *) &sp_data, 4); > > pc_offset = arm_linux_sigreturn_next_pc_offset > (sp, sp_data, svc_number, __NR_sigreturn == svc_number ? 1 : 0); > > - (*the_target->read_memory) (sp + pc_offset, (unsigned char *) &next_pc, 4); > + target_read_memory (sp + pc_offset, (unsigned char *) &next_pc, 4); > > /* Set IS_THUMB according the CPSR saved on the stack. */ > - (*the_target->read_memory) (sp + pc_offset + 4, (unsigned char *) &cpsr, 4); > + target_read_memory (sp + pc_offset + 4, (unsigned char *) &cpsr, 4); > *is_thumb = ((cpsr & CPSR_T) != 0); We are reading from stack, so we don't need to check weather there is a breakpoint or not. -- Yao (齐尧)