diff options
Diffstat (limited to 'gdb/testsuite/gdb.btrace/stop.exp')
-rw-r--r-- | gdb/testsuite/gdb.btrace/stop.exp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.btrace/stop.exp b/gdb/testsuite/gdb.btrace/stop.exp new file mode 100644 index 00000000000..074bab8a9c2 --- /dev/null +++ b/gdb/testsuite/gdb.btrace/stop.exp @@ -0,0 +1,70 @@ +# This testcase is part of GDB, the GNU debugger. +# +# Copyright 2016 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/>. + +# check for btrace support +if { [skip_btrace_tests] } { return -1 } + +standard_testfile record_goto.c + +# start inferior +if [prepare_for_testing $testfile.exp $testfile $srcfile] { + return -1 +} + +# we use the list command to check the current source location +gdb_test "set listsize 1" + +if ![runto_main] { + return -1 +} + +# trace the call to the test function +gdb_test_no_output "record btrace" "move: enable" +gdb_test "next" ".*main\.3.*" "move: trace" + +# move to the beginning of the trace +gdb_test "record goto begin" ".*main\.2.*" "move: navigate" + +# when we stop recording, we move back to the end of the trace +gdb_test "record stop" "main\.3.*Process record is stopped.*" "move: stop" + +# check that we're really there +gdb_test "list" ".*main\.3.*" "move: at end of trace" + +if ![runto_main] { + return -1 +} + +# trace the call to the test function +gdb_test_no_output "record btrace" "already: enable" +gdb_test "next" ".*main\.3.*" "already: trace" + +# we're already at the end so we didn't have to move +gdb_test_multiple "record stop" "already: stop" { + -re "main.*$gdb_prompt $" { + fail "already: stop" + } + -re "Process record is stopped\[^\\\r\\\n\]*\r\n$gdb_prompt $" { + pass "already: stop" + } + -re "$gdb_prompt $" { + fail "already: stop" + } +} + +# check that we're really there +gdb_test "list" ".*main\.3.*" "already: at end of trace" |