diff options
author | Michael Chastain <mec@google.com> | 2004-06-28 18:19:47 +0000 |
---|---|---|
committer | Michael Chastain <mec@google.com> | 2004-06-28 18:19:47 +0000 |
commit | c279b077e03d044e4a7f8ed1aaf503c4b88dc7e9 (patch) | |
tree | 562b5139ae48425d92348b6a487a778b83e44062 /gdb/testsuite | |
parent | a21da8bff0e6a2efd2daa258e82574980c5cb270 (diff) | |
download | gdb-c279b077e03d044e4a7f8ed1aaf503c4b88dc7e9.zip gdb-c279b077e03d044e4a7f8ed1aaf503c4b88dc7e9.tar.gz gdb-c279b077e03d044e4a7f8ed1aaf503c4b88dc7e9.tar.bz2 |
2004-06-28 Michael Chastain <mec.gnu@mindspring.com>
* gdb.hp/gdb.base-hp/reg.exp: Accept both old and new gdb output
formats for "info register". Use gdb_test_multiple. Fix
the "invalid register" test.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.hp/gdb.base-hp/reg.exp | 149 |
2 files changed, 102 insertions, 53 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1a2b613..5ea869c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2004-06-28 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.hp/gdb.base-hp/reg.exp: Accept both old and new gdb output + formats for "info register". Use gdb_test_multiple. Fix + the "invalid register" test. + 2004-06-28 Corinna Vinschen <vinschen@redhat.com> * gdb.base/attach.exp: Fix copyright date. Set testpid to Windows diff --git a/gdb/testsuite/gdb.hp/gdb.base-hp/reg.exp b/gdb/testsuite/gdb.hp/gdb.base-hp/reg.exp index f67a889..cc1028d 100644 --- a/gdb/testsuite/gdb.hp/gdb.base-hp/reg.exp +++ b/gdb/testsuite/gdb.hp/gdb.base-hp/reg.exp @@ -107,44 +107,81 @@ runto mainend # Look for known values # -gdb_test "info reg r1" "r1 1" -gdb_test "info reg r4" "r4 2" -gdb_test "info reg r5" "r5 4" -gdb_test "info reg r6" "r6 8" -gdb_test "info reg r7" "r7 10" -gdb_test "info reg r8" "r8 20" -gdb_test "info reg r9" "r9 40" -gdb_test "info reg r10" "r10 80" -gdb_test "info reg r11" "r11 100" -gdb_test "info reg r12" "r12 200" -gdb_test "info reg r13" "r13 400" -gdb_test "info reg r14" "r14 800" -gdb_test "info reg r15" "r15 1000" -gdb_test "info reg r16" "r16 2000" +# The output format changed between gdb 6.1.1 and gdb HEAD 2004-06-01. +# +# gdb 6.1.1: +# (gdb) info reg r1 +# r1 1 +# +# gdb HEAD 2004-06-01: +# (gdb) info reg r1 +# r1 0x1 1 +# +# For now, I accept both formats. In the future, you can remove +# the old gdb 6.1.1 format. +# +# -- chastain 2004-06-26 + +set ws "\[\r\n\t \]+" + +proc hp_integer_reg {regname vhex vdec} { + global ws + set value_611 "$regname${ws}$vhex" + set value_new "$regname${ws}0x$vhex${ws}$vdec" + gdb_test "info reg $regname" "$value_611|$value_new" +} + +hp_integer_reg "r1" "1" "1" +hp_integer_reg "r4" "2" "2" +hp_integer_reg "r5" "4" "4" +hp_integer_reg "r6" "8" "8" +hp_integer_reg "r7" "10" "16" +hp_integer_reg "r8" "20" "32" +hp_integer_reg "r9" "40" "64" +hp_integer_reg "r10" "80" "128" +hp_integer_reg "r11" "100" "256" +hp_integer_reg "r12" "200" "512" +hp_integer_reg "r13" "400" "1024" +hp_integer_reg "r14" "800" "2048" +hp_integer_reg "r15" "1000" "4096" +hp_integer_reg "r16" "2000" "8192" # Two odd variants that GDB supports are: # "1" means "r1", and # "$1" means "r1" -# -gdb_test "info reg 1 4" "r1 1.*r4 2" -gdb_test "info reg \$1" "r1 1" + +hp_integer_reg "1" "1" "1" +hp_integer_reg "4" "2" "2" + +set name "info reg \$1" +gdb_test_multiple "info reg \$1" "$name" { + -re "r1${ws}1\r\n$gdb_prompt $" { + pass "$name" + } + -re "r1${ws}0x1${ws}1\r\n$gdb_prompt $" { + pass "$name" + } +} # Verify that GDB responds gracefully to a register ID number that # is out of range. -# -gdb_test "info reg 999" "999: invalid register" + +gdb_test "info reg 999" "Invalid register.*999.*" # Make sure the floating point status and error registers # don't show up as floating point numbers! -# -gdb_test "info reg fpsr" ".*fpsr 0.*" "fpsr" -gdb_test "info reg fpe1" ".*fpe1 0.*" "fpe1" -gdb_test "info reg fpe2" ".*fpe2 0.*" "fpe2" -gdb_test "info reg fpe3" ".*fpe3 0.*" "fpe3" -gdb_test "info reg fpe4" ".*fpe4 0.*" "fpe4" -gdb_test "info reg fpe5" ".*fpe5 0.*" "fpe5" -gdb_test "info reg fpe6" ".*fpe6 0.*" "fpe6" -gdb_test "info reg fpe7" ".*fpe7 0.*" "fpe7" + +hp_integer_reg "fpsr" "0" "0" +hp_integer_reg "fpe1" "0" "0" +hp_integer_reg "fpe2" "0" "0" +hp_integer_reg "fpe3" "0" "0" +hp_integer_reg "fpe4" "0" "0" +hp_integer_reg "fpe5" "0" "0" +hp_integer_reg "fpe6" "0" "0" +hp_integer_reg "fpe7" "0" "0" + +# Floating point registers. +# TODO: these are old format only. gdb_test "info reg fr4" ".*fr4.*(double precision).* 1" gdb_test "info reg fr5" ".*fr5.*(double precision).* 2" @@ -154,33 +191,39 @@ gdb_test "info reg fr8" ".*fr8.*(double precision).* 8" gdb_test "info reg fr9" ".*fr9.*(double precision).* 32" gdb_test "info reg fr10" ".*fr10.*(double precision).* 256" -gdb_test "info reg r19" "r19 deadbeefbadcadee" +# An integer register with a 64-bit value. -# Need to add test of use of $<register-name> -# -# Q: How do you say a literal "$" in expect? -# A: You say "\$". A literal "\" is "\\". -# -# Please note that this test will fail as long as we are running -# in 32-bit mode: it will produce "$1 = 0xbadcadee". To fix it -# would require building a real 64-bit gdb (expression evaluation, -# in particular). -# -send_gdb "p/x \$r19\n" - gdb_expect { - -re ".*= 0xdeadbeefbadcadee.*$gdb_prompt $" { - pass "64-bit works" - } - -re ".*= 0xbadcadee.*$gdb_prompt $" { - pass "32-bit extract when using PRINT; expected but not good" - } - -re ".*$gdb_prompt $" { - fail "didn't print any part of right value" - } - timeout { - fail "timeout on print" - } +set name "info reg r19" +gdb_test_multiple "info reg r19" "$name" { + -re "r19${ws}deadbeefbadcadee\r\n$gdb_prompt $" { + # old gdb 6.1.1 format, good result + pass "$name" + } + -re "r19${ws}badcadee\r\n$gdb_prompt $" { + # old gdb 6.1.1 format, bad result + fail "$name (32-bit truncation)" + } + -re "r19${ws}0xdeadbeefbadcadee${ws}16045690984232431086\r\n$gdb_prompt $" { + # new gdb HEAD 2004-06-01 format, good result + pass "$name" } + -re "r19${ws}0xbadcadee${ws}3135024622\r\n$gdb_prompt $" { + # new gdb HEAD 2004-06-01 format, 32 bit truncation + fail "$name (32-bit truncation)" + } +} + +set name "print /x \$r19" +gdb_test_multiple "print /x \$r19" "$name" { + -re "= 0xdeadbeefbadcadee\r\n$gdb_prompt $" { + pass "$name" + } + -re "= 0xbadcadee\r\n$gdb_prompt $" { + # this was a PASS in the last version so keep it PASS for now + # -- chastain 2004-06-26 + pass "$name (32-bit truncation)" + } +} # Need to add tests of setting wide regs too. E.g. # |