1# Copyright 2017-2020 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
16if {[gdb_skip_xml_test]} {
17    unsupported "arc-tdesc-cpu.exp"
18    return -1
19}
20
21gdb_start
22
23# Test whether it is OK to have `arc:HS` in the target description
24# architecture.  `HS` is a valid BFD architecture name, however the
25# disassembler doesn't accept it as a CPU name.  This test checks that GDB
26# doesn't pass architecture from the target description directly to the
27# disassembler and instead uses one of the valid CPU names.
28
29gdb_test \
30    "set tdesc filename $srcdir/$subdir/arc-tdesc-cpu.xml" \
31    ".*" \
32    "set tdesc filename \$srcdir/$subdir/arc-tdesc-cpu.xml"
33
34# An error message is emitted by the disassembler, therefore it is not shown
35# unless the disassembler is actually invoked.  Address "0" is not invalid,
36# but that doesn't matter for this test case, because it is only the
37# disassembler error message that is interesting.
38set cmd "x /i 0"
39set msg "setting HS architecture"
40gdb_test_multiple $cmd $msg {
41    -re "Unrecognised disassembler CPU option: HS.*$gdb_prompt" {
42	fail $msg
43    }
44    -re "^$cmd\r\n\\s*$hex:\\s+Cannot access memory at address $hex\r\n$gdb_prompt"
45    {
46	pass $msg
47    }
48}
49