From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47783 invoked by alias); 23 Mar 2016 17:26:29 -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 47054 invoked by uid 89); 23 Mar 2016 17:26:26 -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_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=regions, copied, H*M:56F2D1BF, convinced X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 23 Mar 2016 17:26:25 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id ADDCCAA0CD; Wed, 23 Mar 2016 17:26:24 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2NHQNKJ010775; Wed, 23 Mar 2016 13:26:24 -0400 Subject: Re: [PATCH 2/2] Remove gdbarch method displaced_step_hw_singlestep To: Yao Qi , gdb-patches@sourceware.org References: <1458742206-622-1-git-send-email-yao.qi@linaro.org> <1458742206-622-3-git-send-email-yao.qi@linaro.org> From: Pedro Alves Message-ID: <56F2D1BF.5070005@redhat.com> Date: Wed, 23 Mar 2016 17:26:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1458742206-622-3-git-send-email-yao.qi@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-03/txt/msg00483.txt.bz2 On 03/23/2016 02:10 PM, Yao Qi wrote: > displaced_step_hw_singlestep was added for some targets, which can do > hardware single step, but need software single step for some special > instructions. After we change gdbarch method software_single_step, > displaced_step_hw_singlestep is no longer necessary, because we can > get the same information from software_single_step. I wasn't sure whether this is safe, but I convinced myself it is. I'd have been nice if there had been a note in the log about the below: Currently, when stepping past an instruction in the scratch pad, these archs won't ever reach the software_single_step method, always forcing a hardware single-step, even if the software_single_step method would insert some breakpoint. The question is: is it safe now for them to analyse the instruction copied to the scratch pad, and potentially insert a software single-step? I think it is safe, because we won't ever use displaced stepping for the cases where the software_single_step method would return something non-NULL. software_single_step returns non-NULL _only_ for atomic regions, while OTOH, displaced_step_copy_insn always returns NULL for atomic regions. E.g., notice how ppc_displaced_step_copy_insn vs ppc_deal_with_atomic_sequence. > --- a/gdb/infrun.c > +++ b/gdb/infrun.c > @@ -2611,8 +2611,25 @@ resume (enum gdb_signal sig) > pc = regcache_read_pc (get_thread_regcache (inferior_ptid)); > > displaced = get_displaced_stepping_state (ptid_get_pid (inferior_ptid)); > - step = gdbarch_displaced_step_hw_singlestep (gdbarch, > - displaced->step_closure); > + > + if (gdbarch_software_single_step_p (gdbarch)) > + { > + VEC (CORE_ADDR) * next_pcs = NULL; No need to initialize. > + > + next_pcs = gdbarch_software_single_step (gdbarch, > + get_current_frame ()); > + > + if (next_pcs != 0) next_pcs != NULL. Thanks, Pedro Alves