Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.arch / powerpc-lnia.exp
CommitLineData
88b9d363 1# Copyright 2021-2022 Free Software Foundation, Inc.
e3d528d7
WS
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 to see if gdb is properly single stepping over the
17# displaced lnia instruction. This test checks that a series
18# of lnia instructions are loading ascending values as expected.
19
20# lnia is an extended mnemonic for the addpcis instruction, which
21# stores the $NIA plus an immediate value into a register.
22#
23# lnia Rx == addpcis Rx,0 == lnia Rx
24# subcis Rx,value == addpcis Rx,-value
25
26if { ![istarget powerpc*-*] } {
27 verbose "Skipping powerpc lnia test."
28 return
29}
30
31set retval 0
32
33standard_testfile .s
34
35if { [prepare_for_testing "failed to prepare" $testfile "$srcfile" \
36 {debug quiet}] } {
37 return -1
38}
39
40if ![runto_main] then {
41 return
42}
43
44set before_pc 0
45set check_pc [get_hexadecimal_valueof "\$pc" "default0"]
46
47# set some breakpoints on the instructions below main().
48set bp1 *$check_pc+4
49set bp2 *$check_pc+12
50set bp3 *$check_pc+16
51gdb_breakpoint $bp1
52gdb_breakpoint $bp2
53gdb_breakpoint $bp3
54
55# single-step through the lnia instructions, and retrieve the
56# register values as we proceed.
57gdb_test "stepi" "" "set r3"
58set check_r3 [get_hexadecimal_valueof "\$r3" "default0"]
59gdb_test "stepi" "" "set r4"
60set check_r4 [get_hexadecimal_valueof "\$r4" "default0"]
61gdb_test "stepi" "" "set r5"
62set check_r5 [get_hexadecimal_valueof "\$r5" "default0"]
63gdb_test "stepi" "" "set r6"
64set check_r6 [get_hexadecimal_valueof "\$r6" "default0"]
65gdb_test "stepi" "" "set r7"
66set check_r7 [get_hexadecimal_valueof "\$r7" "default0"]
67gdb_test "stepi" "" "set r8"
68set check_r8 [get_hexadecimal_valueof "\$r8" "default0"]
69gdb_test "stepi" "" "set r9"
70set check_r9 [get_hexadecimal_valueof "\$r9" "default0"]
71
72# Ensure that our register values are as expected.
73# Specifically that the values loaded by the lnia instruction
74# reflect the value of the PC as if the instruction was
75# not displaced.
76if [expr $check_r3 + 4 != $check_r4] {
77 fail "unexpected value r3+4 != r4 , r3: $check_r3 r4: $check_r4 "
78}
79if [expr $check_r4 + 4 != $check_r5] {
80 fail "unexpected value r4+4 != r5 , r4: $check_r4 r5: $check_r5 "
81}
82if [expr $check_r5 + 4 != $check_r6] {
83 fail "unexpected value r5+4 != r6 , r5: $check_r5 r6: $check_r6 "
84}
85if [expr $check_r6 + 4 != $check_r7] {
86 fail "unexpected value r6+4 != r7 , r6: $check_r6 r7: $check_r7 "
87}
88if [expr $check_r7 + 4 != $check_r8] {
89 fail "unexpected value r7+4 != r8 , r7: $check_r7 r8: $check_r8 "
90}
91if [expr $check_r8 + 4 != $check_r9] {
92 fail "unexpected value r8+4 != r9 , r8: $check_r8 r9: $check_r9 "
93}
94
95gdb_test "info break"
96gdb_test "info register r3 r4 r5 r6 r7 r8 r9"
97gdb_test "disas main"
98
99# Let the inferior store all vector registers in a buffer, then dump
100# the buffer and check it.
101
This page took 0.093533 seconds and 4 git commands to generate.