]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/i386-pkru.exp
Update copyright year range in all GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-pkru.exp
CommitLineData
3666a048 1# Copyright 2015-2021 Free Software Foundation, Inc.
51547df6
MS
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16standard_testfile
17
18if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
19 unsupported "skipping x86 PKEYS tests."
20 return
21}
22
23set comp_flags "-I${srcdir}/../nat/"
24
25if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
26 [list debug additional_flags=${comp_flags}]] } {
1512d3b7 27 untested "failed to compile x86 PKEYS test."
51547df6
MS
28 return -1
29}
30
31if ![runto_main] {
32 untested "could not run to main"
33 return -1
34}
35
36set supports_pkru 0
37set test "probe PKRU support"
38gdb_test_multiple "print have_pkru()" $test {
39 -re ".. = 1\r\n$gdb_prompt $" {
40 pass $test
41 set supports_pkru 1
42 }
25dcbff6
PA
43 -re ".. = 0\r\n$gdb_prompt $" {
44 pass $test
45 }
51547df6
MS
46}
47
48if { !$supports_pkru } {
49 unsupported "processor does not support protection key feature."
50 return
51}
52
53# Test pkru register at startup
54# set test_string "0"
55
56gdb_test "print \$pkru" "= 0" "pkru register"
57
58# Read values from pseudo registers.
59gdb_breakpoint [ gdb_get_line_number "break here 1" ]
60gdb_continue_to_breakpoint "break here 1" ".*break here 1.*"
61
62gdb_test "info register pkru" ".*pkru.*0x12345678.*" "read pkru register"
63gdb_test "print /x \$pkru = 0x44444444" "= 0x44444444" "set pkru value"
64gdb_test "info register pkru" ".*pkru.*0x44444444.*" "read value after setting value"
65
66gdb_breakpoint [ gdb_get_line_number "break here 2" ]
67gdb_continue_to_breakpoint "break here 2" ".*break here 2.*"
68
69gdb_test "print /x rd_value" "= 0x44444444" "variable after reading pkru"