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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.hp/] [gdb.base-hp/] [reg.exp] - Blame information for rev 258

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

Line No. Rev Author Line
1 24 jeremybenn
# This test script is part of GDB, the GNU debugger.
2
 
3
# Copyright 1998, 1999, 2001, 2004,
4
# Free Software Foundation, Inc.
5
 
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 3 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program.  If not, see .  */
18
 
19
# Please email any bugs, comments, and/or additions to this file to:
20
# bug-gdb@prep.ai.mit.edu
21
 
22
# Tests of wide register displays for GDB on HPPA 2.0 machines
23
 
24
# use this to debug:
25
#log_user 1
26
 
27
if $tracelevel then {
28
        strace $tracelevel
29
        }
30
 
31
if { [skip_hp_tests] } then { continue }
32
 
33
set testfile "reg"
34
 
35
if [istarget "hppa64-hp-hpux*"] {
36
    verbose "reg.exp is not for PA2.0W."
37
    return 0
38
}
39
set srcfile ${testfile}.s
40
set binfile ${objdir}/${subdir}/${testfile}
41
 
42
# To build a pa 2.0 executable
43
#
44
#     as -o reg reg.s
45
# or
46
#     cc -g -o reg reg.s
47
#
48
# The +DA2.0N flag doesn't seem to be needed.
49
#
50
# Don't reject if there are warnings, as we expect this warning:
51
#
52
#    (Warning) At least one PA 2.0 object file (pa2.0_test2.o) was detected.
53
#    The linked output may not run on a PA 1.x system.
54
#
55
 
56
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
57
     untested reg.exp
58
     return -1
59
}
60
 
61
gdb_exit
62
gdb_start
63
gdb_reinitialize_dir $srcdir/$subdir
64
gdb_load ${binfile}
65
 
66
# test machine--there's no 2.0n architecture, so we have
67
# to try to run the app.
68
#
69
send_gdb "break main\n"
70
    gdb_expect {
71
        -re "Breakpoint.*$gdb_prompt $" {
72
            pass "initial set-up"
73
        }
74
        -re ".*$gdb_prompt $" {
75
            fail "initial set-up"
76
        }
77
        timeout {
78
            fail "initial set-up (timeout)"
79
        }
80
    }
81
 
82
send_gdb "run\n"
83
    gdb_expect {
84
        -re ".*Executable file incompatible with hardware.*$gdb_prompt $" {
85
            # Not hppa2.0 machine
86
            #
87
            return 0
88
        }
89
        -re "Cannot exec.*$gdb_prompt $" {
90
            # Not hppa2.0 machine
91
            #
92
            return 0
93
        }
94
        -re ".*Starting program:.*$gdb_prompt $" {
95
            pass "Ready to start test"
96
        }
97
        timeout {
98
            fail "initial set-up, part 2 (timeout)"
99
            return 0
100
        }
101
    }
102
 
103
# Let the program set known values.  This secretly deletes
104
# the breakpoint at main and re-runs to mainend.
105
#
106
runto mainend
107
 
108
# Look for known values
109
#
110
# The output format changed between gdb 6.1.1 and gdb HEAD 2004-06-01.
111
#
112
#   gdb 6.1.1:
113
#   (gdb) info reg r1
114
#   r1 1
115
#
116
#   gdb HEAD 2004-06-01:
117
#   (gdb) info reg r1
118
#   r1             0x1     1
119
#
120
# For now, I accept both formats.  In the future, you can remove
121
# the old gdb 6.1.1 format.
122
#
123
# -- chastain 2004-06-26
124
 
125
set ws "\[\r\n\t \]+"
126
 
127
proc hp_integer_reg {regname vhex vdec} {
128
  global ws
129
  set value_611 "$regname${ws}$vhex"
130
  set value_new "$regname${ws}0x$vhex${ws}$vdec"
131
  gdb_test "info reg $regname" "$value_611|$value_new"
132
}
133
 
