From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114059 invoked by alias); 9 Dec 2016 12:23:59 -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 114046 invoked by uid 89); 9 Dec 2016 12:23:58 -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=antoine, weather, Antoine, Tremblay X-HELO: mail-wm0-f65.google.com Received: from mail-wm0-f65.google.com (HELO mail-wm0-f65.google.com) (74.125.82.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Dec 2016 12:23:57 +0000 Received: by mail-wm0-f65.google.com with SMTP id g23so3744511wme.1 for ; Fri, 09 Dec 2016 04:23:56 -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=yF0wkn0cDcsBScZjxCSc0kPZ103ghU3NuIxQibOCafQ=; b=CuUPd1ykQk3slT5lETg2tZDi5nvjPSEq/tigxSurfvHepL/jMPQ0XlZXNLtoCFKv8f dtMB76Zq9sfNv4xQlTVJJ3k0TrzyPVha+/VLkDj98hvBZZnG+CXfX9rH8CzH9cRQ2YXt ZOJGWp+lQ8rYboBVMLSRVFPImm7U0PXBbpCujqFojj9WPBOhF4uE8z42pWI4SU8qWyQR q5Rj17ugzMNlLgczkabsqFcCdr5alobvYAgMV28etgkqtNzfOyiGpxkJ7UQvNFGXTi7X +Oz2K/vDmd9KGoyTk3/tWqoNaPwteW5CqlrBWgsD3qnG639n6nuBVrWOlLdBBSU+bRZd kCGw== X-Gm-Message-State: AKaTC00vWZcoEwvFRzNqSK3T7ZPgsInwWX+MLkmVp35ycgB8vvipEHfwfsOdTkFKqYx2pw== X-Received: by 10.28.13.144 with SMTP id 138mr6261311wmn.120.1481286234913; Fri, 09 Dec 2016 04:23:54 -0800 (PST) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id 81sm20313347wmw.7.2016.12.09.04.23.52 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 09 Dec 2016 04:23:54 -0800 (PST) Date: Fri, 09 Dec 2016 12:23: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: <20161209122339.GG13661@E107787-LIN> References: <20161128122758.7762-1-antoine.tremblay@ericsson.com> <20161201144401.GA19289@E107787-LIN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg00230.txt.bz2 On 16-12-01 10:28:14, Antoine Tremblay wrote: > >> @@ -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. > > Ho right, is it worth it to make the distinction however ? > > I mean, would it be better general practice to use target_read_memory > unless we absolutely need to use the_target->read_memory like with > breakpoint_at funcs.. ? The counterpart looks more error prone for the > developer... This distinction between target_read_memory and the_target->read_memory is clear to me. If we know we are accessing some places where breakpoints are impossible installed, like stack, use the_target->read_memory. Otherwise, use target_read_memory. Change in arm_get_syscall_trapinfo is not necessary to me. I can't figure out a case that program calls syscall instruction, and the previous instruction is a breakpoint. -- Yao (齐尧)