136 lines
4.0 KiB
Plaintext
136 lines
4.0 KiB
Plaintext
# 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
|
|
}
|
|
}
|