134
hp_integer_reg "r1"      "1"     "1"
135
hp_integer_reg "r4"      "2"     "2"
136
hp_integer_reg "r5"      "4"     "4"
137
hp_integer_reg "r6"      "8"     "8"
138
hp_integer_reg "r7"     "10"    "16"
139
hp_integer_reg "r8"     "20"    "32"
140
hp_integer_reg "r9"     "40"    "64"
141
hp_integer_reg "r10"    "80"   "128"
142
hp_integer_reg "r11"   "100"   "256"
143
hp_integer_reg "r12"   "200"   "512"
144
hp_integer_reg "r13"   "400"  "1024"
145
hp_integer_reg "r14"   "800"  "2048"
146
hp_integer_reg "r15"  "1000"  "4096"
147
hp_integer_reg "r16"  "2000"  "8192"
148
 
149
# Two odd variants that GDB supports are:
150
#   "1" means "r1", and
151
#   "$1" means "r1"
152
 
153
hp_integer_reg "1" "1" "1"
154
hp_integer_reg "4" "2" "2"
155
 
156
set name "info reg \$1"
157
gdb_test_multiple "info reg \$1" "$name" {
158
    -re "r1${ws}1\r\n$gdb_prompt $" {
159
        pass "$name"
160
    }
161
    -re "r1${ws}0x1${ws}1\r\n$gdb_prompt $" {
162
        pass "$name"
163
    }
164
}
165
 
166
# Verify that GDB responds gracefully to a register ID number that
167
# is out of range.
168
 
169
gdb_test "info reg 999" "Invalid register.*999.*"
170
 
171
# Make sure the floating point status and error registers
172
# don't show up as floating point numbers!
173
 
174
hp_integer_reg "fpsr" "0" "0"
175
hp_integer_reg "fpe1" "0" "0"
176
hp_integer_reg "fpe2" "0" "0"
177
hp_integer_reg "fpe3" "0" "0"
178
hp_integer_reg "fpe4" "0" "0"
179
hp_integer_reg "fpe5" "0" "0"
180
hp_integer_reg "fpe6" "0" "0"
181
hp_integer_reg "fpe7" "0" "0"
182
 
183
# Floating point registers.
184
# TODO: these are old format only.
185
 
186
gdb_test "info reg fr4"  ".*fr4.*(double precision).* 1"
187
gdb_test "info reg fr5"  ".*fr5.*(double precision).* 2"
188
gdb_test "info reg fr6"  ".*fr6.*(double precision).* 2"
189
gdb_test "info reg fr7"  ".*fr7.*(double precision).* 4"
190
gdb_test "info reg fr8"  ".*fr8.*(double precision).* 8"
191
gdb_test "info reg fr9"  ".*fr9.*(double precision).* 32"
192
gdb_test "info reg fr10" ".*fr10.*(double precision).* 256"
193
 
194
# An integer register with a 64-bit value.
195
 
196
set name "info reg r19"
197
gdb_test_multiple "info reg r19" "$name" {
198
    -re "r19${ws}deadbeefbadcadee\r\n$gdb_prompt $" {
199
        # old gdb 6.1.1 format, good result
200
        pass "$name"
201
    }
202
    -re "r19${ws}badcadee\r\n$gdb_prompt $" {
203
        # old gdb 6.1.1 format, bad result
204
        fail "$name (32-bit truncation)"
205
    }
206
    -re "r19${ws}0xdeadbeefbadcadee${ws}16045690984232431086\r\n$gdb_prompt $" {
207
        # new gdb HEAD 2004-06-01 format, good result
208
        pass "$name"
209
    }
210
    -re "r19${ws}0xbadcadee${ws}3135024622\r\n$gdb_prompt $" {
211
        # new gdb HEAD 2004-06-01 format, 32 bit truncation
212
        fail "$name (32-bit truncation)"
213
    }
214
}
215
 
216
set name "print /x \$r19"
217
gdb_test_multiple "print /x \$r19" "$name" {
218
    -re "= 0xdeadbeefbadcadee\r\n$gdb_prompt $" {
219
        pass "$name"
220
    }
221
    -re "= 0xbadcadee\r\n$gdb_prompt $" {
222
        # this was a PASS in the last version so keep it PASS for now
223
        # -- chastain 2004-06-26
224
        pass "$name (32-bit truncation)"
225
    }
226
}
227
 
228
# Need to add tests of setting wide regs too.  E.g.
229
#
230
# set $r4 = 0x1234567890123456
231
# p/x $r4
232
#
233
 
234
# done
235
#
236
gdb_exit
237
 
238
return 0

powered by: WebSVN 2.1.0

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