OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.xml/] [tdesc-regs.exp] - Blame information for rev 394

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 2007, 2008, 2009, 2010 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 .
15
 
16
if {[gdb_skip_xml_test]} {
17
    unsupported "tdesc-regs.exp"
18
    return -1
19
}
20
 
21
gdb_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
 
26
set core-regs ""
27
set regdir ""
28
set architecture ""
29
switch -glob -- [istarget] {
30
    "*arm-*-*" {
31
        set core-regs {arm-core.xml}
32
    }
33
    "xscale-*-*" {
34
        set core-regs {arm-core.xml}
35
    }
36
    "*m68k-*-*" {
37
        set core-regs {m68k-core.xml}
38
    }
39
    "mips*-*-*" {
40
        set core-regs {mips-cpu.xml mips-cp0.xml mips-fpu.xml}
41
    }
42
    "powerpc*-*-*" {
43
        set regdir "rs6000/"
44
        set core-regs {power-core.xml}
45
    }
46
    "s390*-*-*" {
47
        set core-regs {s390-core32.xml s390-acr.xml s390-fpr.xml}
48
    }
49
    "spu*-*-*" {
50
        # This may be either the spu-linux-nat target, or the Cell/B.E.
51
        # multi-architecture debugger in SPU standalone executable mode.
52
        # We do not support XML register sets on SPU in either case.
53
        # However, the multi-arch debugger will accept XML registers sets
54
        # (on the PowerPC side), hence the test below would fail.
55
        # Simply return unconditionally here.
56
        unsupported "register tests"
57
        return 0
58
    }
59
    "i?86-*-*" {
60
        set architecture "i386"
61
        set regdir "i386/"
62
        set core-regs {32bit-core.xml 32bit-sse.xml}
63
    }
64
    "x86_64-*-*" {
65
        set architecture "i386:x86-64"
66
        set regdir "i386/"
67
        set core-regs {64bit-core.xml 64bit-sse.xml}
68
    }
69
}
70
 
71
# If no core registers were specified, assume this target does not
72
# support target-defined registers.  Verify that we get a warning if
73
# we try to use them.  This not only tests the warning, but also
74
# reminds maintainers to add test support when they add the feature.
75
if {[string equal ${core-regs} ""]} {
76
    gdb_test "set tdesc file $srcdir/$subdir/single-reg.xml" \
77
        "warning: Target-supplied registers are not supported.*" \
78
        "set tdesc file single-reg.xml"
79
    unsupported "register tests"
80
    return 0
81
}
82
 
83
# Otherwise, we support both XML and target defined registers.
84
 
85
# Make sure we reject a description missing standard registers,
86
# like the PC.
87
gdb_test "set tdesc file $srcdir/$subdir/single-reg.xml" \
88
    "warning: Architecture rejected target-supplied description" \
89
    "set tdesc file single-reg.xml"
90
 
91
# Copy the core registers into the objdir if necessary, so that they
92
# will be found by .
93
foreach src ${core-regs} {
94
    set file [remote_download host "$srcdir/../features/$regdir$src" "$src"]
95
}
96
 
97
# Similarly, we need to copy files under test into the objdir.
98
proc load_description { file errmsg } {
99
    global srcdir
100
    global subdir
101
    global gdb_prompt
102
    global core-regs
103
    global architecture
104
 
105
    file delete "$subdir/regs.xml"
106
    set ifd [open "$srcdir/$subdir/$file" r]
107
    set ofd [open "$subdir/regs.xml" w]
108
    while {[gets $ifd line] >= 0} {
109
        if {[regexp {} $line]} {
110
            if {! [string equal ${architecture} ""]} {
111
                puts $ofd "  ${architecture}"
112
            }
113
            foreach src ${core-regs} {
114
                puts $ofd "  "
115
            }
116
        } else {
117
            puts $ofd $line
118
        }
119
    }
120
    close $ifd
121
    close $ofd
122
    remote_download host "$subdir/regs.xml" "regs.xml"
123
    file delete "$subdir/regs.xml"
124
 
125
    # Anchor the test output, so that error messages are detected.
126
    set cmd "set tdesc filename regs.xml"
127
    set msg "set tdesc filename regs.xml - from $file"
128
    set cmd_regex [string_to_regexp $cmd]
129
    gdb_test_multiple $cmd $msg {
130
        -re "^$cmd_regex\r\n$errmsg$gdb_prompt $" {
131
            pass $msg
132
        }
133
    }
134
    remote_file host delete "regs.xml"
135
}
136
 
137
load_description "extra-regs.xml" ""
138
gdb_test "ptype \$extrareg" "type = (int|long|long long)"
139
gdb_test "ptype \$uintreg" "type = uint32_t"
140
gdb_test "ptype \$vecreg" "type = int8_t \\\[4\\\]"
141
gdb_test "ptype \$unionreg" \
142
    "type = union {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
143
gdb_test "ptype \$unionreg.v4" "type = int8_t \\\[4\\\]"
144
gdb_test "ptype \$structreg" \
145
    "type = struct struct1 {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
146
gdb_test "ptype \$structreg.v4" "type = int8_t \\\[4\\\]"
147
gdb_test "ptype \$bitfields" \
148
    "type = struct struct2 {\r\n *uint64_t f1 : 35;\r\n *uint64_t f2 : 1;\r\n}"
149
 
150
load_description "core-only.xml" ""
151
# The extra register from the previous description should be gone.
152
gdb_test "ptype \$extrareg" "type = void"
153
 
154
foreach src ${core-regs} {
155
    remote_file host delete "$src"
156
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.