]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/memtag.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / memtag.exp
1 # Copyright 2021-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 # Smoke testing for the various memory tagging commands in GDB.
17
18 set u_msg "Memory tagging not supported or disabled by the current architecture\."
19
20 standard_testfile
21 if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
22 return -1
23 }
24
25 if {[target_info gdb_protocol] == "extended-remote"} {
26 # Make sure we're disconnected, in case we're testing with an
27 # extended-remote board, therefore already connected.
28 gdb_test "disconnect" ".*"
29 }
30
31 # Test commands without running the program.
32 with_test_prefix "before program execution" {
33 # These commands should all fails without a running program.
34 foreach subcmd {"with-logical-tag" "print-logical-tag" \
35 "set-allocation-tag" "print-allocation-tag" "check"} {
36 gdb_test "memory-tag $subcmd" $u_msg
37 }
38 }
39
40 clean_restart $testfile
41
42 if ![runto_main] {
43 return -1
44 }
45
46 # Targets that don't support memory tagging should not execute the
47 # runtime memory tagging tests.
48 if {![supports_memtag]} {
49 unsupported "memory tagging unsupported"
50 return -1
51 }
52
53 # With the program running, try to use the memory tagging commands.
54 with_test_prefix "during program execution" {
55 set msg "Argument required \\(address or pointer\\)\."
56
57 # Test the various memory-tag commands again.
58 gdb_test "memory-tag print-logical-tag" $msg
59 gdb_test "memory-tag print-allocation-tag" $msg
60 gdb_test "memory-tag with-logical-tag" \
61 "Argument required \\(<address> <tag>\\)\."
62 gdb_test "memory-tag set-allocation-tag" \
63 "Argument required \\(<starting address> <length> <tag bytes>\\)\."
64 gdb_test "memory-tag check" $msg
65 }