Tue Mar 14 07:39:19 1995 Jim Kingdon (kingdon@lioth.cygnus.com)
+ * lib/gdb.exp (gdb_test): Between $pattern and $prompt, expect
+ only \r\n, not .*. The test can pass .* as the last thing in
+ $pattern if that is what it wants. In addition to providing this
+ flexibility, this change should speed up pattern matching in cases
+ where the pattern already ended with .* (there were a number of
+ them). This change also helps catch bad patterns--in the old
+ scheme the typo "char \*" instead of "char \\*" would pass. Now
+ it is caught.
+ * Many .exp files: Update callers.
+
* gdb.base/funcargs.exp: Replace \[(\]+ with \\(. The latter is
clearer and does not spuriously match multiple ('s. Likewise for
) and *.
-# Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
+# Copyright (C) 1988, 1990, 1991, 1992, 1994 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# test break at function
#
-send "break main\n"
-expect {
- -re "Breakpoint.*at.* file .*$srcfile, line.*$prompt $" { pass "breakpoint function" }
- -re ".*$prompt $" { fail "breakpoint function" }
- timeout { fail "(timeout) breakpoint function" }
-}
-
+gdb_test "break main" \
+ "Breakpoint.*at.* file .*$srcfile, line.*" \
+ "breakpoint function"
#
# test break at function in file
#
-send "break $srcfile:factorial\n"
-expect {
- -re "Breakpoint.*at.* file .*$srcfile, line.*$prompt $" { pass "breakpoint function in file" }
- -re ".*$prompt $" { fail "breakpoint function in file" }
- timeout { fail "(timeout) breakpoint function in file" }
-}
-
+gdb_test "break $srcfile:factorial" \
+ "Breakpoint.*at.* file .*$srcfile, line.*" \
+ "breakpoint function in file"
#
# test break at line number
#
-send "break 60\n"
-expect {
- -re "Breakpoint.*at.* file .*$srcfile, line 60.*$prompt $" { pass "breakpoint line number" }
- -re ".*$prompt $" { fail "breakpoint line number" }
- timeout { fail "(timeout) breakpoint line number" }
-}
-
+gdb_test "break 60" \
+ "Breakpoint.*at.* file .*$srcfile, line 60\\." \
+ "breakpoint line number"
#
# test duplicate breakpoint
#
-send "break 60\n"
-expect {
- -re "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line 60.*$prompt $"\
- { pass "breakpoint duplicate" }
- -re ".*$prompt $" { fail "breakpoint duplicate" }
- timeout { fail "(timeout) breakpoint duplicate" }
-}
-
+gdb_test "break 60" \
+ "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line 60\\." \
+ "breakpoint duplicate"
#
# test break at line number in file
#
-send "break $srcfile:66\n"
-expect {
- -re "Breakpoint.*at.* file .*$srcfile, line 66.*$prompt $" { pass "breakpoint line number in file" }
- -re ".*$prompt $" { fail "breakpoint line number in file" }
- timeout { fail "(timeout) breakpoint line number in file" }
-}
+gdb_test "break $srcfile:66" \
+ "Breakpoint.*at.* file .*$srcfile, line 66\\." \
+ "breakpoint line number in file"
#
# check to see what breakpoints are set
#
-send "info break\n"
-expect {
- -re "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:56.*
\[0-9\]+\[\t \]+breakpoint keep y.* in factorial at .*$srcfile:72.*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:60.*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:60.*
-\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:66.*$prompt $" { pass "breakpoint info" }
- -re ".*$prompt $" { fail "breakpoint info" }
- timeout { fail "(timeout) breakpoint info" }
-}
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:66" \
+ "breakpoint info"
# FIXME: The rest of this test doesn't work with anything that can't
proc test_clear_command {} {
- gdb_test "break main" "Breakpoint.*at"
- gdb_test "break main" "Breakpoint.*at"
+ gdb_test "break main" "Breakpoint.*at.*"
+ gdb_test "break main" "Breakpoint.*at.*"
# We don't test that it deletes the correct breakpoints. We do at
# least test that it deletes more than one breakpoint.
- gdb_test "clear main" {Deleted breakpoints [0-9]+ [0-9]+}
+ gdb_test "clear main" {Deleted breakpoints [0-9]+ [0-9]+.*}
}
#
# Do a backtrace just to confirm how many levels deep we are.
set result [gdb_test "backtrace" \
- "#0\[ \t\]+ factorial .value=5." \
+ "#0\[ \t\]+ factorial .value=5..*" \
"backtrace from factorial(5)"]
if $result!=0 then { return }
# Do a backtrace just to confirm.
set result [gdb_test "backtrace" \
- "#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6." \
+ "#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6..*" \
"backtrace from factorial(5)"]
if $result!=0 then { return }
# Continue until we exit. Should not stop again.
- gdb_test "continue" "Continuing.\r\n720"\
+ gdb_test "continue" "Continuing.\r\n720\r\n\r\nProgram exited normally\\."\
"continue until exit in recursive next test"
}
send "set args main\n"
expect -re ".*$prompt $" {}
}
-
-if [istarget "a29k-*-udi"] then {
- # FIXME: If PR 2415 is fixed, this is not needed.
- gdb_target_udi
-}
setup_xfail "alpha*-*-osf*" "mips*-*-irix*" "*-*-ultrix*"
gdb_test "ptype bsslocal" "<(data variable|variable), no debug info>"
- gdb_test "backtrace" "#0.*inner.*#1.*middle.*#2.*top.*#3.*main"
+ gdb_test "backtrace" "#0.*inner.*#1.*middle.*#2.*top.*#3.*main.*"
# Or if that doesn't work, at least hope for the external symbols
- gdb_test "backtrace" "#0.*inner.*#1.*#2.*top.*#3.*main"
+ gdb_test "backtrace" "#0.*inner.*#1.*#2.*top.*#3.*main.*"
# This test is not as obscure as it might look. `p getenv ("TERM")'
# is a real-world example, at least on many systems.
- test_print_accept {p/c array_index("abcdef",2)} "99 'c'"
+ test_print_accept {p/c array_index("abcdef",2)} "= 99 'c'"
# Now, try that we can give names of file-local symbols which happen
# to be unique, and have it still work
if [runto middle] then {
- gdb_test "backtrace" "#0.*middle.*#1.*top.*#2.*main"
+ gdb_test "backtrace" "#0.*middle.*#1.*top.*#2.*main.*"
}
}
}
# printing; this was a bug in older gdb's.
send "set print elements 0\n" ; expect -re "$prompt $"
gdb_test "p teststring" \
- " = (.unsigned char .. )?\"teststring contents\"\r\n"
+ " = (.unsigned char .. )?\"teststring contents\""
send "set print elements 1\n" ; expect -re "$prompt $"
gdb_test "p teststring" \
- " = (.unsigned char .. )?\"t\"...\r\n"
+ " = (.unsigned char .. )?\"t\"\\.\\.\\."
send "set print elements 5\n" ; expect -re "$prompt $"
gdb_test "p teststring" \
- " = (.unsigned char .. )?\"tests\"...\r\n"
+ " = (.unsigned char .. )?\"tests\"\\.\\.\\."
send "set print elements 19\n" ; expect -re "$prompt $"
gdb_test "p teststring" \
- " = (.unsigned char .. )?\"teststring contents\"\r\n"
+ " = (.unsigned char .. )?\"teststring contents\""
send "set print elements 20\n" ; expect -re "$prompt $"
gdb_test "p teststring" \
- " = (.unsigned char .. )?\"teststring contents\"\r\n"
+ " = (.unsigned char .. )?\"teststring contents\""
send "set print elements 8\n" ; expect -re "$prompt $"
proc test_artificial_arrays {} {
test_print_accept {p int1dim[0]@2} "{0, 1}"
- gdb_test {p int1dim[0]@2@3} "({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot)"
+ gdb_test {p int1dim[0]@2@3} "({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)"
test_print_accept {p/x (short [])0x12345678} \
"({0x1234, 0x5678}|{0x5678, 0x1234})"
}
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
-gdb_test "print \$pc" "No registers"
+gdb_test "print \$pc" "No registers\\."
# FIXME: should also test "print $pc" when there is an execfile but no
# remote debugging target, process or corefile.
-# Copyright (C) 1992 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1994 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
global srcdir
global subdir
- set passcount 0
-
# skip past init. There may be a call to __main at the start of
# main, so the first next may only get us to the init call.
send "next\n"
expect {
- -re "$decimal.*foo \[)(\]+;\r\n$prompt $" {}
+ -re "$decimal.*foo \[)(\]+;\r\n$prompt $" {
+ pass "next over init() in main"
+ }
-re "$decimal.*init \[)(\]+;\r\n$prompt $"\
{ send "next\n" ; exp_continue }
-re "$prompt $" { fail "next over init() in main" ; return }
send "print filelocal\n"
expect {
- -re "\\\$$decimal = 1\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 1\r\n$prompt $" { pass "print filelocal" }
-re "$prompt $" { fail "print filelocal" ; return }
timeout {
fail "(timeout) print filelocal" ; return
# The RS/6000 does not seem to be handle print 'file'::var.
setup_xfail "rs6000-*-*"
- # This used to work, but is now broken for some reason.
- setup_xfail "*-*-*"
send "print 'scope0.c'::filelocal\n"
expect {
- -re "\\\$$decimal = 1\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 1\r\n$prompt $" {
+ pass "print 'scope0.c'::filelocal at main"
+ }
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal\n"
exp_continue
}
- -re "$prompt $" { fail "print 'scope0.c'::filelocal" ; return }
+ -re "$prompt $" { fail "print 'scope0.c'::filelocal at main" ; return }
timeout {
- fail "(timeout) print 'scope0.c'::filelocal" ; return
+ fail "(timeout) print 'scope0.c'::filelocal at main" ; return
}
}
send "print filelocal_bss\n"
expect {
- -re "\\\$$decimal = 101\r\n$prompt $" { incr passcount }
- -re "$prompt $" { print filelocal_bss" ; return }
+ -re "\\\$$decimal = 101\r\n$prompt $" {
+ pass "print filelocal_bss"
+ }
+ -re "$prompt $" { fail "print filelocal_bss" ; return }
timeout {
fail "(timeout) print filelocal_bss" ; return
}
setup_xfail "rs6000-*-*"
send "print 'scope0.c'::filelocal_bss\n"
expect {
- -re "\\\$$decimal = 101\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 101\r\n$prompt $" {
+ pass "print 'scope0.c'::filelocal_bss"
+ }
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
exp_continue
send "print filelocal_ro\n"
expect {
- -re "\\\$$decimal = 201\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 201\r\n$prompt $" { pass "print filelocal_ro" }
-re "$prompt $" { fail "print filelocal_ro" ; return }
timeout {
fail "(timeout) print filelocal_ro" ; return
setup_xfail "rs6000-*-*"
send "print 'scope0.c'::filelocal_ro\n"
expect {
- -re "\\\$$decimal = 201\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 201\r\n$prompt $" {
+ pass "print 'scope0.c'::filelocal_ro"
+ }
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
exp_continue
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::filelocal\n"
expect {
- -re "\\\$$decimal = 2\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 2\r\n$prompt $" {
+ pass "print 'scope1.c'::filelocal"
+ }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal\n"
exp_continue
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::filelocal_bss\n"
expect {
- -re "\\\$$decimal = 102\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 102\r\n$prompt $" {
+ pass "print 'scope1.c'::filelocal_bss"
+ }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
exp_continue
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::filelocal_ro\n"
expect {
- -re "\\\$$decimal = 202\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 202\r\n$prompt $" {
+ pass "print 'scope1.c'::filelocal_ro"
+ }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
exp_continue
setup_xfail "mips-*-*" 1843
send "print foo::funclocal\n"
expect {
- -re "\\\$$decimal = 3\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 3\r\n$prompt $" { pass "print foo::funclocal" }
-re "$prompt $" { fail "print foo::funclocal" ; return }
timeout {
fail "(timeout) print foo::funclocal" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::foo::funclocal\n"
expect {
- -re "\\\$$decimal = 3\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 3\r\n$prompt $" {
+ pass "print 'scope1.c'::foo::funclocal"
+ }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
exp_continue
send "print foo::funclocal_ro\n"
expect {
- -re "\\\$$decimal = 203\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 203\r\n$prompt $" {
+ pass "print foo::funclocal_ro"
+ }
-re "$prompt $" { fail "print foo::funclocal_ro" ; return }
timeout {
fail "(timeout) print foo::funclocal_ro" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::foo::funclocal_ro\n"
expect {
- -re "\\\$$decimal = 203\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 203\r\n$prompt $" {
+ pass "print 'scope1.c'::foo::funclocal_ro" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
exp_continue
send "print bar::funclocal\n"
expect {
- -re "\\\$$decimal = 4\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 4\r\n$prompt $" { pass "print bar::funclocal" }
-re "$prompt $" { fail "print bar::funclocal" ; return }
timeout {
fail "(timeout) print bar::funclocal" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::bar::funclocal\n"
expect {
- -re "\\\$$decimal = 4\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 4\r\n$prompt $" {
+ pass "print 'scope1.c'::bar::funclocal"
+ }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
exp_continue
fail "print 'scope1.c'::bar::funclocal" ; return
}
}
-
- clear_xfail "*-*-*"
- pass "$passcount correct scope resolutions from main()"
}
proc test_at_foo {} {
global srcdir
global subdir
- set passcount 0
-
send "next\n"
expect {
-re ".*bar \[)(\]+;\r\n$prompt $" {}
# Print scope0.c::filelocal, which is 1
setup_xfail "rs6000-*-*"
- # This used to work, but is now broken for some reason.
- setup_xfail "*-*-*"
send "print 'scope0.c'::filelocal\n"
expect {
- -re "\\\$$decimal = 1\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 1\r\n$prompt $" {
+ pass "print 'scope0.c'::filelocal at foo"
+ }
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal\n"
exp_continue
}
- -re "$prompt $" { fail "print 'scope0.c'::filelocal" ; return }
+ -re "$prompt $" { fail "print 'scope0.c'::filelocal at foo" ; return }
timeout {
- fail "(timeout) print 'scope0.c'::filelocal" ; return
+ fail "(timeout) print 'scope0.c'::filelocal at foo" ; return
}
}
setup_xfail "rs6000-*-*"
send "print 'scope0.c'::filelocal_bss\n"
expect {
- -re "\\\$$decimal = 101\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 101\r\n$prompt $" { pass "print 'scope0.c'::filelocal_bss" }
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
exp_continue
setup_xfail "rs6000-*-*"
send "print 'scope0.c'::filelocal_ro\n"
expect {
- -re "\\\$$decimal = 201\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 201\r\n$prompt $" { pass "print 'scope0.c'::filelocal_ro" }
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
exp_continue
send "print filelocal\n"
expect {
- -re "\\\$$decimal = 2\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 2\r\n$prompt $" { pass "print filelocal" }
-re "$prompt $" { fail "print filelocal" ; return }
timeout {
fail "(timeout) print filelocal" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::filelocal\n"
expect {
- -re "\\\$$decimal = 2\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 2\r\n$prompt $" { pass "print 'scope1.c'::filelocal" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal\n"
exp_continue
send "print filelocal_bss\n"
expect {
- -re "\\\$$decimal = 102\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 102\r\n$prompt $" { pass "print filelocal_bss" }
-re "$prompt $" { fail "print filelocal_bss" ; return }
timeout {
fail "(timeout) print filelocal_bss" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::filelocal_bss\n"
expect {
- -re "\\\$$decimal = 102\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 102\r\n$prompt $" { pass "print 'scope1.c'::filelocal_bss" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
exp_continue
send "print filelocal_ro\n"
expect {
- -re "\\\$$decimal = 202\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 202\r\n$prompt $" { pass "print filelocal_ro" }
-re "$prompt $" { fail "print filelocal_ro" ; return }
timeout {
fail "(timeout) print filelocal_ro" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::filelocal_ro\n"
expect {
- -re "\\\$$decimal = 202\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 202\r\n$prompt $" { pass "print 'scope1.c'::filelocal_ro" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
exp_continue
send "print funclocal\n"
expect {
- -re "\\\$$decimal = 3\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 3\r\n$prompt $" { pass "print funclocal" }
-re "$prompt $" { fail "print funclocal" ; return }
timeout {
fail "(timeout) print funclocal" ; return
setup_xfail "mips-*-*" 1843
send "print foo::funclocal\n"
expect {
- -re "\\\$$decimal = 3\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 3\r\n$prompt $" { pass "print foo::funclocal" }
-re "$prompt $" { fail "print foo::funclocal" ; return }
timeout {
fail "(timeout) print foo::funclocal" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::foo::funclocal\n"
expect {
- -re "\\\$$decimal = 3\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 3\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
exp_continue
send "print funclocal_bss\n"
expect {
- -re "\\\$$decimal = 103\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 103\r\n$prompt $" { pass "print funclocal_bss" }
-re "$prompt $" { fail "print funclocal_bss" ; return }
timeout {
fail "(timeout) print funclocal_bss" ; return
send "print foo::funclocal_bss\n"
expect {
- -re "\\\$$decimal = 103\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 103\r\n$prompt $" { pass "print foo::funclocal_bss" }
-re "$prompt $" { fail "print foo::funclocal_bss" ; return }
timeout {
fail "(timeout) print foo::funclocal_bss" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::foo::funclocal_bss\n"
expect {
- -re "\\\$$decimal = 103\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 103\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_bss" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n"
exp_continue
send "print funclocal_ro\n"
expect {
- -re "\\\$$decimal = 203\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 203\r\n$prompt $" { pass "print funclocal_ro" }
-re "$prompt $" { fail "print funclocal_ro" ; return }
timeout {
fail "(timeout) print funclocal_ro" ; return
send "print foo::funclocal_ro\n"
expect {
- -re "\\\$$decimal = 203\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 203\r\n$prompt $" { pass "print foo::funclocal_ro" }
-re "$prompt $" { fail "print foo::funclocal_ro" ; return }
timeout {
fail "(timeout) print foo::funclocal_ro" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::foo::funclocal_ro\n"
expect {
- -re "\\\$$decimal = 203\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 203\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_ro" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
exp_continue
send "print bar::funclocal\n"
expect {
- -re "\\\$$decimal = 4\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 4\r\n$prompt $" { pass "print bar::funclocal" }
-re "$prompt $" { fail "print bar::funclocal" ; return }
timeout {
fail "(timeout) print bar::funclocal" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::bar::funclocal\n"
expect {
- -re "\\\$$decimal = 4\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 4\r\n$prompt $" { pass "print 'scope1.c'::bar::funclocal" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
exp_continue
fail "(timeout) print 'scope1.c'::bar::funclocal" ; return
}
}
-
- clear_xfail "*-*-*"
- pass "$passcount correct scope resolutions from foo()"
}
proc test_at_bar {} {
global srcdir
global subdir
- set passcount 0
-
send "next\n"
expect {
-re ".*$prompt $" {}
# Print scope0.c::filelocal, which is 1
setup_xfail "rs6000-*-*"
- # This used to work, but is now broken for some reason.
- setup_xfail "*-*-*"
send "print 'scope0.c'::filelocal\n"
expect {
- -re "\\\$$decimal = 1\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 1\r\n$prompt $" {
+ pass "print 'scope0.c'::filelocal at bar"
+ }
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal\n"
exp_continue
}
- -re "$prompt $" { fail "print 'scope0.c'::filelocal" ; return }
+ -re "$prompt $" { fail "print 'scope0.c'::filelocal at bar" ; return }
timeout {
- fail "(timeout) print 'scope0.c'::filelocal" ; return
+ fail "(timeout) print 'scope0.c'::filelocal at bar" ; return
}
}
setup_xfail "rs6000-*-*"
send "print 'scope0.c'::filelocal_bss\n"
expect {
- -re "\\\$$decimal = 101\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 101\r\n$prompt $" { pass "print 'scope0.c'::filelocal_bss" }
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
exp_continue
setup_xfail "rs6000-*-*"
send "print 'scope0.c'::filelocal_ro\n"
expect {
- -re "\\\$$decimal = 201\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 201\r\n$prompt $" { pass "print 'scope0.c'::filelocal_ro" }
-re "No symbol \"scope0.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
exp_continue
send "print filelocal\n"
expect {
- -re "\\\$$decimal = 2\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 2\r\n$prompt $" { pass "print filelocal" }
-re "$prompt $" { fail "print filelocal" ; return }
timeout {
fail "(timeout) print filelocal" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::filelocal\n"
expect {
- -re "\\\$$decimal = 2\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 2\r\n$prompt $" { pass "print 'scope1.c'::filelocal" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal\n"
exp_continue
send "print filelocal_bss\n"
expect {
- -re "\\\$$decimal = 102\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 102\r\n$prompt $" { pass "print filelocal_bss" }
-re "$prompt $" { fail "print filelocal_bss" ; return }
timeout {
fail "(timeout) print filelocal_bss" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::filelocal_bss\n"
expect {
- -re "\\\$$decimal = 102\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 102\r\n$prompt $" { pass "print 'scope1.c'::filelocal_bss" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
exp_continue
send "print filelocal_ro\n"
expect {
- -re "\\\$$decimal = 202\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 202\r\n$prompt $" { pass "print filelocal_ro" }
-re "$prompt $" { fail "print filelocal_ro" ; return }
timeout {
fail "(timeout) print filelocal_ro" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::filelocal_ro\n"
expect {
- -re "\\\$$decimal = 202\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 202\r\n$prompt $" { pass "print 'scope1.c'::filelocal_ro" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
exp_continue
setup_xfail "mips-*-*" 1843
send "print foo::funclocal\n"
expect {
- -re "\\\$$decimal = 3\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 3\r\n$prompt $" { pass "print foo::funclocal" }
-re "$prompt $" { fail "print foo::funclocal" ; return }
timeout {
fail "(timeout) print foo::funclocal" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::foo::funclocal\n"
expect {
- -re "\\\$$decimal = 3\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 3\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
exp_continue
send "print foo::funclocal_bss\n"
expect {
- -re "\\\$$decimal = 103\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 103\r\n$prompt $" { pass "print foo::funclocal_bss" }
-re "$prompt $" { fail "print foo::funclocal_bss" ; return }
timeout {
fail "(timeout) print foo::funclocal_bss" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::foo::funclocal_bss\n"
expect {
- -re "\\\$$decimal = 103\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 103\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_bss" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n"
exp_continue
send "print foo::funclocal_ro\n"
expect {
- -re "\\\$$decimal = 203\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 203\r\n$prompt $" { pass "print foo::funclocal_ro" }
-re "$prompt $" { fail "print foo::funclocal_ro" ; return }
timeout {
fail "(timeout) print foo::funclocal_ro" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::foo::funclocal_ro\n"
expect {
- -re "\\\$$decimal = 203\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 203\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_ro" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
exp_continue
send "print funclocal\n"
expect {
- -re "\\\$$decimal = 4\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 4\r\n$prompt $" { pass "print funclocal" }
-re "$prompt $" { fail "print funclocal" ; return }
timeout {
fail "(timeout) print funclocal" ; return
send "print bar::funclocal\n"
expect {
- -re "\\\$$decimal = 4\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 4\r\n$prompt $" { pass "print bar::funclocal" }
-re "$prompt $" { fail "print bar::funclocal" ; return }
timeout {
fail "(timeout) print bar::funclocal" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::bar::funclocal\n"
expect {
- -re "\\\$$decimal = 4\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 4\r\n$prompt $" { pass "print 'scope1.c'::bar::funclocal" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
exp_continue
send "print funclocal_bss\n"
expect {
- -re "\\\$$decimal = 104\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 104\r\n$prompt $" { pass "print funclocal_bss" }
-re "$prompt $" { fail "print funclocal_bss" ; return }
timeout {
fail "(timeout) print funclocal_bss" ; return
send "print bar::funclocal_bss\n"
expect {
- -re "\\\$$decimal = 104\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 104\r\n$prompt $" { pass "print bar::funclocal_bss" }
-re "$prompt $" { fail "print bar::funclocal_bss" ; return }
timeout {
fail "(timeout) print bar::funclocal_bss" ; return
setup_xfail "rs6000-*-*"
send "print 'scope1.c'::bar::funclocal_bss\n"
expect {
- -re "\\\$$decimal = 104\r\n$prompt $" { incr passcount }
+ -re "\\\$$decimal = 104\r\n$prompt $" { pass "print 'scope1.c'::bar::funclocal_bss" }
-re "No symbol \"scope1.c\" in current context.*$prompt $" {
send "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss\n"
exp_continue
fail "(timeout) print 'scope1.c'::bar::funclocal_bss" ; return
}
}
-
- clear_xfail "*-*-*"
- pass "$passcount correct scope resolutions from bar()"
}
# FIXME: This test was originally part of some local scope resolution
pass "$count auto variables correctly initialized"
# Test that block variable sorting is not screwing us.
- gdb_test "frame" "#.*autovars \[(\]+bcd=5, abc=6\[)\]+" "args in correct order"
+ gdb_test "frame" "#.*autovars \\(bcd=5, abc=6\\).*" "args in correct order"
}
proc test_at_localscopes {} {
global hex
global srcfile
- set passcount 0
-
send "break marker2\n" ; expect -re ".*$prompt $"
send "break marker3\n" ; expect -re ".*$prompt $"
send "break marker4\n" ; expect -re ".*$prompt $"
send "print localval\n"
expect {
- -re ".* = 10\r\n$prompt $" { incr passcount }
+ -re ".* = 10\r\n$prompt $" { pass "bad value for localval, outer scope" }
-re "$prompt $" { fail "bad value for localval, outer scope" ; return }
default {
fail "(timeout) bad value for localval, outer scope" ; return
}
send "print localval1\n"
expect {
- -re ".* = 11\r\n$prompt $" { incr passcount }
+ -re ".* = 11\r\n$prompt $" { pass "bad value for localval1" }
-re "$prompt $" { fail "bad value for localval1" ; return }
timeout { fail "(timeout) bad value for localval1" ; return }
}
send "print localval2\n"
expect {
-re "No symbol \"localval2\" in current context.\r\n$prompt $" {
- incr passcount
+ pass "bad value for localval2"
}
-re "$prompt $" { fail "bad value for localval2" ; return }
timeout { fail "(timeout) bad value for localval2" ; return }
send "print localval3\n"
expect {
-re "No symbol \"localval3\" in current context.\r\n$prompt $" {
- incr passcount
+ pass "bad value for localval3"
}
-re "$prompt $" { fail "bad value for localval3" ; return }
timeout { fail "(timeout) bad value for localval3" ; return }
send "print localval\n"
expect {
- -re ".* = 20\r\n$prompt $" { incr passcount }
+ -re ".* = 20\r\n$prompt $" { pass "bad value for localval, first nested scope" }
-re "$prompt $" {
fail "bad value for localval, first nested scope" ; return
}
}
send "print localval1\n"
expect {
- -re ".* = 11\r\n$prompt $" { incr passcount }
+ -re ".* = 11\r\n$prompt $" { pass "bad value for localval1" }
-re "$prompt $" { fail "bad value for localval1" ; return }
timeout { fail "(timeout) bad value for localval1" ; return }
}
send "print localval2\n"
expect {
- -re ".* = 12\r\n$prompt $" { incr passcount }
+ -re ".* = 12\r\n$prompt $" { pass "bad value for localval2" }
-re "$prompt $" { fail "bad value for localval2" ; return }
timeout { fail "(timeout) bad value for localval2" ; return }
}
send "print localval3\n"
expect {
-re "No symbol \"localval3\" in current context.\r\n$prompt $" {
- incr passcount
+ pass "bad value for localval3"
}
-re "$prompt $" { fail "bad value for localval3" ; return }
timeout { fail "(timeout) bad value for localval3" ; return }
send "print localval\n"
expect {
- -re ".* = 30\r\n$prompt $" { incr passcount }
+ -re ".* = 30\r\n$prompt $" { pass "bad value for localval, innermost scope" }
-re "$prompt $" {
fail "bad value for localval, innermost scope" ; return
}
}
send "print localval1\n"
expect {
- -re ".* = 11\r\n$prompt $" { incr passcount }
+ -re ".* = 11\r\n$prompt $" { pass "bad value for localval1" }
-re "$prompt $" { fail "bad value for localval1" ; return }
timeout { fail "(timeout) bad value for localval1" ; return }
}
send "print localval2\n"
expect {
- -re ".* = 12\r\n$prompt $" { incr passcount }
+ -re ".* = 12\r\n$prompt $" { pass "bad value for localval2" }
-re "$prompt $" { fail "bad value for localval2" ; return }
timeout { fail "(timeout) bad value for localval2" ; return }
}
send "print localval3\n"
expect {
- -re ".* = 13\r\n$prompt $" { incr passcount }
+ -re ".* = 13\r\n$prompt $" { pass "bad value for localval3" }
-re "$prompt $" { fail "bad value for localval3" ; return }
timeout { fail "(timeout) bad value for localval3" ; return }
}
-
- clear_xfail "*-*-*"
- pass "$passcount correct scope resolutions from localscopes()"
}
# Start with a fresh gdb.
# AIX--sections get mapped to the same address so we can't get the right one.
setup_xfail "rs6000-*-*"
-gdb_test "print 'scope0.c'::filelocal" "= 1"
+gdb_test "print 'scope0.c'::filelocal" "= 1" \
+ "print 'scope0.c'::filelocal before run"
if [runto main] then { test_at_main }
if [istarget "mips-idt-*"] then {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
}
-if [istarget "a29k-*-udi"] then {
- # FIXME: If PR 2415 is fixed, this is not needed.
- gdb_target_udi
- gdb_load $objdir/$subdir/$binfile
-}
if [runto foo] then { test_at_foo }
if [istarget "mips-idt-*"] then {
# Restart because IDT/SIM runs out of file descriptors.
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
}
-if [istarget "a29k-*-udi"] then {
- # FIXME: If PR 2415 is fixed, this is not needed.
- gdb_target_udi
- gdb_load $objdir/$subdir/$binfile
-}
if [runto bar] then { test_at_bar }
if [istarget "mips-idt-*"] then {
# Restart because IDT/SIM runs out of file descriptors.
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
}
-if [istarget "a29k-*-udi"] then {
- # FIXME: If PR 2415 is fixed, this is not needed.
- gdb_target_udi
- gdb_load $objdir/$subdir/$binfile
-}
if [runto localscopes] then { test_at_localscopes }
if [istarget "mips-idt-*"] then {
# Restart because IDT/SIM runs out of file descriptors.
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
}
-if [istarget "a29k-*-udi"] then {
- # FIXME: If PR 2415 is fixed, this is not needed.
- gdb_target_udi
- gdb_load $objdir/$subdir/$binfile
-}
if [runto autovars] then { test_at_autovars }
-if [istarget "a29k-*-udi"] then {
- # FIXME: If PR 2415 is fixed, this is not needed.
- gdb_target_udi
-}
-
if [istarget "*-*-vxworks"] {
set timeout 120
}
set prms_id 0
set bug_id 0
-gdb_reinitialize_dir $srcdir/$subdir
set binfile $objdir/$subdir/signals
if ![file exists $binfile] then {
proc signal_tests_1 {} {
global prompt
if [runto main] then {
- gdb_test "next" "signal \[(\]+SIGUSR1" \
- "next over signal \[(\]SIGALRM, handler\[)\]+"
- gdb_test "next" "alarm \[(\]" \
- "next over signal \[(\]+SIGUSR1, handler\[)\]+"
- gdb_test "next" "\[+\]+count" \
+ gdb_test "next" "signal \\(SIGUSR1.*" \
+ "next over signal (SIGALRM, handler)"
+ gdb_test "next" "alarm \\(.*" \
+ "next over signal (SIGUSR1, handler)"
+ gdb_test "next" "\\+\\+count; /\\* first \\*/" \
"next over alarm (1)"
# An alarm has been signaled, give the signal time to get delivered.
exec sleep 2
# handler.
fail "next to 2nd alarm (1) (probably kernel bug)"
- gdb_test "next" "alarm" "next to 2nd alarm (1)"
+ gdb_test "next" "alarm.*" "next to 2nd alarm (1)"
}
-re "Program exited with code.*$prompt $" {
eof { fail "next to 2nd alarm (1); (eof)" }
}
- gdb_test "break handler" "Breakpoint \[0-9\]*"
- gdb_test "next" "\[+\]+count" "next to 2nd ++count"
+ gdb_test "break handler" "Breakpoint \[0-9\]+ .*"
+ gdb_test "next" "\\+\\+count; /\\* second \\*/" \
+ "next to 2nd ++count in signals_tests_1"
# An alarm has been signaled, give the signal time to get delivered.
exec sleep 2
set bash_bug 0
send "next\n"
expect {
- -re "Breakpoint.*handler.*$prompt $" { pass "next" }
+ -re "Breakpoint.*handler.*$prompt $" {
+ pass "next to handler in signals_tests_1"
+ }
-re "Program received signal SIGEMT.*$prompt $" {
# Bash versions before 1.13.5 cause this behaviour
# by blocking SIGTRAP.
- fail "next (known problem with bash versions before 1.13.5)"
+ fail "next to handler in signals_tests_1 (known problem with bash versions before 1.13.5)"
set bash_bug 1
- gdb_test "signal 0" "Breakpoint.*handler"
+ gdb_test "signal 0" "Breakpoint.*handler.*"
}
- -re ".*$prompt $" { fail "next" }
- timeout { fail "(timeout)" }
- eof { fail "(eof)" }
+ -re ".*$prompt $" { fail "next to handler in signals_tests_1" }
+ timeout { fail "next to handler in signals_tests_1 (timeout)" }
+ eof { fail "next to handler in signals_tests_1 (eof)" }
}
# This doesn't test that main is frame #2, just that main is frame
# #2, #3, or higher. At some point this should be fixed (but
# it quite possibly would introduce new FAILs on some systems).
- gdb_test "backtrace" "#0.*handler.*#1.*#2.*main"
+ gdb_test "backtrace" "#0.*handler.*#1.*#2.*main.*" \
+ "backtrace in signals_tests_1"
- gdb_test "break func1" "Breakpoint \[0-9\]*"
- gdb_test "break func2" "Breakpoint \[0-9\]*"
+ gdb_test "break func1" "Breakpoint \[0-9\]+ .*"
+ gdb_test "break func2" "Breakpoint \[0-9\]+ .*"
# Vax Ultrix and i386 BSD currently fail the next test with
# a SIGTRAP, but with different symptoms.
setup_xfail "i*86-*-bsd*"
send "continue\n"
expect {
- -re "Breakpoint.*func1.*$prompt $" { pass "continue" }
+ -re "Breakpoint.*func1.*$prompt $" { pass "continue to func1" }
-re "Program received signal SIGTRAP.*second.*$prompt $" {
# See explanation for `next to 2nd alarm (1)' fail above.
# The set trace flag in the restored context is causing
# the SIGTRAP, without stepping an instruction.
- fail "continue (probably kernel bug)"
- gdb_test "continue" "Breakpoint.*func1"
+ fail "continue to func1 (probably kernel bug)"
+ gdb_test "continue" "Breakpoint.*func1.*" \
+ "extra continue to func1"
}
-re "Program received signal SIGTRAP.*func1 ..;.*$prompt $" {
# context is causing the SIGTRAP, but after stepping one
# instruction, as expected.
- fail "continue (probably kernel bug)"
- gdb_test "continue" "Breakpoint.*func1"
+ fail "continue to func1 (probably kernel bug)"
+ gdb_test "continue" "Breakpoint.*func1.*" \
+ "extra continue to func1"
}
- -re ".*$prompt $" { fail "continue" }
- default { fail "continue" }
+ -re ".*$prompt $" { fail "continue to func1" }
+ default { fail "continue to func1" }
+ }
+
+ setup_xfail "*-*-irix*"
+ send "signal SIGUSR1\n"
+ expect {
+ -re "Breakpoint.*handler.*$prompt $" { pass "signal SIGUSR1" }
+ -re "Program received signal SIGUSR1.*$prompt $" {
+ # This is what irix4 and irix5 do.
+ # It would appear to be a kernel bug.
+ fail "signal SIGUSR1"
+ gdb_test "continue" "Breakpoint.*handler.*" "pass it SIGUSR1"
+ }
+ -re ".*$prompt $" { fail "signal SIGUSR1" }
+ default { fail "signal SIGUSR1" }
}
- gdb_test "signal SIGUSR1" "Breakpoint.*handler"
# Will tend to wrongly require an extra continue.
setup_xfail "*-*-*"
send "continue\n"
expect {
- -re "Breakpoint.*func2.*$prompt $" { pass "continue" }
+ -re "Breakpoint.*func2.*$prompt $" { pass "continue to func2" }
-re "Breakpoint.*func1.*$prompt $" {
- fail "continue"
- gdb_test "continue" "Breakpoint.*func2"
+ fail "continue func2"
+ gdb_test "continue" "Breakpoint.*func2.*" \
+ "extra continue to func2"
}
- -re ".*$prompt $" { fail "continue" }
- default { fail "continue" }
+ -re ".*$prompt $" { fail "continue to func2" }
+ default { fail "continue to func2" }
}
exec sleep 2
setup_xfail "m68*-*-sunos4*"
}
- gdb_test "continue" "Breakpoint.*handler"
+ gdb_test "continue" "Breakpoint.*handler.*" "continue to handler"
# If the NO_SINGLE_STEP failure happened, we have already exited.
# If we succeeded a continue will return from the handler to func2.
if {$bash_bug} then {
clear_xfail "m68*-*-sunos4*"
}
- gdb_test "continue" "Program exited with code 010"
+ gdb_test "continue" "Program exited with code 010\\." \
+ "continue to exit in signals_tests_1 "
}
}
gdb_exit
gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
signal_tests_1
}
if [runto main] then {
- gdb_test "break handler if 0" "Breakpoint \[0-9\]*"
+ gdb_test "break handler if 0" "Breakpoint \[0-9\]+ .*"
gdb_test "set \$handler_breakpoint_number = \$bpnum" ""
# Get to the point where a signal is waiting to be delivered
- gdb_test "next" "signal \[(\]+SIGUSR1"
- gdb_test "next" "alarm \[(\]+"
- gdb_test "next" "\[+\]+count"
+ gdb_test "next" "signal \\(SIGUSR1.*" "next to signal in signals.exp"
+ gdb_test "next" "alarm \\(.*" "next to alarm #1 in signals.exp"
+ gdb_test "next" "\\+\\+count; /\\* first \\*/" \
+ "next to ++count #1 in signals.exp"
# Give the signal time to get delivered
exec sleep 2
# lose its cool, this is not a problem, it just has to note
# that the breakpoint condition is false and keep going.
- gdb_test "p func1 ()" "^p func1 \[)(\]+\r\n.\[0-9\]* = void"
+ gdb_test "p func1 ()" "^p func1 \\(\\)\r\n.\[0-9\]* = void" \
+ "p func1 () #1 in signals.exp"
# Make sure the count got incremented.
# Haven't investigated this xfail
setup_xfail "rs6000-*-*"
- gdb_test "p count" "= 2"
+ gdb_test "p count" "= 2" "p count #1 in signals.exp"
if [istarget "rs6000-*-*"] { return 0 }
- gdb_test "condition \$handler_breakpoint_number" "now unconditional"
- gdb_test "next" "alarm \[(\]+"
- gdb_test "next" "\[+\]+count"
+ gdb_test "condition \$handler_breakpoint_number" "now unconditional\\."
+ gdb_test "next" "alarm \\(.*" "next to alarm #2 in signals.exp"
+ gdb_test "next" "\\+\\+count; /\\* second \\*/" \
+ "next to ++count #2 in signals.exp"
exec sleep 2
# This time we stop when GDB tries to run the stack dummy.
# So it is OK that we do not print the return value from the function.
gdb_test "p func1 ()" \
"Breakpoint \[0-9\]*, handler.*
-The program being debugged stopped while in a function called from GDB"
+The program being debugged stopped while in a function called from GDB.*" \
+ "p func1 () #2 in signals.exp"
# But we should be able to backtrace...
- gdb_test "bt" "#0.*handler.*#1.*#2.*main"
+ gdb_test "bt" "#0.*handler.*#1.*#2.*main.*" "bt in signals.exp"
# ...and continue...
- gdb_test "continue" "Continuing"
+ gdb_test "continue" "Continuing\\." "continue in signals.exp"
# ...and then count should have been incremented
- gdb_test "p count" "= 5"
+ gdb_test "p count" "= 5" "p count #2 in signals.exp"
}
return 0
-# Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
+# Copyright (C) 1988, 1990, 1991, 1992, 1995 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
return 0
}
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
"whatis unsigned char"
gdb_test "whatis v_short" \
- "type = short" \
+ "type = (short|short int)" \
"whatis short"
gdb_test "whatis v_signed_short" \
- "type = short" \
+ "type = (short|short int|signed short|signed short int)" \
"whatis signed short"
gdb_test "whatis v_unsigned_short" \
# AIX xlc gets this wrong and unsigned long right. Go figure.
if {!$gcc_compiled} then {setup_xfail "rs6000-*-aix*"}
gdb_test "whatis v_long" \
- "type = long" \
+ "type = (long|long int)" \
"whatis long"
setup_xfail_on_long_vs_int
# AIX xlc gets this wrong and unsigned long right. Go figure.
if {!$gcc_compiled} then {setup_xfail "rs6000-*-aix*"}
gdb_test "whatis v_signed_long" \
- "type = long" \
+ "type = (long|long int)" \
"whatis signed long"
setup_xfail_on_long_vs_int
pass "whatis short array"
gdb_test "whatis v_signed_short_array" \
- "type = (short|shirt int) \\\[2\\\]" \
+ "type = (short|short int) \\\[2\\\]" \
"whatis signed short array"
gdb_test "whatis v_unsigned_short_array" \
# here. We especially want to make sure we test that it doesn't print as
# caddr_t.
gdb_test "whatis v_char_pointer" \
- "type = (unsigned |signed |)char \*" \
+ "type = (unsigned |signed |)char \\*" \
"whatis char pointer"
gdb_test "whatis v_signed_char_pointer" \
- "type = (unsigned |signed |)char \*" \
+ "type = (unsigned |signed |)char \\*" \
"whatis signed char pointer"
gdb_test "whatis v_unsigned_char_pointer" \
- "type = unsigned char \*" \
+ "type = unsigned char \\*" \
"whatis unsigned char pointer"
gdb_test "whatis v_short_pointer" \
- "type = (short|short int) \*" \
+ "type = (short|short int) \\*" \
pass "whatis short pointer"
gdb_test "whatis v_signed_short_pointer" \
- "type = (short|short int) \*" \
+ "type = (short|short int) \\*" \
"whatis signed short pointer"
gdb_test "whatis v_unsigned_short_pointer" \
- "type = (unsigned short|short unsigned int) \*" \
+ "type = (unsigned short|short unsigned int) \\*" \
"whatis unsigned short pointer"
gdb_test "whatis v_int_pointer" \
- "type = int \*" \
+ "type = int \\*" \
"whatis int pointer"
gdb_test "whatis v_signed_int_pointer" \
- "type = int \*" \
+ "type = int \\*" \
"whatis signed int pointer"
gdb_test "whatis v_unsigned_int_pointer" \
- "type = unsigned int \*" \
+ "type = unsigned int \\*" \
"whatis unsigned int pointer"
# We already tested whether long prints as long, so here we accept int
gdb_test "whatis v_long_pointer" \
- "type = (long|int|long int) \*" \
+ "type = (long|int|long int) \\*" \
"whatis long pointer"
gdb_test "whatis v_signed_long_pointer" \
- "type = (signed |)(long|int|long int) \*" \
+ "type = (signed |)(long|int|long int) \\*" \
"whatis signed long pointer"
gdb_test "whatis v_unsigned_long_pointer" \
- "type = (unsigned (int|long|long int)|long unsigned int) \*" \
+ "type = (unsigned (int|long|long int)|long unsigned int) \\*" \
"whatis unsigned long pointer"
gdb_test "whatis v_float_pointer" \
- "type = float \*" \
+ "type = float \\*" \
"whatis float pointer"
gdb_test "whatis v_double_pointer" \
- "type = double \*" \
+ "type = double \\*" \
"whatis double pointer"
# test whatis command with functions return type
gdb_test "whatis v_char_func" \
- "type = (signed |unsigned |)char \(\)" \
+ "type = (signed |unsigned |)char \\(\\)" \
"whatis char function"
gdb_test "whatis v_signed_char_func" \
- "type = (signed |unsigned |)char \(\)" \
+ "type = (signed |unsigned |)char \\(\\)" \
"whatis signed char function"
gdb_test "whatis v_unsigned_char_func" \
- "type = unsigned char \(\)" \
+ "type = unsigned char \\(\\)" \
"whatis unsigned char function"
gdb_test "whatis v_short_func" \
- "type = short (int |)\(\)" \
+ "type = short (int |)\\(\\)" \
"whatis short function"
gdb_test "whatis v_signed_short_func" \
- "type = short (int |)\(\)" \
+ "type = short (int |)\\(\\)" \
"whatis signed short function"
gdb_test "whatis v_unsigned_short_func" \
- "type = (unsigned short|short unsigned int) \(\)" \
+ "type = (unsigned short|short unsigned int) \\(\\)" \
"whatis unsigned short function"
gdb_test "whatis v_int_func" \
- "type = int \(\)" \
+ "type = int \\(\\)" \
"whatis int function"
gdb_test "whatis v_signed_int_func" \
- "type = int \(\)" \
+ "type = int \\(\\)" \
"whatis signed int function"
gdb_test "whatis v_unsigned_int_func" \
- "type = unsigned int \(\)" \
+ "type = unsigned int \\(\\)" \
"whatis unsigned int function"
gdb_test "whatis v_long_func" \
- "type = (long|int|long int) \(\)" \
+ "type = (long|int|long int) \\(\\)" \
"whatis long function"
gdb_test "whatis v_signed_long_func" \
- "type = (int|long|long int) \(\)" \
+ "type = (int|long|long int) \\(\\)" \
"whatis signed long function"
gdb_test "whatis v_unsigned_long_func" \
- "type = (unsigned (int|long|long int)|long unsigned int) \(\)" \
+ "type = (unsigned (int|long|long int)|long unsigned int) \\(\\)" \
"whatis unsigned long function"
# Sun /bin/cc calls this a function returning double.
if {!$gcc_compiled} then {setup_xfail "*-sun-sunos4*"}
gdb_test "whatis v_float_func" \
- "type = float \(\)" \
+ "type = float \\(\\)" \
"whatis float function"
gdb_test "whatis v_double_func" \
- "type = double \(\)" \
+ "type = double \\(\\)" \
"whatis double function" \
# test whatis command with some misc complicated types
gdb_test "whatis s_link" \
- "type = struct link" \
+ "type = struct link \\*" \
"whatis complicated structure"
gdb_test "whatis u_link" \
timeout { fail "set language chill (timeout)" ; return 0 }
}
- return [gdb_test "show language" ".* source language is \"chill\"" \
+ return [gdb_test "show language" ".* source language is \"chill\".*" \
"set language to \"chill\""]
}
test_print_accept "print NULL" "NULL" "print emptiness literal"
gdb_test "info line" \
- {Line 5 of .*misc.ch.* at address H'[0-9a-fA-F]+}\
+ {Line 5 of .*misc.ch.* at address H'[0-9a-fA-F]+.*}\
"info about current line"
}
# This is needed (at least on SunOS4) to make sure the
# the symbol table is read.
runto "x"
- gdb_test "finish" "You loose" "Runs and reads symbols OK"
+ # "You loose"? Why, thank you. (But I suspect "You lose" might have
+ # been what was intended).
+ gdb_test "finish" "You loose.*" "Runs and reads symbols OK"
}
# Check to see if we have an executable to test. If not, then either we
send "break pr-5984.ch:6\n"; expect -re "$prompt $"
send "run\n"; expect -re "Breakpoint .*pr-5984.ch:6"
expect -re "$prompt $"
- gdb_test "next" "Jason Dark"
+ gdb_test "next" "Jason Dark.*" "next over Jason Dark"
}
# Check to see if we have an executable to test. If not, then either we
global GDB
global GDBFLAGS
if {[which $GDB] != 0} then {
- set tmp [exec echo "q" | $GDB -nw]
+ set tmp [exec echo "q" | $GDB -nw $GDBFLAGS]
regexp " \[0-9\.\]+" $tmp version
clone_output "[which $GDB] version$version -nw $GDBFLAGS \n"
} else {
gdb_start
set result -1
}
- -re "$pattern.*$prompt $" {
+ -re "$pattern\r\n$prompt $" {
if ![string match "" $message] then {
pass "$message"
}
#
# This differs from gdb_test in a few ways: (1) handling of empty
# sendthis (I suspect test_print_accept callers never use this), (2)
-# it tests for the " =" (that could easily be moved to the callers,
-# (3) the pattern must be followed by \r\n and the prompt, not other
-# garbage as in gdb_test (this feature seems kind of worthwhile).
+# it tests for the " =" (that could easily be moved to the callers.
proc test_print_accept { args } {
global prompt
}
}
-
+proc skip_chill_tests {} {
+ return ![isnative]
+}