* remote-fileio.c (remote_fileio_func_rename): Use Cygwin 1.7
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.xml / tdesc-regs.exp
CommitLineData
4c38e0a4 1# Copyright 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
123dc839
DJ
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
123dc839
DJ
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
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
123dc839
DJ
15
16if {[gdb_skip_xml_test]} {
17 unsupported "tdesc-regs.exp"
18 return -1
19}
20
21gdb_start
22
23# To test adding registers, we need a core set of registers for this
24# architecture, or the description will be rejected.
25
26set core-regs ""
7cc46491 27set regdir ""
123dc839
DJ
28switch -glob -- [istarget] {
29 "*arm-*-*" {
f8b73d13 30 set core-regs {arm-core.xml}
123dc839
DJ
31 }
32 "xscale-*-*" {
f8b73d13
DJ
33 set core-regs {arm-core.xml}
34 }
276a961b
MK
35 "*m68k-*-*" {
36 set core-regs {m68k-core.xml}
37 }
f8b73d13
DJ
38 "mips*-*-*" {
39 set core-regs {mips-cpu.xml mips-cp0.xml mips-fpu.xml}
123dc839 40 }
7cc46491
DJ
41 "powerpc*-*-*" {
42 set regdir "rs6000/"
43 set core-regs {power-core.xml}
44 }
7803799a
UW
45 "s390*-*-*" {
46 set core-regs {s390-core32.xml s390-acr.xml s390-fpr.xml}
47 }
85e747d2
UW
48 "spu*-*-*" {
49 # This may be either the spu-linux-nat target, or the Cell/B.E.
50 # multi-architecture debugger in SPU standalone executable mode.
51 # We do not support XML register sets on SPU in either case.
52 # However, the multi-arch debugger will accept XML registers sets
53 # (on the PowerPC side), hence the test below would fail.
54 # Simply return unconditionally here.
55 unsupported "register tests"
56 return 0
57 }
123dc839
DJ
58}
59
60# If no core registers were specified, assume this target does not
61# support target-defined registers. Verify that we get a warning if
62# we try to use them. This not only tests the warning, but also
63# reminds maintainers to add test support when they add the feature.
64if {[string equal ${core-regs} ""]} {
65 gdb_test "set tdesc file $srcdir/$subdir/single-reg.xml" \
66 "warning: Target-supplied registers are not supported.*" \
67 "set tdesc file single-reg.xml"
68 unsupported "register tests"
69 return 0
70}
71
72# Otherwise, we support both XML and target defined registers.
73
74# Make sure we reject a description missing standard registers,
75# like the PC.
76gdb_test "set tdesc file $srcdir/$subdir/single-reg.xml" \
77 "warning: Architecture rejected target-supplied description" \
78 "set tdesc file single-reg.xml"
79
80# Copy the core registers into the objdir if necessary, so that they
81# will be found by <xi:include>.
f8b73d13 82foreach src ${core-regs} {
d252f7e5 83 set file [remote_download host "$srcdir/../features/$regdir$src" "$src"]
f8b73d13 84}
123dc839
DJ
85
86# Similarly, we need to copy files under test into the objdir.
87proc load_description { file errmsg } {
88 global srcdir
89 global subdir
90 global gdb_prompt
f8b73d13 91 global core-regs
123dc839 92
d252f7e5 93 file delete "$subdir/regs.xml"
f8b73d13 94 set ifd [open "$srcdir/$subdir/$file" r]
d252f7e5 95 set ofd [open "$subdir/regs.xml" w]
f8b73d13
DJ
96 while {[gets $ifd line] >= 0} {
97 if {[regexp {<xi:include href="core-regs.xml"/>} $line]} {
98 foreach src ${core-regs} {
99 puts $ofd " <xi:include href=\"$src\"/>"
100 }
101 } else {
102 puts $ofd $line
103 }
104 }
105 close $ifd
106 close $ofd
d252f7e5
DJ
107 remote_download host "$subdir/regs.xml" "regs.xml"
108 file delete "$subdir/regs.xml"
123dc839
DJ
109
110 # Anchor the test output, so that error messages are detected.
111 set cmd "set tdesc filename regs.xml"
d252f7e5 112 set msg "set tdesc filename regs.xml - from $file"
123dc839
DJ
113 set cmd_regex [string_to_regexp $cmd]
114 gdb_test_multiple $cmd $msg {
115 -re "^$cmd_regex\r\n$errmsg$gdb_prompt $" {
116 pass $msg
117 }
118 }
d252f7e5 119 remote_file host delete "regs.xml"
123dc839
DJ
120}
121
122load_description "extra-regs.xml" ""
123gdb_test "ptype \$extrareg" "type = (int|long|long long)"
124gdb_test "ptype \$uintreg" "type = uint32_t"
125gdb_test "ptype \$vecreg" "type = int8_t \\\[4\\\]"
126gdb_test "ptype \$unionreg" \
127 "type = union {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
128gdb_test "ptype \$unionreg.v4" "type = int8_t \\\[4\\\]"
129
130load_description "core-only.xml" ""
131# The extra register from the previous description should be gone.
132gdb_test "ptype \$extrareg" "type = void"
133
f8b73d13 134foreach src ${core-regs} {
d252f7e5 135 remote_file host delete "$src"
f8b73d13 136}
This page took 0.320396 seconds and 4 git commands to generate.