Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 08/11] New test case gdb.arch/disp-step-insn-reloc.exp
Date: Wed, 07 Oct 2015 09:26:00 -0000	[thread overview]
Message-ID: <1444209985-15829-9-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1444209985-15829-1-git-send-email-yao.qi@linaro.org>

This patch adds a new test case which uses gdb.arch/insn-reloc.c too
to test displaced stepping.  Nowadays, tests are for x86, x86_64 and
aarch64.

gdb/testsuite:

	* gdb.arch/disp-step-insn-reloc.exp: New test case.
---
 gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp | 84 +++++++++++++++++++++++++
 1 file changed, 84 insertions(+)
 create mode 100644 gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp

diff --git a/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp b/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp
new file mode 100644
index 0000000..2edb258
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp
@@ -0,0 +1,84 @@
+# Copyright 2015 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile insn-reloc.c
+set executable $testfile
+set expfile $testfile.exp
+
+if { ![support_displaced_stepping] } {
+    unsupported "displaced stepping"
+    return -1
+}
+
+# Some targets have leading underscores on assembly symbols.
+set additional_flags [gdb_target_symbol_prefix_flags]
+
+if [prepare_for_testing $expfile $executable $srcfile \
+	[list debug $additional_flags]] {
+    untested "failed to prepare for tests"
+    return -1
+}
+
+if ![runto_main] {
+    fail "Can't run to main"
+    return -1
+}
+
+# Read function name from testcases[N].
+
+proc read_testcase { n } {
+    global gdb_prompt
+
+    set result -1
+    gdb_test_multiple "print testcases\[${n}\]" "read name of test case ${n}" {
+	-re "\[$\].*= .*<(.*)>.*$gdb_prompt $" {
+	    set result $expect_out(1,string)
+	}
+	-re "$gdb_prompt $" { }
+    }
+
+    return $result
+}
+
+set n_testcases [get_integer_valueof "n_testcases" 0]
+if { ${n_testcases} == 0 } {
+    untested "No instruction relocation to test"
+    return 1
+}
+
+# Set a fast tracepoint on each set_point${i} symbol.  There is one for
+# each testcase.
+for { set i 0 } { ${i} < ${n_testcases} } { incr i } {
+    set testcase [read_testcase $i]
+
+    gdb_test "break *set_point$i" "Breakpoint .*" "breakpoint on ${testcase}"
+}
+
+gdb_test "break pass" ".*" ""
+gdb_test "break fail" ".*" ""
+
+gdb_test_no_output "set displaced-stepping on"
+
+# Make sure we have hit the pass breakpoint for each testcase.
+for { set i 0 } { ${i} < ${n_testcases} } { incr i } {
+    set testcase [read_testcase $i]
+
+    with_test_prefix "${testcase}" {
+	gdb_test "continue" ".*Breakpoint \[0-9\]+, .*" \
+	    "go to breakpoint $i"
+
+	gdb_test "continue" ".*Breakpoint \[0-9\]+, pass \(\).*" \
+	    "relocated instruction"
+    }
+}
-- 
1.9.1


  parent reply	other threads:[~2015-10-07  9:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-07  9:26 [PATCH 00/11] Displaced stepping on AArch64 GNU/Linux Yao Qi
2015-10-07  9:26 ` [PATCH 02/11] Move target_read_uint32 out of aarch64_relocate_instruction Yao Qi
2015-10-07  9:26 ` [PATCH 01/11] More tests in gdb.arch/insn-reloc.c Yao Qi
2015-10-07  9:26 ` [PATCH 03/11] Move append_insns out of aarch64_relocate_instruction Yao Qi
2015-10-07  9:26 ` Yao Qi [this message]
2015-10-07  9:26 ` [PATCH 07/11] Support displaced stepping in support_displaced_stepping for aarch64*-*-linux* Yao Qi
2015-10-07  9:26 ` [PATCH 10/11] Rename emit_load_store to aarch64_emit_load_store Yao Qi
2015-10-07  9:27 ` [PATCH 06/11] Support displaced stepping in aarch64-linux Yao Qi
2015-10-13 20:26   ` Sergio Durigan Junior
2015-10-14  8:37     ` Yao Qi
2015-10-07  9:27 ` [PATCH 11/11] Mention the change in NEWS Yao Qi
2015-10-07 15:38   ` Eli Zaretskii
2015-10-07  9:27 ` [PATCH 04/11] Use visitor in aarch64_relocate_instruction Yao Qi
2015-10-07  9:27 ` [PATCH 09/11] Rename emit_insn to aarch64_emit_insn Yao Qi
2015-10-07  9:27 ` [PATCH 05/11] Move aarch64_relocate_instruction to arch/aarch64-insn.c Yao Qi
2015-10-12 10:35 ` [PATCH 00/11] Displaced stepping on AArch64 GNU/Linux 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=1444209985-15829-9-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