From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11837 invoked by alias); 1 Sep 2015 13:18:43 -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 11583 invoked by uid 89); 1 Sep 2015 13:18:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg20.ericsson.net Received: from usevmg20.ericsson.net (HELO usevmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 01 Sep 2015 13:18:40 +0000 Received: from EUSAAHC006.ericsson.se (Unknown_Domain [147.117.188.90]) by usevmg20.ericsson.net (Symantec Mail Security) with SMTP id A1.42.32596.9A745E55; Tue, 1 Sep 2015 08:37:29 +0200 (CEST) Received: from [142.133.110.95] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.92) with Microsoft SMTP Server id 14.3.248.2; Tue, 1 Sep 2015 09:18:36 -0400 Subject: Re: [PATCH 2/2] Support single step by arch or target To: Yao Qi , References: <1441096915-23615-1-git-send-email-yao.qi@linaro.org> <1441096915-23615-3-git-send-email-yao.qi@linaro.org> From: Antoine Tremblay Message-ID: <55E5A5A9.4030603@ericsson.com> Date: Tue, 01 Sep 2015 13:18:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1441096915-23615-3-git-send-email-yao.qi@linaro.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg00010.txt.bz2 On 09/01/2015 04:41 AM, Yao Qi wrote: > Nowadays, GDB only knows whether architecture supports hardware single > step or software single step (through gdbarch hook software_single_step), > and for a given instruction or instruction sequence, GDB knows how to > do single step (hardware or software). However, GDB doesn't know whether > the target supports hardware single step. It is possible that the > architecture doesn't support hardware single step, such as arm, but > the target supports, such as simulator. This was discussed in this > thread https://www.sourceware.org/ml/gdb/2009-12/msg00033.html before. > > I encounter this problem for aarch64 multi-arch support. When aarch64 > debugs arm program, gdbarch is arm, so software single step is still > used. However, the underneath linux kernel does support hardware > single step, so IWBN to use it. > > This patch is to add a new target_ops hook to_can_do_single_step, and > only use it in arm_linux_software_single_step to decide whether or not > to use hardware single step. Could we name this can_hardware_single_step instead ? Since the target may be able to software single step (in gdbserver). And thus it would be confusing...It would also be more consistent with the supports_hardware_single_step hook ? > --- a/gdb/arm-linux-tdep.c > +++ b/gdb/arm-linux-tdep.c > @@ -917,6 +917,11 @@ arm_linux_software_single_step (struct frame_info *frame) > if (arm_deal_with_atomic_sequence (frame)) > return 1; > > + /* If the target does have hardware single step, GDB doesn't have > + to bother software single step. */ > + if (target_can_do_single_step () == 1) > + return 0; > + > next_pc = arm_get_next_pc (frame, get_frame_pc (frame)); > > /* The Linux kernel offers some user-mode helpers in a high page. We can target_can_do_single_step () should be before arm_deal_with_atomic_sequence ...