1 # This test script is part of GDB
, the GNU debugger.
3 # Copyright
1998, 1999, 2001, 2004,
4 # Free Software Foundation
, Inc.
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
2 of the License
, or
9 #
(at your option
) any later version.
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.
16 # You should have received a copy of the GNU General Public License
17 # along with this
program; if not
, write to the Free Software
18 # Foundation
, Inc.
, 59 Temple Place
- Suite
330, Boston
, MA
02111-1307, USA.
*/
20 # Please email
any bugs
, comments
, and
/or additions to this file to
:
21 # bug
-gdb@prep.ai.mit.edu
23 # Tests of wide register displays
for GDB
on HPPA
2.0 machines
32 if { [skip_hp_tests
] } then { continue }
36 if [istarget
"hppa64-hp-hpux*"] {
37 verbose
"reg.exp is not for PA2.0W."
40 set srcfile $
{testfile
}.s
41 set binfile $
{objdir
}/$
{subdir
}/$
{testfile
}
43 # To build a pa
2.0 executable
49 # The
+DA2.0N flag doesn
't seem to be needed.
51 # Don't reject
if there are warnings
, as we expect this warning
:
53 #
(Warning
) At least one PA
2.0 object file
(pa2.0_test2.o
) was detected.
54 # The linked output may not run
on a PA
1.x
system.
57 if { [gdb_compile
"${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
58 gdb_suppress_entire_file
"Testcase compile failed, so all tests in this file will automatically fail."
63 gdb_reinitialize_dir $srcdir
/$subdir
66 # test machine
--there
's no 2.0n architecture, so we have
67 # to try to run the app.
69 send_gdb "break main\n"
71 -re "Breakpoint.*$gdb_prompt $" {
74 -re ".*$gdb_prompt $" {
78 fail "initial set-up (timeout)"
84 -re ".*Executable file incompatible with hardware.*$gdb_prompt $" {
89 -re "Cannot exec.*$gdb_prompt $" {
94 -re ".*Starting program:.*$gdb_prompt $" {
95 pass "Ready to start test"
98 fail "initial set-up, part 2 (timeout)"
103 # Let the program set known values. This secretly deletes
104 # the breakpoint at main and re-runs to mainend.
108 # Look for known values
110 # The output format changed between gdb 6.1.1 and gdb HEAD 2004-06-01.
116 # gdb HEAD 2004-06-01:
120 # For now, I accept both formats. In the future, you can remove
121 # the old gdb 6.1.1 format.
123 # -- chastain 2004-06-26
125 set ws "\[\r\n\t \]+"
127 proc hp_integer_reg {regname vhex vdec} {
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"
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"
149 # Two odd variants that GDB supports are:
150 # "1" means "r1", and
153 hp_integer_reg "1" "1" "1"
154 hp_integer_reg "4" "2" "2"
156 set name "info reg \$1"
157 gdb_test_multiple "info reg \$1" "$name" {
158 -re "r1${ws}1\r\n$gdb_prompt $" {
161 -re "r1${ws}0x1${ws}1\r\n$gdb_prompt $" {
166 # Verify that GDB responds gracefully to a register ID number that
169 gdb_test "info reg 999" "Invalid register.*999.*"
171 # Make sure the floating point status and error registers
172 # don't
show up as floating point numbers
!
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"
183 # Floating point registers.
184 # TODO
: these are old format only.
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"
194 # An
integer register with a
64-bit value.
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
202 -re
"r19${ws}badcadee\r\n$gdb_prompt $" {
203 # old gdb
6.1.1 format
, bad result
204 fail
"$name (32-bit truncation)"
206 -re
"r19${ws}0xdeadbeefbadcadee${ws}16045690984232431086\r\n$gdb_prompt $" {
207 # new gdb HEAD
2004-06-01 format
, good result
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)"
216 set name "print /x \$r19"
217 gdb_test_multiple
"print /x \$r19" "$name" {
218 -re
"= 0xdeadbeefbadcadee\r\n$gdb_prompt $" {
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)"
228 # Need to add tests of setting wide regs too. E.g.
230 #
set $r4
= 0x1234567890123456