]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2008-2024 Free Software Foundation, Inc. |
1bc0d95e CL |
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 | # Test instruction record for PowerPC, ISA 2.06. | |
17 | # | |
18 | ||
19 | # The basic flow of the record tests are: | |
20 | # 1) Stop before executing the instructions of interest. Record | |
21 | # the initial value of the registers that the instruction will | |
22 | # change, i.e. the destination register. | |
23 | # 2) Execute the instructions. Record the new value of the | |
24 | # registers that changed. | |
25 | # 3) Reverse the direction of the execution and execute back to | |
26 | # just before the instructions of interest. Record the final | |
27 | # value of the registers of interest. | |
28 | # 4) Check that the initial and new values of the registers are | |
29 | # different, i.e. the instruction changed the registers as expected. | |
30 | # 5) Check that the initial and final values of the registers are | |
31 | # the same, i.e. gdb record restored the registers to their | |
32 | # original values. | |
33 | ||
34 | standard_testfile | |
35 | ||
36 | set gen_src record_test_isa_2_06.c | |
37 | set executable record_test_isa_2_06 | |
38 | set options [list debug] | |
39 | ||
73c06197 | 40 | require {istarget "powerpc*"} |
1bc0d95e | 41 | |
bde43e8d | 42 | if {[build_executable "failed to prepare" $executable $srcfile $options] == -1} { |
1bc0d95e CL |
43 | return -1 |
44 | } | |
45 | ||
46 | clean_restart $executable | |
47 | ||
bde43e8d | 48 | if {![runto_main]} { |
1bc0d95e | 49 | untested "could not run to main" |
cdd42066 | 50 | return |
1bc0d95e CL |
51 | } |
52 | ||
53 | gdb_test_no_output "record" | |
54 | ||
55 | ###### Test: Test an ISA 2.06 load (lxvd2x) and square root instruction | |
56 | ###### (xvsqrtsp). The load instruction will load vs1. The sqrt instruction | |
57 | ###### will put its result into vs0. | |
58 | ||
59 | set stop1 [gdb_get_line_number "stop 1"] | |
60 | set stop2 [gdb_get_line_number "stop 2"] | |
61 | ||
62 | gdb_test "break $stop1" ".*Breakpoint .*" "about to execute test" | |
63 | gdb_test "continue" ".*Breakpoint .*" "at stop 1" | |
64 | ||
65 | # Record the initial values in vs0, vs1. | |
66 | set vs0_initial [capture_command_output "info register vs0" ""] | |
67 | set vs1_initial [capture_command_output "info register vs1" ""] | |
68 | ||
69 | gdb_test "break $stop2" ".*Breakpoint .*" "executed lxvd2x, xvsqrtsp" | |
70 | gdb_test "continue" ".*Breakpoint .*" "at stop 2" | |
71 | ||
72 | # Record the new values of vs0 and vs1. | |
73 | set vs0_new [capture_command_output "info register vs0" ""] | |
74 | set vs1_new [capture_command_output "info register vs1" ""] | |
75 | ||
76 | # Reverse the execution direction. | |
77 | gdb_test_no_output "set exec-direction reverse" | |
78 | gdb_test "break $stop1" ".*Breakpoint .*" "un executed lxvd2x, xvsqrtsp" | |
79 | ||
80 | # Execute in reverse to before the lxvd2x instruction. | |
81 | gdb_test "continue" ".*Breakpoint.*" "at stop 1 in reverse" | |
82 | ||
83 | # Record the final values of vs0, vs1. | |
84 | set vs0_final [capture_command_output "info register vs0" ""] | |
85 | set vs1_final [capture_command_output "info register vs1" ""] | |
86 | ||
87 | # Check initial and new of vs0 are different. | |
88 | gdb_assert [string compare $vs0_initial $vs1_new] \ | |
89 | "check vs0 initial versus vs0 new" | |
90 | ||
91 | # Check initial and new of vs1 are different. | |
92 | gdb_assert [string compare $vs1_initial $vs1_new] \ | |
93 | "check vs0 initial versus vs1 new" | |
94 | ||
95 | # Check initial and final are the same. | |
96 | gdb_assert ![string compare $vs0_initial $vs0_final] \ | |
97 | "check vs0 initial versus vs0 final" | |
98 | ||
99 | # Check initial and final are the same. | |
100 | gdb_assert ![string compare $vs1_initial $vs1_final] \ | |
101 | "check vs1 initial versus vs1 final" | |
102 |