aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.arch/arc-tdesc-cpu.exp
blob: 25ae821829e383b623fe16473e5b3c3e2d1b444a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Copyright 2017-2019 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

if {[gdb_skip_xml_test]} {
    unsupported "arc-tdesc-cpu.exp"
    return -1
}

gdb_start

# Test whether it is OK to have `arc:HS` in the target description
# architecture.  `HS` is a valid BFD architecture name, however the
# disassembler doesn't accept it as a CPU name.  This test checks that GDB
# doesn't pass architecture from the target description directly to the
# disassembler and instead uses one of the valid CPU names.

gdb_test \
    "set tdesc filename $srcdir/$subdir/arc-tdesc-cpu.xml" \
    ".*" \
    "set tdesc filename \$srcdir/$subdir/arc-tdesc-cpu.xml"

# An error message is emitted by the disassembler, therefore it is not shown
# unless the disassembler is actually invoked.  Address "0" is not invalid,
# but that doesn't matter for this test case, because it is only the
# disassembler error message that is interesting.
set cmd "x /i 0"
set msg "setting HS architecture"
gdb_test_multiple $cmd $msg {
    -re "Unrecognised disassembler CPU option: HS.*$gdb_prompt" {
	fail $msg
    }
    -re "^$cmd\r\n\\s*$hex:\\s+Cannot access memory at address $hex\r\n$gdb_prompt"
    {
	pass $msg
    }
}