]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - 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
1 # Copyright 2015-2018 Free Software Foundation, Inc.
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
16 standard_testfile
17
18 if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
19 unsupported "skipping x86 PKEYS tests."
20 return
21 }
22
23 set comp_flags "-I${srcdir}/../nat/"
24
25 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
26 [list debug additional_flags=${comp_flags}]] } {
27 untested "failed to compile x86 PKEYS test.
28 return -1
29 }
30
31 if ![runto_main] {
32 untested "could not run to main"
33 return -1
34 }
35
36 set supports_pkru 0
37 set test "probe PKRU support"
38 gdb_test_multiple "print have_pkru()" $test {
39 -re ".. = 1\r\n$gdb_prompt $" {
40 pass $test
41 set supports_pkru 1
42 }
43 -re ".. = 0\r\n$gdb_prompt $" {
44 pass $test
45 }
46 }
47
48 if { !$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
56 gdb_test "print \$pkru" "= 0" "pkru register"
57
58 # Read values from pseudo registers.
59 gdb_breakpoint [ gdb_get_line_number "break here 1" ]
60 gdb_continue_to_breakpoint "break here 1" ".*break here 1.*"
61
62 gdb_test "info register pkru" ".*pkru.*0x12345678.*" "read pkru register"
63 gdb_test "print /x \$pkru = 0x44444444" "= 0x44444444" "set pkru value"
64 gdb_test "info register pkru" ".*pkru.*0x44444444.*" "read value after setting value"
65
66 gdb_breakpoint [ gdb_get_line_number "break here 2" ]
67 gdb_continue_to_breakpoint "break here 2" ".*break here 2.*"
68
69 gdb_test "print /x rd_value" "= 0x44444444" "variable after reading pkru"