diff options
author | Fred Fish <fnf@specifix.com> | 1995-11-25 19:55:29 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1995-11-25 19:55:29 +0000 |
commit | 782445c7aa2722092434b23adfb27e27acfd9e06 (patch) | |
tree | 055b2886c76b645574a00b03c3aee2fe95373e00 /gdb/testsuite/gdb.base/bitfields.exp | |
parent | 9b041f69fc5372c05d5d8a067d8263c12c2a3abb (diff) | |
download | gdb-782445c7aa2722092434b23adfb27e27acfd9e06.zip gdb-782445c7aa2722092434b23adfb27e27acfd9e06.tar.gz gdb-782445c7aa2722092434b23adfb27e27acfd9e06.tar.bz2 |
From Rob Savoye (rob@poseidon.cygnus.com)
* Makefile.in, configure.in, gdb.base/{Makefile.in, configure.in},
gdb.c++/{Makefile.in, configure.in}, gdb.chill/{Makefile.in, configure.in},
gdb.disasm/{Makefile.in, configure.in}, gdb.stabs/{Makefile.in, configure.in},
gdb.threads/{Makefile.in, configure.in}: Major reworking for autoconfig.
* aclocal.m4, configure, gdb.base/configure, gdb.c++/configure,
gdb.disasm/configure, gdb.stabs/configure, gdb.stabs/default.mt : New files.
* config/unix-gdb.exp: Make GDB global.
* gdb.base/{a1-selftest.exp, a2-run.exp,bitfields.exp, break.exp, callfuncs.exp,
commands.exp, corefile.exp, crossload.exp, exprs.exp, funcargs.exp, interrupt.exp,
langs.exp, list.exp, mips_pro.exp, nodebug.exp, opaque.exp, printcmds.exp,
ptype.exp, recurse.exp, regs.exp, return.exp, scope.exp, setvar.exp, sigall.exp,
signals.exp, term.exp, twice.exp, watchpoint.exp, whatis.exp},
gdb.c++/{classes.exp, callfuncs.exp, inherit.exp, misc.exp, templates.exp,
virtfunc.exp}, gdb.chill/{callch.exp, chillvars.exp, misc.exp, pr-4975.exp,
pr-5016.exp, pr-5020.exp, pr-5022.exp, pr-5646.exp, pr-5984.exp, pr-6292.exp,
pr-6632.exp, pr-8134.exp, pr-8136.exp, result.exp, string.exp, tuples.exp},
gdb.disasm/{hppa.exp, sh3.exp}, gdb.stabs/weird.exp: Change continues
to returns as necessary, arrange for test to compile own testcase executable.
* lib/gdb.exp: Changes for testsuite to compile own test cases.
From Fred Fish (fnf@cygnus.com)
* gdb.c++/classes.exp (test_pointers_to_class_members): Add
clear_xfail at end of test which might not call either pass or fail.
* gdb.base/a1-selftest.exp: Add i*86-*-linuxaout xfail for
"backtrace through signal handler".
Diffstat (limited to 'gdb/testsuite/gdb.base/bitfields.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/bitfields.exp | 192 |
1 files changed, 78 insertions, 114 deletions
diff --git a/gdb/testsuite/gdb.base/bitfields.exp b/gdb/testsuite/gdb.base/bitfields.exp index 9763a37..a5ed12d 100644 --- a/gdb/testsuite/gdb.base/bitfields.exp +++ b/gdb/testsuite/gdb.base/bitfields.exp @@ -12,7 +12,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu @@ -26,12 +26,12 @@ if $tracelevel then { set prms_id 0 set bug_id 0 -set binfile "bitfields" -set srcfile $binfile.c - -if ![file exists $objdir/$subdir/$binfile] then { - perror "$objdir/$subdir/$binfile does not exist." - return 0 +set testfile "bitfields" +set srcfile ${srcdir}/$subdir/${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +if { [compile "${srcfile} -g -o ${binfile}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 } # @@ -45,101 +45,80 @@ proc bitfield_uniqueness {} { global hex global prompt global srcfile - global det_file - if [gdb_test "break break1" "Break.* at $hex: file .*$srcfile, line $decimal" ""] { - fail "setting breakpoint at break1" + if [gdb_test "break break1" "Break.* at $hex: file .*$srcfile, line $decimal\\."] { return } - expect_after { - -re "Starting.*Break.*break1 \[)(\]+ at .*$srcfile:$decimal.*$prompt $" {} - timeout { fail "running to break1" ; return } + gdb_run_cmd + expect { + -re "Break.*break1 \\(\\) at .*$srcfile:$decimal.*$prompt $" { + pass "running to break1" + } + timeout { fail "running to break1"; return } } - gdb_run_cmd - expect_after; - - if [gdb_test "print flags" ".*uc = 1 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0" ""] { - fail "bitfield uniqueness (uc)" + + if [gdb_test "print flags" ".*uc = 1 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0.*"] { return } - if [gdb_test "cont" "Break.*break1 \[)(\]+ at .*$srcfile:$decimal" ""] { - fail "continuing to break1" + if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #1"] { return } # Note that we check for s1 as either 1 or -1, so that failure to # treat it correctly as a signed 1bit field (values 0 or -1) while # printing its value does not cause a spurious failure. We do the # signedness preservation test later. - if [gdb_test "print flags" ".*uc = 0 .*, s1 = (1|-1), u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0" ""] { - fail "bitfield uniqueness (s1)" + if [gdb_test "print flags" ".*uc = 0 .*, s1 = (1|-1), u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0.*" "bitfield uniqueness (s1)"] { return } - if [gdb_test "cont" "Break.*break1 \[)(\]+ at .*$srcfile:$decimal" ""] { - fail "continuing to break1" + if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #2"] { return } - if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 1, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0" ""] { - fail "bitfield uniqueness (u1)" + if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 1, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0.*" "bitfield uniqueness (u1)"] { return } - if [gdb_test "cont" "Break.*break1 \[)(\]+ at .*$srcfile:$decimal" ""] { - fail "continuing to break1" + if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #3"] { return } - if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 1, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0" ""] { - fail "bitfield uniqueness (s2)" + if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 1, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0.*" "bitfield uniqueness (s2)"] { return } - if [gdb_test "cont" "Break.*break1 \[)(\]+ at .*$srcfile:$decimal" ""] { - fail "continuing to break1" + if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #4"] { return } - if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 1, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0" ""] { - fail "bitfield uniqueness (u2)" + if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 1, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0.*" "bitfield uniqueness (u2)"] { return } - if [gdb_test "cont" "Break.*break1 \[)(\]+ at .*$srcfile:$decimal" ""] { - fail "continuing to break1" + if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #5"] { return } - if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 1, u3 = 0, s9 = 0, u9 = 0, sc = 0" ""] { - fail "bitfield uniqueness (s3)" + if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 1, u3 = 0, s9 = 0, u9 = 0, sc = 0.*" "bitfield uniqueness (s3)"] { return } - if [gdb_test "cont" "Break.*break1 \[)(\]+ at .*$srcfile:$decimal" ""] { - fail "continuing to break1" + if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #6"] { return } - if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 1, s9 = 0, u9 = 0, sc = 0" "" ] { - fail "bitfield uniqueness (u3)" + if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 1, s9 = 0, u9 = 0, sc = 0.*" "bitfield uniqueness (u3)"] { return } - if [gdb_test "cont" "Break.*break1 \[)(\]+ at .*$srcfile:$decimal" ""] { - timeout { fail "continuing to break1" ; return } + if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #7"] { + return } - if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 1, u9 = 0, sc = 0" "" ] { - fail "bitfield uniqueness (s9)" + if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 1, u9 = 0, sc = 0.*" "bitfield uniqueness (s9)"] { return } - if [gdb_test "cont" "Break.*break1 \[)(\]+ at .*$srcfile:$decimal" ""] { - fail "continuing to break1" + if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #8"] { return } - if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 1, sc = 0" "" ] { - fail "bitfield uniqueness (u9)" + if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 1, sc = 0.*" "bitfield uniqueness (u9)"] { return } - if [gdb_test "cont" "Break.*break1 \[)(\]+ at .*$srcfile:$decimal" ""] { - fail "continuing to break1" + if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #9"] { return } - if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 1" "" ] { - fail "bitfield uniqueness (sc)" + if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 1.*" "bitfield uniqueness (sc)"] { return } - - pass "bitfield locating and uniqueness" } @@ -154,77 +133,64 @@ proc bitfield_containment {} { global hex global prompt global srcfile - global det_file delete_breakpoints - if [gdb_test "break break2" "Break.* at $hex: file .*$srcfile, line $decimal" ""] { - fail "setting breakpoint at break2" + if [gdb_test "break break2" "Break.* at $hex: file .*$srcfile, line $decimal\\." "setting breakpoint at break2"] { return } - expect_after { - -re "Starting.*Break.*break2 \[)(\]+ at .*$srcfile:$decimal.*$prompt $" {} - timeout { fail "running to break2" ; return } - } gdb_run_cmd - expect_after; + expect { + -re "Break.*break2 \\(\\) at .*$srcfile:$decimal.*$prompt $" { + pass "running to break2" + } + timeout { fail "running to break2"; return } + } - if [gdb_test "print/x flags" ".*uc = 0xff, s1 = 0x0, u1 = 0x1, s2 = 0x0, u2 = 0x3, s3 = 0x0, u3 = 0x7, s9 = 0x0, u9 = 0x1ff, sc = 0x0" ""] { - fail "bitfield containment" + if [gdb_test "print/x flags" "= {uc = 0xff, s1 = 0x0, u1 = 0x1, s2 = 0x0, u2 = 0x3, s3 = 0x0, u3 = 0x7, s9 = 0x0, u9 = 0x1ff, sc = 0x0}" "bitfield containment #1"] { return } - if [gdb_test "cont" "Break.*break2 \[)(\]+ at .*$srcfile:$decimal" ""] { - fail "continuing to break2" + if [gdb_test "cont" "Break.*break2 \\(\\) at .*$srcfile:$decimal.*" "continuing to break2"] { return } # If program is compiled with Sun CC, then these print out as their # actual sizes; if compiled with gcc, they print out as 0xffffffff # (which strikes me as bogus, but accept it at least for now). - if [gdb_test "print/x flags" ".*uc = 0x0, s1 = 0x(1|f*), u1 = 0x0, s2 = 0x(3|f*), u2 = 0x0, s3 = 0x(7|f*), u3 = 0x0, s9 = 0x(1ff|f*), u9 = 0x0, sc = 0xff" ""] { - fail "bitfield containment" + if [gdb_test "print/x flags" "= {uc = 0x0, s1 = 0x(1|f*), u1 = 0x0, s2 = 0x(3|f*), u2 = 0x0, s3 = 0x(7|f*), u3 = 0x0, s9 = 0x(1ff|f*), u9 = 0x0, sc = 0xff}" "bitfield containment #2"] { return } - - pass "bitfield containment" } -# # Test unsigned bitfields for unsignedness and range. # Fill the unsigned fields with the maximum positive value and verify that # the values are printed correctly. -# FIXME: Perhaps we should test each bitfield separately so we can -# report individual failures rather than just pass/nopass. proc bitfield_unsignedness {} { global decimal global hex global prompt global srcfile - global det_file delete_breakpoints - if [gdb_test "break break3" "Break.* at $hex: file .*$srcfile, line $decimal" ""] { - fail "setting breakpoint at break3" + if [gdb_test "break break3" "Break.* at $hex: file .*$srcfile, line $decimal\\." "setting breakpoint at break3"] { return } - expect_after { - -re "Starting.*Break.*break3 \[)(\]+ at .*$srcfile:$decimal.*$prompt $" {} - timeout { fail "running to break3" ; return } - } gdb_run_cmd - expect_after; + expect { + -re "Break.*break3 \\(\\) at .*$srcfile:$decimal.*$prompt $" { + pass "running to break3" + } + timeout { fail "running to break3"; return } + } - if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 1, s2 = 0, u2 = 3, s3 = 0, u3 = 7, s9 = 0, u9 = 511, sc = 0" "" ] { - fail "unsigned bitfield ranges" + if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 1, s2 = 0, u2 = 3, s3 = 0, u3 = 7, s9 = 0, u9 = 511, sc = 0.*" "unsigned bitfield ranges"] { return } - - pass "unsigned bitfield ranges and unsigned-ness" } # @@ -239,29 +205,26 @@ proc bitfield_signedness {} { global hex global prompt global srcfile - global det_file delete_breakpoints - if [gdb_test "break break4" "Break.* at $hex: file .*$srcfile, line $decimal" ""] { - fail "setting breakpoint at break4" + if [gdb_test "break break4" "Break.* at $hex: file .*$srcfile, line $decimal\\." "setting breakpoint at break4"] { return } - expect_after { - -re "Starting.*Break.*break4 \[)(\]+ at .*$srcfile:$decimal.*$prompt $" {} - timeout { fail "running to break4" ; return } - } gdb_run_cmd - expect_after; + expect { + -re "Break.*break4 \\(\\) at .*$srcfile:$decimal.*$prompt $" { + pass "running to break4" + } + timeout { fail "running to break4"; return } + } - if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 1, u2 = 0, s3 = 3, u3 = 0, s9 = 255, u9 = 0, sc = 0" ""] { - fail "signed bitfields, max positive values" + if [gdb_test "print flags" "= {uc = 0 .*, s1 = 0, u1 = 0, s2 = 1, u2 = 0, s3 = 3, u3 = 0, s9 = 255, u9 = 0, sc = 0 .*}" "signed bitfields, max positive values"] { return } - if [gdb_test "cont" "Break.*break4 \[)(\]+ at .*$srcfile:$decimal" "" ] { - fail "continuing to break4" + if [gdb_test "cont" "Break.*break4 \\(\\) at .*$srcfile:$decimal.*" "continuing to break4 #1"] { return } @@ -269,30 +232,31 @@ proc bitfield_signedness {} { # the signed bitfield tests if it doesn't. send "print i\n" expect { - -re ".* = -256.*$prompt $" {} - -re ".* = 256.*$prompt $" {setup_xfail "*-*-*"} - -re ".*$prompt $" { fail "determining signed-ness of bitfields (known bug in sparc gcc 2.4.5)" + -re ".* = -256.*$prompt $" { + pass "determining signed-ness of bitfields" + } + -re ".* = 256.*$prompt $" { + pass "determining signed-ness of bitfields" + setup_xfail "*-*-*" + } + -re ".*$prompt $" { + fail "determining signed-ness of bitfields" return } default { fail "determining signed-ness of bitfields" ; return } } - if [gdb_test "print flags" ".*uc = 0 .*, s1 = -1, u1 = 0, s2 = -2, u2 = 0, s3 = -4, u3 = 0, s9 = -256, u9 = 0, sc = 0" ""] { - fail "signed bitfields, max negative values" + if [gdb_test "print flags" ".*uc = 0 .*, s1 = -1, u1 = 0, s2 = -2, u2 = 0, s3 = -4, u3 = 0, s9 = -256, u9 = 0, sc = 0.*" "signed bitfields, max negative values"] { return } - if [gdb_test "cont" "Break.*break4 \[)(\]+ at .*$srcfile:$decimal" ""] { - fail "continuing to break4" + if [gdb_test "cont" "Break.*break4 \\(\\) at .*$srcfile:$decimal.*" "continuing to break4 #2"] { return } - if [gdb_test "print flags" ".*uc = 0 .*, s1 = -1, u1 = 0, s2 = -1, u2 = 0, s3 = -1, u3 = 0, s9 = -1, u9 = 0, sc = 0" ""] { - fail "signed bitfields with -1" + if [gdb_test "print flags" ".*uc = 0 .*, s1 = -1, u1 = 0, s2 = -1, u2 = 0, s3 = -1, u3 = 0, s9 = -1, u9 = 0, sc = 0.*" "signed bitfields with -1"] { return } - - pass "signed bitfield ranges and signed-ness" } # Start with a fresh gdb. @@ -300,7 +264,7 @@ proc bitfield_signedness {} { gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir -gdb_load $objdir/$subdir/$binfile +gdb_load ${binfile} send "set print sevenbit-strings\n" ; expect -re "$prompt $" bitfield_uniqueness @@ -309,7 +273,7 @@ if [istarget "mips-idt-*"] then { gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir - gdb_load $objdir/$subdir/$binfile + gdb_load ${binfile} } bitfield_containment if [istarget "mips-idt-*"] then { @@ -317,7 +281,7 @@ if [istarget "mips-idt-*"] then { gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir - gdb_load $objdir/$subdir/$binfile + gdb_load ${binfile} } bitfield_unsignedness if [istarget "mips-idt-*"] then { @@ -325,6 +289,6 @@ if [istarget "mips-idt-*"] then { gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir - gdb_load $objdir/$subdir/$binfile + gdb_load ${binfile} } bitfield_signedness |