public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
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:00 -0000	[thread overview]
Message-ID: <1455892594-2294-5-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1455892594-2294-1-git-send-email-yao.qi@linaro.org>

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  <yao.qi@linaro.org>

	* 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 <http://www.gnu.org/licenses/>.
 
-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)
-- 
1.9.1

  reply	other threads:[~2016-02-19 14:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-19 14:36 [PATCH 0/8] Leave child suspended when step over parent Yao Qi
2016-02-19 14:36 ` Yao Qi [this message]
2016-02-25 17:27   ` [PATCH 4/8] Step over syscalll insn with disp-step on and off Pedro Alves
2016-02-19 14:36 ` [PATCH 2/8] Refactor gdb.base/disp-step-syscall.exp for general step over test Yao Qi
2016-02-19 14:36 ` [PATCH 3/8] Use loop in disp-step-fork.c and disp-step-vfork.c Yao Qi
2016-02-25 17:28   ` Pedro Alves
2016-02-19 14:36 ` [PATCH 5/8] Step over fork/vfork syscall insn in gdbserver Yao Qi
2016-02-23 20:28   ` Luis Machado
2016-02-25 17:31   ` Pedro Alves
2016-02-19 14:37 ` [PATCH 6/8] Reformat disp-step-syscall.exp Yao Qi
2016-02-19 14:37 ` [PATCH 1/8] [GDBserver] Leave child suspended when step over parent Yao Qi
2016-02-23 20:23   ` Luis Machado
2016-02-25 17:12   ` Pedro Alves
2016-02-19 14:37 ` [PATCH 8/8] New test about step over clone syscall Yao Qi
2016-02-23 20:31   ` Luis Machado
2016-02-25 17:43   ` Pedro Alves
2016-02-25 17:43   ` Pedro Alves
2016-02-19 14:37 ` [PATCH 7/8] Rename disp-step-syscall.exp to step-over-syscall.exp Yao Qi
2016-02-25 17:32   ` Pedro Alves
2016-02-26 14:03 ` [PATCH 0/7 V2] Leave child suspended when step over parent Yao Qi
2016-02-26 14:04   ` [PATCH 5/7] Rename disp-step-syscall.exp to step-over-syscall.exp Yao Qi
2016-02-26 14:04   ` [PATCH 7/7] New test about step over clone syscall Yao Qi
2016-02-26 14:04   ` [PATCH 2/7] Refactor gdb.base/disp-step-syscall.exp for general step over test Yao Qi
2016-02-26 14:04   ` [PATCH 3/7] Step over syscalll insn with disp-step on and off Yao Qi
2016-02-26 14:04   ` [PATCH 4/7] Step over fork/vfork syscall insn in gdbserver Yao Qi
2016-02-26 15:02     ` Luis Machado
2016-02-26 15:50       ` Yao Qi
2016-02-26 14:04   ` [PATCH 6/7] Reformat gdb.base/step-over-syscall.exp Yao Qi
2016-02-26 14:04   ` [PATCH 1/7] [GDBserver] Leave child suspended when step over parent Yao Qi
2016-03-03  9:21   ` [PATCH 0/7 V2] " Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455892594-2294-5-git-send-email-yao.qi@linaro.org \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).