aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog18
-rw-r--r--gdb/testsuite/gdb.btrace/Makefile.in3
-rw-r--r--gdb/testsuite/gdb.btrace/data.c36
-rw-r--r--gdb/testsuite/gdb.btrace/data.exp45
-rw-r--r--gdb/testsuite/gdb.btrace/delta.exp15
-rw-r--r--gdb/testsuite/gdb.btrace/finish.exp59
-rw-r--r--gdb/testsuite/gdb.btrace/multi-thread-step.c53
-rw-r--r--gdb/testsuite/gdb.btrace/multi-thread-step.exp135
-rw-r--r--gdb/testsuite/gdb.btrace/next.exp76
-rw-r--r--gdb/testsuite/gdb.btrace/nexti.exp76
-rw-r--r--gdb/testsuite/gdb.btrace/record_goto.c36
-rw-r--r--gdb/testsuite/gdb.btrace/rn-dl-bind.c37
-rw-r--r--gdb/testsuite/gdb.btrace/rn-dl-bind.exp52
-rw-r--r--gdb/testsuite/gdb.btrace/step.exp89
-rw-r--r--gdb/testsuite/gdb.btrace/stepi.exp93
-rw-r--r--gdb/testsuite/gdb.btrace/tailcall.exp13
16 files changed, 817 insertions, 19 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 9637566..6a9d8c0 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,23 @@
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
+ * gdb.btrace/delta.exp: Check reverse stepi.
+ * gdb.btrace/tailcall.exp: Update. Add stepping tests.
+ * gdb.btrace/finish.exp: New.
+ * gdb.btrace/next.exp: New.
+ * gdb.btrace/nexti.exp: New.
+ * gdb.btrace/record_goto.c: Add comments.
+ * gdb.btrace/step.exp: New.
+ * gdb.btrace/stepi.exp: New.
+ * gdb.btrace/multi-thread-step.c: New.
+ * gdb.btrace/multi-thread-step.exp: New.
+ * gdb.btrace/rn-dl-bind.c: New.
+ * gdb.btrace/rn-dl-bind.exp: New.
+ * gdb.btrace/data.c: New.
+ * gdb.btrace/data.exp: New.
+ * gdb.btrace/Makefile.in (EXECUTABLES): Add new.
+
+2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
+
* gdb.btrace/Makefile.in (EXECUTABLES): Add delta.
* gdb.btrace/exception.exp: Update.
* gdb.btrace/instruction_history.exp: Update.
diff --git a/gdb/testsuite/gdb.btrace/Makefile.in b/gdb/testsuite/gdb.btrace/Makefile.in
index 2ae673a..ec00b59 100644
--- a/gdb/testsuite/gdb.btrace/Makefile.in
+++ b/gdb/testsuite/gdb.btrace/Makefile.in
@@ -2,7 +2,8 @@ VPATH = @srcdir@
srcdir = @srcdir@
EXECUTABLES = enable function_call_history instruction_history tailcall \
- exception unknown_functions record_goto delta
+ exception unknown_functions record_goto delta finish next nexti step \
+ stepi multi-thread-step rn-dl-bind data
MISCELLANEOUS =
diff --git a/gdb/testsuite/gdb.btrace/data.c b/gdb/testsuite/gdb.btrace/data.c
new file mode 100644
index 0000000..7368394
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/data.c
@@ -0,0 +1,36 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2013 Free Software Foundation, Inc.
+
+ Contributed by Intel Corp. <markus.t.metzger@intel.com>
+
+ 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/>. */
+
+volatile static int glob;
+
+void
+test (void)
+{ /* test.1 */
+ volatile static int loc;
+
+ loc += 1; /* test.2 */
+ glob += loc; /* test.3 */
+} /* test.4 */
+
+int
+main (void)
+{ /* main.1 */
+ test (); /* main.2 */
+ return 0; /* main.3 */
+} /* main.4 */
diff --git a/gdb/testsuite/gdb.btrace/data.exp b/gdb/testsuite/gdb.btrace/data.exp
new file mode 100644
index 0000000..d6bc854
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/data.exp
@@ -0,0 +1,45 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corp. <markus.t.metzger@intel.com>
+#
+# 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/>.
+
+# check for btrace support
+if { [skip_btrace_tests] } { return -1 }
+
+# start inferior
+standard_testfile
+if [prepare_for_testing $testfile.exp $testfile $srcfile] {
+ return -1
+}
+if ![runto_main] {
+ return -1
+}
+
+# trace the test code
+gdb_test_no_output "record btrace"
+gdb_test "next" ".*main\.3.*"
+
+# reverse step into test
+gdb_test "reverse-step" ".*test\.4.*"
+
+# we can't read memory while we're replaying
+gdb_test "print glob" "Memory at .* unavailable\."
+gdb_test "print loc" "Memory at .* unavailable\."
+
+# stop replaying and try again
+gdb_test "record goto end"
+gdb_test "print glob" "1"
diff --git a/gdb/testsuite/gdb.btrace/delta.exp b/gdb/testsuite/gdb.btrace/delta.exp
index e606751..5c3505c 100644
--- a/gdb/testsuite/gdb.btrace/delta.exp
+++ b/gdb/testsuite/gdb.btrace/delta.exp
@@ -66,3 +66,18 @@ with_test_prefix "once" {
with_test_prefix "twice" {
check_trace
}
+
+# check that we can reverse-stepi that instruction
+gdb_test "reverse-stepi"
+gdb_test "info record" [join [list \
+ "Active record target: record-btrace" \
+ "Recorded 1 instructions in 1 functions for .*" \
+ "Replay in progress\. At instruction 1\." \
+ ] "\r\n"] "reverse-stepi"
+
+# and back
+gdb_test "stepi"
+gdb_test "info record" [join [list \
+ "Active record target: record-btrace" \
+ "Recorded 1 instructions in 1 functions for .*" \
+ ] "\r\n"] "and back"
diff --git a/gdb/testsuite/gdb.btrace/finish.exp b/gdb/testsuite/gdb.btrace/finish.exp
new file mode 100644
index 0000000..a27082e
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/finish.exp
@@ -0,0 +1,59 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corp. <markus.t.metzger@intel.com>
+#
+# 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/>.
+
+# check for btrace support
+if { [skip_btrace_tests] } { return -1 }
+
+# start inferior
+standard_testfile x86-record_goto.S
+if [prepare_for_testing finish.exp $testfile $srcfile] {
+ return -1
+}
+
+if ![runto_main] {
+ return -1
+}
+
+# trace the call to the test function
+gdb_test_no_output "record btrace"
+gdb_test "next"
+
+proc check_replay_at { insn } {
+ gdb_test "info record" [join [list \
+ "Active record target: record-btrace" \
+ "Recorded 40 instructions in 16 functions for .*" \
+ "Replay in progress\. At instruction $insn\." \
+ ] "\r\n"]
+}
+
+# let's go somewhere where we can finish
+gdb_test "record goto 32" ".*fun1\.1.*"
+with_test_prefix "at 32" { check_replay_at 32 }
+
+gdb_test "finish" ".*fun2\.3.*"
+with_test_prefix "finish into fun2" { check_replay_at 35 }
+
+gdb_test "reverse-finish" ".*fun3\.3.*"
+with_test_prefix "reverse-finish into fun3" { check_replay_at 27 }
+
+gdb_test "finish" ".*fun4\.5.*"
+with_test_prefix "finish into fun4" { check_replay_at 39 }
+
+gdb_test "reverse-finish" ".*main\.2.*"
+with_test_prefix "reverse-finish into main" { check_replay_at 1 }
diff --git a/gdb/testsuite/gdb.btrace/multi-thread-step.c b/gdb/testsuite/gdb.btrace/multi-thread-step.c
new file mode 100644
index 0000000..487565b
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/multi-thread-step.c
@@ -0,0 +1,53 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2013 Free Software Foundation, Inc.
+
+ Contributed by Intel Corp. <markus.t.metzger@intel.com>
+
+ 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/>. */
+
+#include <pthread.h>
+
+static pthread_barrier_t barrier;
+static int global;
+
+static void *
+test (void *arg)
+{
+ pthread_barrier_wait (&barrier);
+
+ global = 42; /* bp.1 */
+
+ pthread_barrier_wait (&barrier);
+
+ global = 42; /* bp.2 */
+
+ return arg;
+}
+
+int
+main (void)
+{
+ pthread_t th;
+
+ pthread_barrier_init (&barrier, NULL, 2);
+ pthread_create (&th, NULL, test, NULL);
+
+ test (NULL);
+
+ pthread_join (th, NULL);
+ pthread_barrier_destroy (&barrier);
+
+ return 0; /* bp.3 */
+}
diff --git a/gdb/testsuite/gdb.btrace/multi-thread-step.exp b/gdb/testsuite/gdb.btrace/multi-thread-step.exp
new file mode 100644
index 0000000..2c108b2
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/multi-thread-step.exp
@@ -0,0 +1,135 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corp. <markus.t.metzger@intel.com>
+#
+# 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/>.
+
+# check for btrace support
+if { [skip_btrace_tests] } { return -1 }
+
+# start inferior
+standard_testfile
+if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" "$binfile" executable {debug}] != "" } {
+ return -1
+}
+clean_restart $testfile
+
+if ![runto_main] {
+ return -1
+}
+
+# set up breakpoints
+set bp_1 [gdb_get_line_number "bp.1" $srcfile]
+set bp_2 [gdb_get_line_number "bp.2" $srcfile]
+set bp_3 [gdb_get_line_number "bp.3" $srcfile]
+
+proc gdb_cont_to_line { line } {
+ gdb_breakpoint $line
+ gdb_continue_to_breakpoint "cont to $line" ".*$line\r\n.*"
+ delete_breakpoints
+}
+
+# trace the code between the two breakpoints
+delete_breakpoints
+gdb_cont_to_line $srcfile:$bp_1
+# make sure GDB knows about the new thread
+gdb_test "info threads" ".*"
+gdb_test_no_output "record btrace"
+gdb_cont_to_line $srcfile:$bp_2
+
+# navigate in the trace history for both threads
+with_test_prefix "navigate" {
+ gdb_test "thread 1" ".*"
+ with_test_prefix "thread 1" {
+ gdb_test "record goto begin" ".*"
+ gdb_test "info record" ".*Replay in progress\. At instruction 1\."
+ }
+ gdb_test "thread 2" ".*"
+ with_test_prefix "thread 2" {
+ gdb_test "record goto begin" ".*"
+ gdb_test "info record" ".*Replay in progress\. At instruction 1\."
+ }
+}
+
+# step both threads
+with_test_prefix "step" {
+ gdb_test "thread 1" ".*"
+ with_test_prefix "thread 1" {
+ gdb_test "info record" ".*Replay in progress\. At instruction 1\."
+ gdb_test "stepi" ".*"
+ gdb_test "info record" ".*Replay in progress\. At instruction 2\."
+ }
+ gdb_test "thread 2" ".*"
+ with_test_prefix "thread 2" {
+ gdb_test "info record" ".*Replay in progress\. At instruction 1\."
+ gdb_test "stepi" ".*"
+ gdb_test "info record" ".*Replay in progress\. At instruction 2\."
+ }
+}
+
+# run to the end of the history for both threads
+with_test_prefix "cont" {
+ gdb_test "thread 1" ".*"
+ with_test_prefix "thread 1" {
+ gdb_test "info record" ".*Replay in progress\. At instruction 2\."
+ gdb_test "continue" "No more reverse-execution history.*"
+ }
+ gdb_test "thread 2" ".*"
+ with_test_prefix "thread 2" {
+ gdb_test "info record" ".*Replay in progress\. At instruction 2\."
+ gdb_test "continue" "No more reverse-execution history.*"
+ }
+}
+
+# reverse-step both threads
+with_test_prefix "reverse-step" {
+ gdb_test "thread 1" ".*"
+ with_test_prefix "thread 1" {
+ gdb_test "reverse-stepi" ".*"
+ gdb_test "info record" ".*Replay in progress\..*"
+ }
+ gdb_test "thread 2" ".*"
+ with_test_prefix "thread 2" {
+ gdb_test "reverse-stepi" ".*"
+ gdb_test "info record" ".*Replay in progress\..*"
+ }
+}
+
+# both threads are still replaying
+with_test_prefix "check" {
+ gdb_test "thread 1" ".*"
+ with_test_prefix "thread 1" {
+ gdb_test "info record" ".*Replay in progress\..*"
+ }
+ gdb_test "thread 2" ".*"
+ with_test_prefix "thread 2" {
+ gdb_test "info record" ".*Replay in progress\..*"
+ }
+}
+
+# navigate back into the history for thread 1 and continue thread 2
+with_test_prefix "cont" {
+ gdb_test "thread 1" ".*"
+ with_test_prefix "thread 1" {
+ gdb_test "record goto begin" ".*"
+ gdb_test "info record" ".*Replay in progress\. At instruction 1\."
+ }
+ gdb_test "thread 2" ".*"
+ with_test_prefix "thread 2" {
+ gdb_test "record goto end" ".*"
+ gdb_cont_to_line $srcfile:$bp_3
+ }
+}
diff --git a/gdb/testsuite/gdb.btrace/next.exp b/gdb/testsuite/gdb.btrace/next.exp
new file mode 100644
index 0000000..b39eb79
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/next.exp
@@ -0,0 +1,76 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corp. <markus.t.metzger@intel.com>
+#
+# 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/>.
+
+# check for btrace support
+if { [skip_btrace_tests] } { return -1 }
+
+# start inferior
+standard_testfile x86-record_goto.S
+if [prepare_for_testing next.exp $testfile $srcfile] {
+ return -1
+}
+
+if ![runto_main] {
+ return -1
+}
+
+# trace the call to the test function
+gdb_test_no_output "record btrace"
+gdb_test "next"
+
+proc check_replay_at { insn } {
+ gdb_test "info record" [join [list \
+ "Active record target: record-btrace" \
+ "Recorded 40 instructions in 16 functions for .*" \
+ "Replay in progress\. At instruction $insn\." \
+ ] "\r\n"]
+}
+
+# we start with stepping to make sure that the trace is fetched automatically
+# the call is outside of our trace
+gdb_test "reverse-next" ".*main\.2.*"
+with_test_prefix "reverse-next - 1" { check_replay_at 1 }
+
+# we can't reverse-step any further
+gdb_test "reverse-next" "No more reverse-execution history\.\r\n.*main\.2.*"
+with_test_prefix "reverse-next - 2" { check_replay_at 1 }
+
+# but we can step back again
+gdb_test "next" ".*main\.3.*"
+gdb_test "info record" [join [list \
+ "Active record target: record-btrace" \
+ "Recorded 40 instructions in 16 functions for \[^\\\r\\\n\]*" \
+ ] "\r\n"] "next back"
+
+# let's go somewhere where we can step some more
+gdb_test "record goto 22" ".*fun3\.2.*"
+with_test_prefix "goto 22" { check_replay_at 22 }
+
+gdb_test "next" ".*fun3\.3.*"
+with_test_prefix "next to 27" { check_replay_at 27 }
+
+gdb_test "next" ".*fun3\.4.*"
+with_test_prefix "next to 37" { check_replay_at 37 }
+
+# and back again
+gdb_test "reverse-next" ".*fun3\.3.*"
+with_test_prefix "reverse-next to 27" { check_replay_at 27 }
+
+gdb_test "reverse-next" ".*fun3\.2.*"
+with_test_prefix "reverse-next to 22" { check_replay_at 22 }
diff --git a/gdb/testsuite/gdb.btrace/nexti.exp b/gdb/testsuite/gdb.btrace/nexti.exp
new file mode 100644
index 0000000..fd94df6
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/nexti.exp
@@ -0,0 +1,76 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corp. <markus.t.metzger@intel.com>
+#
+# 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/>.
+
+# check for btrace support
+if { [skip_btrace_tests] } { return -1 }
+
+# start inferior
+standard_testfile x86-record_goto.S
+if [prepare_for_testing nexti.exp $testfile $srcfile] {
+ return -1
+}
+
+if ![runto_main] {
+ return -1
+}
+
+# trace the call to the test function
+gdb_test_no_output "record btrace"
+gdb_test "next"
+
+proc check_replay_at { insn } {
+ gdb_test "info record" [join [list \
+ "Active record target: record-btrace" \
+ "Recorded 40 instructions in 16 functions for .*" \
+ "Replay in progress\. At instruction $insn\." \
+ ] "\r\n"]
+}
+
+# we start with stepping to make sure that the trace is fetched automatically
+# the call is outside of our trace
+gdb_test "reverse-nexti" ".*main\.2.*"
+with_test_prefix "reverse-nexti - 1" { check_replay_at 1 }
+
+# we can't reverse-step any further
+gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*"
+with_test_prefix "reverse-nexti - 1" { check_replay_at 1 }
+
+# but we can step back again
+gdb_test "nexti" ".*main\.3.*" "next, 1.5"
+gdb_test "info record" [join [list \
+ "Active record target: record-btrace" \
+ "Recorded 40 instructions in 16 functions for \[^\\\r\\\n\]*" \
+ ] "\r\n"] "nexti back"
+
+# let's go somewhere where we can step some more
+gdb_test "record goto 22" ".*fun3\.2.*"
+with_test_prefix "goto 22" { check_replay_at 22 }
+
+gdb_test "nexti" ".*fun3\.3.*"
+with_test_prefix "nexti to 27" { check_replay_at 27 }
+
+gdb_test "nexti" ".*fun3\.4.*"
+with_test_prefix "nexti to 37" { check_replay_at 37 }
+
+# and back again
+gdb_test "reverse-nexti" ".*fun3\.3.*"
+with_test_prefix "reverse-nexti to 27" { check_replay_at 27 }
+
+gdb_test "reverse-nexti" ".*fun3\.2.*"
+with_test_prefix "reverse-nexti to 22" { check_replay_at 22 }
diff --git a/gdb/testsuite/gdb.btrace/record_goto.c b/gdb/testsuite/gdb.btrace/record_goto.c
index 1250708..90537f9 100644
--- a/gdb/testsuite/gdb.btrace/record_goto.c
+++ b/gdb/testsuite/gdb.btrace/record_goto.c
@@ -19,33 +19,33 @@
void
fun1 (void)
-{
-}
+{ /* fun1.1 */
+} /* fun1.2 */
void
fun2 (void)
-{
- fun1 ();
-}
+{ /* fun2.1 */
+ fun1 (); /* fun2.2 */
+} /* fun2.3 */
void
fun3 (void)
-{
- fun1 ();
- fun2 ();
-}
+{ /* fun3.1 */
+ fun1 (); /* fun3.2 */
+ fun2 (); /* fun3.3 */
+} /* fun3.4 */
void
fun4 (void)
-{
- fun1 ();
- fun2 ();
- fun3 ();
-}
+{ /* fun4.1 */
+ fun1 (); /* fun4.2 */
+ fun2 (); /* fun4.3 */
+ fun3 (); /* fun4.4 */
+} /* fun4.5 */
int
main (void)
-{
- fun4 ();
- return 0;
-}
+{ /* main.1 */
+ fun4 (); /* main.2 */
+ return 0; /* main.3 */
+} /* main.4 */
diff --git a/gdb/testsuite/gdb.btrace/rn-dl-bind.c b/gdb/testsuite/gdb.btrace/rn-dl-bind.c
new file mode 100644
index 0000000..4930297
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/rn-dl-bind.c
@@ -0,0 +1,37 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2013 Free Software Foundation, Inc.
+
+ Contributed by Intel Corp. <markus.t.metzger@intel.com>
+
+ 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/>. */
+
+#include <stdlib.h>
+
+int test (void)
+{
+ int ret;
+
+ ret = strtoul ("42", NULL, 10); /* test.1 */
+ return ret; /* test.2 */
+} /* test.3 */
+
+int
+main (void)
+{
+ int ret;
+
+ ret = test (); /* main.1 */
+ return ret; /* main.2 */
+} /* main.3 */
diff --git a/gdb/testsuite/gdb.btrace/rn-dl-bind.exp b/gdb/testsuite/gdb.btrace/rn-dl-bind.exp
new file mode 100644
index 0000000..2f2250a
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/rn-dl-bind.exp
@@ -0,0 +1,52 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corp. <markus.t.metzger@intel.com>
+#
+# 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/>.
+#
+#
+# Test that we can reverse-next over the dynamic linker's symbol
+# lookup code.
+
+# check for btrace support
+if { [skip_btrace_tests] } { return -1 }
+
+# start inferior
+standard_testfile
+if [prepare_for_testing $testfile.exp $testfile $srcfile {c++ debug}] {
+ return -1
+}
+if ![runto_main] {
+ return -1
+}
+
+# trace the code for the call to test
+gdb_test_no_output "record btrace"
+gdb_test "next" ".*main\.2.*"
+
+# just dump the function-call-history to help debugging
+gdb_test_no_output "set record function-call-history-size 0"
+gdb_test "record function-call-history /cli 1" ".*"
+
+# check that we can reverse-next and next
+gdb_test "reverse-next" ".*main\.1.*"
+gdb_test "next" ".*main\.2.*"
+
+# now go into test and try to reverse-next and next over the library call
+gdb_test "reverse-step" ".*test\.3.*"
+gdb_test "reverse-step" ".*test\.2.*"
+gdb_test "reverse-next" ".*test\.1.*"
+gdb_test "next" ".*test\.2.*"
diff --git a/gdb/testsuite/gdb.btrace/step.exp b/gdb/testsuite/gdb.btrace/step.exp
new file mode 100644
index 0000000..7c34d25
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/step.exp
@@ -0,0 +1,89 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corp. <markus.t.metzger@intel.com>
+#
+# 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/>.
+
+# check for btrace support
+if { [skip_btrace_tests] } { return -1 }
+
+# start inferior
+standard_testfile x86-record_goto.S
+if [prepare_for_testing step.exp $testfile $srcfile] {
+ return -1
+}
+
+if ![runto_main] {
+ return -1
+}
+
+# trace the call to the test function
+gdb_test_no_output "record btrace"
+gdb_test "next"
+
+proc check_replay_at { insn } {
+ gdb_test "info record" [join [list \
+ "Active record target: record-btrace" \
+ "Recorded 40 instructions in 16 functions for .*" \
+ "Replay in progress\. At instruction $insn\." \
+ ] "\r\n"]
+}
+
+# let's start by stepping back into the function we just returned from
+gdb_test "reverse-step" ".*fun4\.5.*"
+with_test_prefix "reverse-step to 39" { check_replay_at 39 }
+
+# again
+gdb_test "reverse-step" ".*fun3\.4.*"
+with_test_prefix "reverse-step to 37" { check_replay_at 37 }
+
+# and again
+gdb_test "reverse-step" ".*fun2\.3.*"
+with_test_prefix "reverse-step to 35" { check_replay_at 35 }
+
+# once more
+gdb_test "reverse-step" ".*fun1\.2.*"
+with_test_prefix "reverse-step to 33" { check_replay_at 33 }
+
+# and out again the other side
+gdb_test "reverse-step" ".*fun2\.2.*"
+with_test_prefix "reverse-step to 30" { check_replay_at 30 }
+
+# once again
+gdb_test "reverse-step" ".*fun3\.3.*"
+with_test_prefix "reverse-step to 27" { check_replay_at 27 }
+
+# and back the way we came
+gdb_test "step" ".*fun2\.2.*"
+with_test_prefix "step to 30" { check_replay_at 30 }
+
+gdb_test "step" ".*fun1\.2.*"
+with_test_prefix "step to 33" { check_replay_at 33 }
+
+gdb_test "step" ".*fun2\.3.*"
+with_test_prefix "step to 35" { check_replay_at 35 }
+
+gdb_test "step" ".*fun3\.4.*"
+with_test_prefix "step to 37" { check_replay_at 37 }
+
+gdb_test "step" ".*fun4\.5.*"
+with_test_prefix "step to 39" { check_replay_at 39 }
+
+gdb_test "step" ".*main\.3.*"
+gdb_test "info record" [join [list \
+ "Active record target: record-btrace" \
+ "Recorded 40 instructions in 16 functions for \[^\\\r\\\n\]*" \
+ ] "\r\n"] "step to live"
diff --git a/gdb/testsuite/gdb.btrace/stepi.exp b/gdb/testsuite/gdb.btrace/stepi.exp
new file mode 100644
index 0000000..fb12e28
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/stepi.exp
@@ -0,0 +1,93 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corp. <markus.t.metzger@intel.com>
+#
+# 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/>.
+
+# check for btrace support
+if { [skip_btrace_tests] } { return -1 }
+
+# start inferior
+standard_testfile x86-record_goto.S
+if [prepare_for_testing stepi.exp $testfile $srcfile] {
+ return -1
+}
+
+global gdb_prompt
+
+if ![runto_main] {
+ return -1
+}
+
+proc check_replay_at { insn } {
+ gdb_test "info record" [join [list \
+ "Active record target: record-btrace" \
+ "Recorded 40 instructions in 16 functions for .*" \
+ "Replay in progress\. At instruction $insn\." \
+ ] "\r\n"]
+}
+
+# trace the call to the test function
+gdb_test_no_output "record btrace"
+gdb_test "next"
+
+# we start with stepping to make sure that the trace is fetched automatically
+gdb_test "reverse-stepi" ".*fun4\.5.*"
+gdb_test "reverse-stepi" ".*fun4\.5.*"
+
+# let's check where we are in the trace
+with_test_prefix "reverse-stepi to 39" { check_replay_at 39 }
+
+# let's step forward and check again
+gdb_test "stepi" ".*fun4\.5.*"
+with_test_prefix "stepi to 40" { check_replay_at 40 }
+
+# with the next step, we stop replaying
+gdb_test "stepi" ".*main\.3.*"
+gdb_test "info record" [join [list \
+ "Active record target: record-btrace" \
+ "Recorded 40 instructions in 16 functions for \[^\\\r\\\n\]*" \
+ ] "\r\n"] "stepi to live"
+
+# let's step from a goto position somewhere in the middle
+gdb_test "record goto 22" ".*fun3\.2.*"
+with_test_prefix "goto 22" { check_replay_at 22 }
+
+gdb_test "stepi" ".*fun1\.1.*"
+with_test_prefix "stepi to 23" { check_replay_at 23 }
+
+# and back again
+gdb_test "reverse-stepi" ".*fun3\.2.*"
+gdb_test "reverse-stepi" ".*fun3\.1.*"
+with_test_prefix "reverse-stepi to 21" { check_replay_at 21 }
+
+# let's try to step off the left end
+gdb_test "record goto begin" ".*main\.2.*"
+with_test_prefix "goto begin" { check_replay_at 1 }
+
+gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
+gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
+with_test_prefix "reverse-stepi at begin" { check_replay_at 1 }
+
+# we can step forward, though
+gdb_test "stepi" ".*fun4\.1.*"
+with_test_prefix "stepi to 2" { check_replay_at 2 }
+
+# let's try to step off the left end again
+gdb_test "reverse-stepi" ".*main\.2.*"
+gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
+gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
+with_test_prefix "reverse-stepi at begin" { check_replay_at 1 }
diff --git a/gdb/testsuite/gdb.btrace/tailcall.exp b/gdb/testsuite/gdb.btrace/tailcall.exp
index 23988f2..ce1f053 100644
--- a/gdb/testsuite/gdb.btrace/tailcall.exp
+++ b/gdb/testsuite/gdb.btrace/tailcall.exp
@@ -77,3 +77,16 @@ gdb_test "backtrace" [join [list \
# walk the backtrace
gdb_test "up" "#1\[^\r\n\]*foo \\(\\) at x86-tailcall.c:29\r\n.*" "up to foo"
gdb_test "up" "#2\[^\r\n\]*main \\(\\) at x86-tailcall.c:37\r\n.*" "up to main"
+gdb_test "down" "#1\[^\r\n\]*foo \\(\\) at x86-tailcall.c:29\r\n.*" "down to foo"
+
+# test stepping into and out of tailcalls.
+gdb_test "finish" "\[^\r\n\]*main \\(\\) at x86-tailcall.c:37\r\n.*"
+gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at x86-tailcall.c:24\r\n.*"
+gdb_test "reverse-finish" "\[^\r\n\]*foo \\(\\) at x86-tailcall.c:29\r\n.*"
+gdb_test "reverse-step" "\[^\r\n\]*main \\(\\) at x86-tailcall.c:37\r\n.*"
+gdb_test "next" "\[^\r\n\]*main \\(\\) at x86-tailcall.c:39\r\n.*"
+gdb_test "reverse-next" "\[^\r\n\]*main \\(\\) at x86-tailcall.c:37\r\n.*"
+gdb_test "step" "\[^\r\n\]*foo \\(\\) at x86-tailcall.c:29\r\n.*"
+gdb_test "finish" "\[^\r\n\]*main \\(\\) at x86-tailcall.c:37\r\n.*"
+gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at x86-tailcall.c:24\r\n.*"
+gdb_test "finish" "\[^\r\n\]*main \\(\\) at x86-tailcall.c:37\r\n.*"