Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / memtag.exp
CommitLineData
88b9d363 1# Copyright 2021-2022 Free Software Foundation, Inc.
bf0aecce
LM
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
18set u_msg "Memory tagging not supported or disabled by the current architecture\."
19
20standard_testfile
21if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
22 return -1
23}
24
25if {[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.
32with_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
40clean_restart $testfile
41
42if ![runto_main] {
43 untested "could not run to main"
44 return -1
45}
46
47# Targets that don't support memory tagging should not execute the
48# runtime memory tagging tests.
49if {![supports_memtag]} {
50 unsupported "memory tagging unsupported"
51 return -1
52}
53
54# With the program running, try to use the memory tagging commands.
55with_test_prefix "during program execution" {
56 set msg "Argument required \\(address or pointer\\)\."
57
58 # Test the various memory-tag commands again.
59 gdb_test "memory-tag print-logical-tag" $msg
60 gdb_test "memory-tag print-allocation-tag" $msg
61 gdb_test "memory-tag with-logical-tag" \
62 "Argument required \\(<address> <tag>\\)\."
63 gdb_test "memory-tag set-allocation-tag" \
64 "Argument required \\(<starting address> <length> <tag bytes>\\)\."
65 gdb_test "memory-tag check" $msg
66}
This page took 0.069706 seconds and 4 git commands to generate.