]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/endian.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / endian.exp
1 # Copyright (C) 2018-2024 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 # Test automatic endianness selection.
17
18 standard_testfile
19
20 set en_auto "The target endianness is set automatically"
21 set en_set "The target is set to"
22
23 clean_restart
24
25 # First check that the automatic endianness is updated
26 # with the `set endian' command.
27 gdb_test "set endian auto" \
28 "$en_auto \\\(currently \(\?:big\|little\) endian\\\)\\." \
29 "default target endianness"
30 gdb_test "set endian big" "$en_set big endian\\." \
31 "set target endianness"
32 gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)\\." \
33 "auto target endianness"
34 gdb_test "set endian little" "$en_set little endian\\." \
35 "set target endianness little"
36 gdb_test "set endian auto" "$en_auto \\\(currently little endian\\\)\\." \
37 "auto target endianness little"
38 gdb_test "set endian big" "$en_set big endian\\." \
39 "set target endianness big"
40 gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)\\." \
41 "auto target endianness big"
42
43 if { [build_executable ${testfile}.exp $testfile] } {
44 untested "failed to compile"
45 return
46 }
47
48 gdb_file_cmd $binfile
49
50 set test "get target endianness"
51 if { [gdb_test_multiple "show endian" "$test" {
52 -re "$en_auto \\\(currently \(big\|little\) endian\\\)\\..*$gdb_prompt" {
53 set endian $expect_out(1,string)
54 pass "$test"
55 }
56 }] } {
57 return
58 }
59
60 # Now check that the automatic endianness is updated
61 # according to the executable selected.
62 gdb_unload "unload 1"
63 gdb_test "set endian big" "$en_set big endian\\." \
64 "override target endianness big"
65 gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)\\." \
66 "override auto target endianness big"
67
68 gdb_file_cmd $binfile
69 gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
70 "previously big default executable endianness"
71
72 gdb_unload "unload 2"
73 gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
74 "previously big default no executable endianness"
75 gdb_test "set endian little" "$en_set little endian\\." \
76 "override target endianness little"
77 gdb_test "set endian auto" "$en_auto \\\(currently little endian\\\)\\." \
78 "override auto target endianness little"
79
80 gdb_file_cmd $binfile
81 gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
82 "previously little default executable endianness"
83
84 gdb_unload "unload 3"
85 gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)\\." \
86 "previously little default no executable endianness"