From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24475 invoked by alias); 4 Sep 2011 13:54:15 -0000 Received: (qmail 24467 invoked by uid 22791); 4 Sep 2011 13:54:14 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 04 Sep 2011 13:54:00 +0000 Received: (qmail 19490 invoked from network); 4 Sep 2011 13:53:58 -0000 Received: from unknown (HELO ?192.168.0.101?) (yao@127.0.0.2) by mail.codesourcery.com with ESMTPA; 4 Sep 2011 13:53:58 -0000 Message-ID: <4E63830D.9060604@codesourcery.com> Date: Sun, 04 Sep 2011 14:19:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0.1) Gecko/20110830 Thunderbird/6.0.1 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [patch] Use displaced stepping regardless of SW single step Content-Type: multipart/mixed; boundary="------------000609050302040506010904" X-IsSubscribed: yes 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 X-SW-Source: 2011-09/txt/msg00061.txt.bz2 This is a multi-part message in MIME format. --------------000609050302040506010904 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Content-length: 2222 Hi, I noticed that I can only do displaced stepping in first `si`, and in the following `si', displaced stepping is not used at all, as shown below, (gdb) set displaced-stepping on (gdb) set debug displaced 1 (gdb) si During symbol reading, incomplete CFI data; unspecified registers (e.g., rax) at 0x400565. displaced: stepping process 32472 now displaced: saved 0x400482: 49 89 d1 5e 48 89 e2 48 83 e4 f0 50 54 49 c7 c0 displaced: copy 0x400564->0x400482: 55 48 89 e5 48 83 ec 10 e8 ff fe ff ff 89 45 fc displaced: displaced pc to 0x400482 displaced: run 0x400482: 55 48 89 e5 displaced: restored 0x400482 displaced: fixup (0x400564, 0x400482), insn = 0x55 0x48 ... displaced: relocated %rip from 0x400483 to 0x400565 0x0000000000400565 24 { (gdb) si 0x0000000000400568 24 { (gdb) si 27 pid = fork (); I don't think that is the expected behavior of gdb, so there may be something wrong in gdb. The displaced stepping is controlled by this condition check, if (use_displaced_stepping (gdbarch) && (tp->control.trap_expected || (step && gdbarch_software_single_step_p (gdbarch))) && sig == TARGET_SIGNAL_0 && !current_inferior ()->waiting_for_vfork_done) This line of checking software_single_step_p was introduced in this patch http://cygwin.com/ml/gdb-patches/2009-07/msg00395.html (resume): If this is a software single-stepping arch, and displaced-stepping is enabled, use it for all single-step requests. I don't figure out the reason we need to check software_single_step_p here. We could do displaced stepping for targets support software single step, and we could do displaced stepping for HW single step as well. Regression tested on x86_64-unknown-linux-gnu with displaced stepping "auto" and "on" respectively. No extra failures, but there are two PASSes changed to KFAILs, -PASS: gdb.cp/annota2.exp: watch triggered on a.x +KFAIL: gdb.cp/annota2.exp: watch triggered on a.x (PRMS: gdb/38) -PASS: gdb.cp/annota3.exp: watch triggered on a.x +KFAIL: gdb.cp/annota3.exp: watch triggered on a.x (PRMS: gdb/38) I am not familiar with this case, so can't tell this is caused by my patch. -- Yao (齐尧) --------------000609050302040506010904 Content-Type: text/x-patch; name="0015-use-disp-step-regardless-of-sw-single-step.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0015-use-disp-step-regardless-of-sw-single-step.patch" Content-length: 775 gdb/ * infrun.c (resume): Use displaced stepping regardless of supporting software single step. --- gdb/infrun.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index bfef09c..bc4ca27 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1725,8 +1725,7 @@ a command like `return' or `jump' to continue execution.")); event, displaced stepping breaks the vfork child similarly as single step software breakpoint. */ if (use_displaced_stepping (gdbarch) - && (tp->control.trap_expected - || (step && gdbarch_software_single_step_p (gdbarch))) + && (tp->control.trap_expected || step)) && sig == TARGET_SIGNAL_0 && !current_inferior ()->waiting_for_vfork_done) { -- 1.7.0.4 --------------000609050302040506010904--