1 # Copyright
2021-2023 Free Software Foundation
, Inc.
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.
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.
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
/>.
16 # Smoke testing
for the various memory tagging commands in GDB.
18 set u_msg
"Memory tagging not supported or disabled by the current architecture\."
21 if {[prepare_for_testing
"failed to prepare" ${testfile} ${srcfile}]} {
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" ".*"
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
40 clean_restart $testfile
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"
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\\)\."
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