summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.arch/sparc-sysstep.exp
blob: 85c5fefccaa1c84ccf038adbf5721e9d087d765c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Copyright 2014-2017 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/>.
#
# This file is part of the gdb testsuite.

# Test single-stepping system call instructions (ta 0x6d) in the two
# cases distinguished by the implementation: sigreturn and all others.
# The sigreturn syscall requires a special analysis since the return
# PC must be extracted from the sigreturn register save area in the
# stack.

if ![istarget "sparc*-*-linux*"] then {
    return 0
}

set testfile sparc-sysstep
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
set opts {}

if {[prepare_for_testing "failed to prepare" ${binfile} $srcfile {additional_flags=-g}]} {
    return -1
}

if ![runto_main] {
    return -1
}

# Watching the global variable will guarantee that gdb will
# single-step through the whole program.

set lno [gdb_get_line_number "sparc-sysstep.exp: last" $srcfile]

gdb_test "break $srcfile:$lno" "Breakpoint \[0-9\] at .*"
gdb_test_no_output "set can-use-hw-watchpoints 0" ""
gdb_test "watch global" "Watchpoint .*: global"
gdb_test "continue" "Continuing.*${srcfile}:${lno}.*"