]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/endian.exp
Update copyright year range in all GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / endian.exp
CommitLineData
3666a048 1# Copyright (C) 2018-2021 Free Software Foundation, Inc.
4b2dfa9d
MR
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 automatic endianness selection.
17
18standard_testfile
19
20set en_auto "The target endianness is set automatically"
f63dcaf8 21set en_set "The target is set to"
4b2dfa9d
MR
22
23clean_restart
24
25# First check that the automatic endianness is updated
26# with the `set endian' command.
27gdb_test "set endian auto" \
f63dcaf8 28 "$en_auto \\\(currently \(\?:big\|little\) endian\\\)\\." \
4b2dfa9d 29 "default target endianness"
f63dcaf8 30gdb_test "set endian big" "$en_set big endian\\." \
4b2dfa9d 31 "set target endianness"
f63dcaf8 32gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)\\." \
4b2dfa9d 33 "auto target endianness"
f63dcaf8 34gdb_test "set endian little" "$en_set little endian\\." \
4b2dfa9d 35 "set target endianness little"
f63dcaf8 36gdb_test "set endian auto" "$en_auto \\\(currently little endian\\\)\\." \
4b2dfa9d 37 "auto target endianness little"
f63dcaf8 38gdb_test "set endian big" "$en_set big endian\\." \
4b2dfa9d 39 "set target endianness big"
f63dcaf8 40gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)\\." \
4b2dfa9d
MR
41 "auto target endianness big"
42
43if { [build_executable ${testfile}.exp $testfile] } {
44 gdb_suppress_entire_file "$pf_prefix cannot build executable"
45}
46
47if { [gdb_file_cmd $binfile] } {
48 gdb_suppress_entire_file "$pf_prefix cannot select executable"
49}
50set test "get target endianness"
51if { [gdb_test_multiple "show endian" "$test" {
f63dcaf8 52 -re "$en_auto \\\(currently \(big\|little\) endian\\\)\\..*$gdb_prompt" {
4b2dfa9d
MR
53 set endian $expect_out(1,string)
54 pass "$test"
55 }
56}] } {
57 gdb_suppress_entire_file \
58 "$pf_prefix cannot determine executable endianness"
59 set endian ""
60}
61
62# Now check that the automatic endianness is updated
63# according to the executable selected.
64if { [gdb_unload] } {
65 gdb_suppress_entire_file "$pf_prefix cannot unselect executable"
66}
f63dcaf8 67gdb_test "set endian big" "$en_set big endian\\." \
4b2dfa9d 68 "override target endianness big"
f63dcaf8 69gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)\\." \
4b2dfa9d
MR
70 "override auto target endianness big"
71if { [gdb_file_cmd $binfile] } {
72 gdb_suppress_entire_file "$pf_prefix cannot select executable"
73}
f63dcaf8 74gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
4b2dfa9d
MR
75 "previously big default executable endianness"
76if { [gdb_unload] } {
77 gdb_suppress_entire_file "$pf_prefix cannot unselect executable"
78}
f63dcaf8 79gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
4b2dfa9d 80 "previously big default no executable endianness"
f63dcaf8 81gdb_test "set endian little" "$en_set little endian\\." \
4b2dfa9d 82 "override target endianness little"
f63dcaf8 83gdb_test "set endian auto" "$en_auto \\\(currently little endian\\\)\\." \
4b2dfa9d
MR
84 "override auto target endianness little"
85if { [gdb_file_cmd $binfile] } {
86 gdb_suppress_entire_file "$pf_prefix cannot select executable"
87}
f63dcaf8 88gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
4b2dfa9d
MR
89 "previously little default executable endianness"
90if { [gdb_unload] } {
91 gdb_suppress_entire_file "$pf_prefix cannot unselect executable"
92}
f63dcaf8 93gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
4b2dfa9d 94 "previously little default no executable endianness"