]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.exp
Automatic Copyright Year update after running gdb/copyright.py
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / ppc64-isa207-atomic-inst.exp
1 # Copyright 2017-2022 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 # This file is part of the gdb testsuite.
17
18 # Test single stepping through POWER8/ISA 2.07 atomic sequences beginning with
19 # a lbarx/lharx/lqarx instruction and ending with a stbcx/sthcx/stqxc
20 # instruction. Note that although lbarx, lharx, stbcx and sthcx instructions
21 # were introduced in ISA 2.06, they were implemented only in POWER8 (ISA 2.07).
22
23
24 if {![istarget "powerpc*"] || ![is_lp64_target]} {
25 untested "skipping powerpc isa 207 atomic sequences test"
26 return
27 }
28
29 standard_testfile .c .S
30
31 if { [prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" \
32 {debug quiet}] } {
33 return -1
34 }
35
36 # The test proper. DISPLACED is true if we should try with displaced
37 # stepping.
38
39 proc do_test { displaced } {
40 global decimal hex
41 global gdb_prompt inferior_exited_re srcfile srcfile2
42
43 if ![runto_main] then {
44 return -1
45 }
46
47 gdb_test_no_output "set displaced-stepping $displaced"
48
49 gdb_breakpoint "test_atomic_sequences" "Breakpoint $decimal at $hex" \
50 "set the breakpoint at the start of the test function"
51
52 gdb_test_multiple "continue" "Continue until lbarx/stbcx start breakpoint" {
53 -re "$inferior_exited_re with code 01.\[\r\n\]+$gdb_prompt $" {
54 unsupported "POWER8/ISA 2.07 atomic instructions not supported."
55 return -1
56 }
57 -re "Continuing.*Breakpoint $decimal.*$gdb_prompt $" {
58 pass "continue until test_atomic_sequences function"
59 }
60 }
61
62 set bp1 [gdb_get_line_number "lbarx" "$srcfile2"]
63 gdb_breakpoint "$bp1" "Breakpoint $decimal at $hex" \
64 "set the breakpoint at the start of the lbarx/stbcx sequence"
65
66 set bp2 [gdb_get_line_number "lharx" "$srcfile2"]
67 gdb_breakpoint "$bp2" "Breakpoint $decimal at $hex" \
68 "set the breakpoint at the start of the lharx/sthcx sequence"
69
70 set bp3 [gdb_get_line_number "lqarx" "$srcfile2"]
71 gdb_breakpoint "$bp3" "Breakpoint $decimal at $hex" \
72 "set the breakpoint at the start of the lqarx/stqcx sequence"
73
74 gdb_test continue "Continuing.*Breakpoint $decimal.*" \
75 "continue until lbarx/stbcx start breakpoint"
76
77 gdb_test nexti "bne.*1b" \
78 "step through the lbarx/stbcx sequence"
79
80 gdb_test continue "Continuing.*Breakpoint $decimal.*" \
81 "continue until lharx/sthcx start breakpoint"
82
83 gdb_test nexti "bne.*2b" \
84 "step through the lharx/sthcx sequence"
85
86 gdb_test continue "Continuing.*Breakpoint $decimal.*" \
87 "continue until ldqrx/stqcx start breakpoint"
88
89 gdb_test nexti "bne.*3b" \
90 "step through the lqarx/stqcx sequence"
91 }
92
93 foreach displaced { "off" "on" } {
94 with_test_prefix "displaced=$displaced" {
95 do_test $displaced
96 }
97 }