From patchwork Fri Feb 19 14:36:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 10928 Received: (qmail 109526 invoked by alias); 19 Feb 2016 14:36:57 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 109275 invoked by uid 89); 19 Feb 2016 14:36:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=1367, 15, 6, 257, displaced X-HELO: mail-pa0-f48.google.com Received: from mail-pa0-f48.google.com (HELO mail-pa0-f48.google.com) (209.85.220.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 19 Feb 2016 14:36:46 +0000 Received: by mail-pa0-f48.google.com with SMTP id yy13so51286698pab.3 for ; Fri, 19 Feb 2016 06:36:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=8FDmlsbmHdG9FwZXFFORJD+Q0a5OZkuH+aYHxNFtJHU=; b=IeCMf5GJhzliCSdhVDjlOux0dLAsyTey0oMNKjSlnXH4R8gSdb0S1EJK9oabpvmocH CATyzdCMYcFNfpCj02Yc6jLTByYWvgsj2joh6rnjhnunhK5ggNf9dDXHPThdlwVev/FI FipDfM+akry/oMMzmsRYr0stTw/wtBBLFPQAlV7Hjhgvk0MDOZGjgBFRL4BPjG0rbJkw 2n5COO/1Qxh7z5RIkGDguMyUfpQ80LeY1i13/7IXhQfzM3UdQA0DC3Uaywq1b4maEiUi shXM0n3D0t0j4w81J5Dzl9kl7HRbFqh6C3mFH/yDL7bAfYWW+RrbQWYz7CtJS9mGGtoI SFkQ== X-Gm-Message-State: AG10YORmO1T1978EWVLbF1Ca4b/pMNep6OlhOc7S9oAr5wSd2UjXFWOjwFC6nxPesoUqJg== X-Received: by 10.66.254.168 with SMTP id aj8mr18684985pad.18.1455892605008; Fri, 19 Feb 2016 06:36:45 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id kq3sm18452546pab.24.2016.02.19.06.36.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Feb 2016 06:36:44 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 4/8] Step over syscalll insn with disp-step on and off Date: Fri, 19 Feb 2016 14:36:30 +0000 Message-Id: <1455892594-2294-5-git-send-email-yao.qi@linaro.org> In-Reply-To: <1455892594-2294-1-git-send-email-yao.qi@linaro.org> References: <1455892594-2294-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes disp-step-syscall.exp was added to test displaced stepping over syscall instructions, in which we set breakpoint on syscall instruction, and step over it. In fact, we can extend the test to non-displaced-stepping case. This patch wraps the test with displaced stepping on and off. Note that the indentation and format isn't adjusted here to make this patch easy to read. The following patch will fix the format separately. gdb/testsuite: 2016-02-19 Yao Qi * gdb.base/disp-step-fork.c (main): Increase loop boundary. * gdb.base/disp-step-vfork.c (main): Likewise. * gdb.base/disp-step-syscall.exp: Don't invoke support_displaced_stepping. (disp_step_cross_syscall): Test with displaced stepping off and on if supported. --- gdb/testsuite/gdb.base/disp-step-fork.c | 2 +- gdb/testsuite/gdb.base/disp-step-syscall.exp | 17 +++++++++++------ gdb/testsuite/gdb.base/disp-step-vfork.c | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/gdb/testsuite/gdb.base/disp-step-fork.c b/gdb/testsuite/gdb.base/disp-step-fork.c index c8f2cf9..d8d602f 100644 --- a/gdb/testsuite/gdb.base/disp-step-fork.c +++ b/gdb/testsuite/gdb.base/disp-step-fork.c @@ -26,7 +26,7 @@ main (void) { int i, pid; - for (i = 0; i < 3; i++) + for (i = 0; i < 4; i++) { pid = fork (); if (pid == 0) /* child */ diff --git a/gdb/testsuite/gdb.base/disp-step-syscall.exp b/gdb/testsuite/gdb.base/disp-step-syscall.exp index aba5db8..9e43fbb 100644 --- a/gdb/testsuite/gdb.base/disp-step-syscall.exp +++ b/gdb/testsuite/gdb.base/disp-step-syscall.exp @@ -15,11 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if { ![support_displaced_stepping] } { - unsupported "displaced stepping" - return -1 -} - set syscall_insn "" # Define the syscall instruction for each target. @@ -119,6 +114,14 @@ proc disp_step_cross_syscall { syscall } { } set syscall_insn_next_addr [get_hexadecimal_valueof "\$pc" "0"] + set disp_step_opts { "off" } + if { [support_displaced_stepping] } { + lappend disp_step_opts "on" + } + + foreach displaced $disp_step_opts { + with_test_prefix "displaced $displaced" { + gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, (.* in |__libc_|)$syscall \\(\\).*" \ "continue to $syscall (3rd time)" @@ -136,7 +139,7 @@ proc disp_step_cross_syscall { syscall } { gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, .*" \ "continue to syscall insn $syscall" - gdb_test_no_output "set displaced-stepping on" + gdb_test_no_output "set displaced-stepping $displaced" # Check the address of next instruction of syscall. if {[gdb_test "stepi" "x/i .*=>.*" "single step over $syscall"] != 0} { @@ -147,6 +150,8 @@ proc disp_step_cross_syscall { syscall } { # Delete breakpoint syscall insns to avoid interference to other syscalls. gdb_test_no_output "delete $syscall_insn_bp" "delete break $syscall insn" + } + } gdb_test_no_output "delete $syscall_bp" "delete break $syscall" diff --git a/gdb/testsuite/gdb.base/disp-step-vfork.c b/gdb/testsuite/gdb.base/disp-step-vfork.c index 0ae725b..17bef55 100644 --- a/gdb/testsuite/gdb.base/disp-step-vfork.c +++ b/gdb/testsuite/gdb.base/disp-step-vfork.c @@ -25,7 +25,7 @@ main (void) { int i, pid; - for (i = 0; i < 3; i++) + for (i = 0; i < 4; i++) { pid = vfork (); if (pid == -1)