* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o)
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.xml / tdesc-regs.exp
1 # Copyright 2007 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 2 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, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17 if {[gdb_skip_xml_test]} {
18 unsupported "tdesc-regs.exp"
19 return -1
20 }
21
22 gdb_start
23
24 # To test adding registers, we need a core set of registers for this
25 # architecture, or the description will be rejected.
26
27 set core-regs ""
28 switch -glob -- [istarget] {
29 "*arm-*-*" {
30 set core-regs arm-core
31 }
32 "xscale-*-*" {
33 set core-regs arm-core
34 }
35 }
36
37 # If no core registers were specified, assume this target does not
38 # support target-defined registers. Verify that we get a warning if
39 # we try to use them. This not only tests the warning, but also
40 # reminds maintainers to add test support when they add the feature.
41 if {[string equal ${core-regs} ""]} {
42 gdb_test "set tdesc file $srcdir/$subdir/single-reg.xml" \
43 "warning: Target-supplied registers are not supported.*" \
44 "set tdesc file single-reg.xml"
45 unsupported "register tests"
46 return 0
47 }
48
49 # Otherwise, we support both XML and target defined registers.
50
51 # Make sure we reject a description missing standard registers,
52 # like the PC.
53 gdb_test "set tdesc file $srcdir/$subdir/single-reg.xml" \
54 "warning: Architecture rejected target-supplied description" \
55 "set tdesc file single-reg.xml"
56
57 # Copy the core registers into the objdir if necessary, so that they
58 # will be found by <xi:include>.
59 file delete "core-regs.xml"
60 file copy "$srcdir/../features/${core-regs}.xml" "core-regs.xml"
61
62 # Similarly, we need to copy files under test into the objdir.
63 proc load_description { file errmsg } {
64 global srcdir
65 global subdir
66 global gdb_prompt
67
68 file delete "regs.xml"
69 file copy "$srcdir/$subdir/$file" "regs.xml"
70
71 # Anchor the test output, so that error messages are detected.
72 set cmd "set tdesc filename regs.xml"
73 set msg "set tdesc filename $file"
74 set cmd_regex [string_to_regexp $cmd]
75 gdb_test_multiple $cmd $msg {
76 -re "^$cmd_regex\r\n$errmsg$gdb_prompt $" {
77 pass $msg
78 }
79 }
80 }
81
82 load_description "extra-regs.xml" ""
83 gdb_test "ptype \$extrareg" "type = (int|long|long long)"
84 gdb_test "ptype \$uintreg" "type = uint32_t"
85 gdb_test "ptype \$vecreg" "type = int8_t \\\[4\\\]"
86 gdb_test "ptype \$unionreg" \
87 "type = union {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
88 gdb_test "ptype \$unionreg.v4" "type = int8_t \\\[4\\\]"
89
90 load_description "core-only.xml" ""
91 # The extra register from the previous description should be gone.
92 gdb_test "ptype \$extrareg" "type = void"
93
94 file delete "core-regs.xml"
95 file delete "regs.xml"
This page took 0.036206 seconds and 5 git commands to generate.