* 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.
This commit is contained in:
Jim Kingdon 1995-03-14 21:25:19 +00:00
parent 35f37e1e66
commit 4081daa1ed
11 changed files with 276 additions and 286 deletions

View file

@ -1,5 +1,15 @@
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 *.

View file

@ -1,4 +1,4 @@
# 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
@ -73,73 +73,50 @@ expect {
#
# 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
@ -306,12 +283,12 @@ expect {
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]+.*}
}
#
@ -364,7 +341,7 @@ proc test_next_with_recursion {} {
# 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 }
@ -402,12 +379,12 @@ proc test_next_with_recursion {} {
# 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"
}
@ -420,8 +397,3 @@ if [istarget "*-*-vxworks"] then {
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
}

View file

@ -89,18 +89,18 @@ if ![file exists $binfile] then {
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.*"
}
}
}

View file

@ -802,19 +802,19 @@ proc test_print_strings {} {
# 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 $"
@ -903,7 +903,7 @@ proc test_print_int_arrays {} {
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})"
}
@ -1008,7 +1008,7 @@ gdb_exit
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.

View file

@ -1,4 +1,4 @@
# 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
@ -45,13 +45,13 @@ proc test_at_main {} {
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 }
@ -62,7 +62,7 @@ proc test_at_main {} {
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
@ -71,18 +71,18 @@ proc test_at_main {} {
# 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
}
}
@ -90,8 +90,10 @@ proc test_at_main {} {
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
}
@ -100,7 +102,9 @@ proc test_at_main {} {
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
@ -115,7 +119,7 @@ proc test_at_main {} {
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
@ -125,7 +129,9 @@ proc test_at_main {} {
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
@ -141,7 +147,9 @@ proc test_at_main {} {
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
@ -157,7 +165,9 @@ proc test_at_main {} {
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
@ -173,7 +183,9 @@ proc test_at_main {} {
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
@ -189,7 +201,7 @@ proc test_at_main {} {
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
@ -199,7 +211,9 @@ proc test_at_main {} {
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
@ -214,7 +228,9 @@ proc test_at_main {} {
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
@ -224,7 +240,8 @@ proc test_at_main {} {
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
@ -239,7 +256,7 @@ proc test_at_main {} {
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
@ -249,7 +266,9 @@ proc test_at_main {} {
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
@ -259,9 +278,6 @@ proc test_at_main {} {
fail "print 'scope1.c'::bar::funclocal" ; return
}
}
clear_xfail "*-*-*"
pass "$passcount correct scope resolutions from main()"
}
proc test_at_foo {} {
@ -271,8 +287,6 @@ proc test_at_foo {} {
global srcdir
global subdir
set passcount 0
send "next\n"
expect {
-re ".*bar \[)(\]+;\r\n$prompt $" {}
@ -283,18 +297,18 @@ proc test_at_foo {} {
# 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
}
}
@ -303,7 +317,7 @@ proc test_at_foo {} {
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
@ -319,7 +333,7 @@ proc test_at_foo {} {
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
@ -334,7 +348,7 @@ proc test_at_foo {} {
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
@ -344,7 +358,7 @@ proc test_at_foo {} {
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
@ -359,7 +373,7 @@ proc test_at_foo {} {
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
@ -369,7 +383,7 @@ proc test_at_foo {} {
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
@ -384,7 +398,7 @@ proc test_at_foo {} {
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
@ -394,7 +408,7 @@ proc test_at_foo {} {
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
@ -409,7 +423,7 @@ proc test_at_foo {} {
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
@ -419,7 +433,7 @@ proc test_at_foo {} {
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
@ -429,7 +443,7 @@ proc test_at_foo {} {
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
@ -444,7 +458,7 @@ proc test_at_foo {} {
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
@ -453,7 +467,7 @@ proc test_at_foo {} {
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
@ -463,7 +477,7 @@ proc test_at_foo {} {
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
@ -478,7 +492,7 @@ proc test_at_foo {} {
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
@ -487,7 +501,7 @@ proc test_at_foo {} {
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
@ -497,7 +511,7 @@ proc test_at_foo {} {
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
@ -512,7 +526,7 @@ proc test_at_foo {} {
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
@ -522,7 +536,7 @@ proc test_at_foo {} {
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
@ -532,9 +546,6 @@ proc test_at_foo {} {
fail "(timeout) print 'scope1.c'::bar::funclocal" ; return
}
}
clear_xfail "*-*-*"
pass "$passcount correct scope resolutions from foo()"
}
proc test_at_bar {} {
@ -544,8 +555,6 @@ proc test_at_bar {} {
global srcdir
global subdir
set passcount 0
send "next\n"
expect {
-re ".*$prompt $" {}
@ -555,18 +564,18 @@ proc test_at_bar {} {
# 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
}
}
@ -575,7 +584,7 @@ proc test_at_bar {} {
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
@ -591,7 +600,7 @@ proc test_at_bar {} {
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
@ -606,7 +615,7 @@ proc test_at_bar {} {
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
@ -616,7 +625,7 @@ proc test_at_bar {} {
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
@ -631,7 +640,7 @@ proc test_at_bar {} {
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
@ -641,7 +650,7 @@ proc test_at_bar {} {
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
@ -656,7 +665,7 @@ proc test_at_bar {} {
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
@ -666,7 +675,7 @@ proc test_at_bar {} {
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
@ -682,7 +691,7 @@ proc test_at_bar {} {
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
@ -692,7 +701,7 @@ proc test_at_bar {} {
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
@ -707,7 +716,7 @@ proc test_at_bar {} {
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
@ -717,7 +726,7 @@ proc test_at_bar {} {
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
@ -732,7 +741,7 @@ proc test_at_bar {} {
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
@ -742,7 +751,7 @@ proc test_at_bar {} {
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
@ -757,7 +766,7 @@ proc test_at_bar {} {
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
@ -766,7 +775,7 @@ proc test_at_bar {} {
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
@ -776,7 +785,7 @@ proc test_at_bar {} {
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
@ -791,7 +800,7 @@ proc test_at_bar {} {
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
@ -800,7 +809,7 @@ proc test_at_bar {} {
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
@ -810,7 +819,7 @@ proc test_at_bar {} {
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
@ -820,9 +829,6 @@ proc test_at_bar {} {
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
@ -869,7 +875,7 @@ proc test_at_autovars {} {
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 {} {
@ -878,8 +884,6 @@ 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 $"
@ -901,7 +905,7 @@ proc test_at_localscopes {} {
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
@ -909,14 +913,14 @@ proc test_at_localscopes {} {
}
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 }
@ -924,7 +928,7 @@ proc test_at_localscopes {} {
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 }
@ -947,7 +951,7 @@ proc test_at_localscopes {} {
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
}
@ -958,20 +962,20 @@ proc test_at_localscopes {} {
}
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 }
@ -996,7 +1000,7 @@ proc test_at_localscopes {} {
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
}
@ -1006,25 +1010,22 @@ proc test_at_localscopes {} {
}
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.
@ -1068,7 +1069,8 @@ expect {
# 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 {
@ -1078,11 +1080,6 @@ 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.
@ -1091,11 +1088,6 @@ 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 bar] then { test_at_bar }
if [istarget "mips-idt-*"] then {
# Restart because IDT/SIM runs out of file descriptors.
@ -1104,11 +1096,6 @@ 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 localscopes] then { test_at_localscopes }
if [istarget "mips-idt-*"] then {
# Restart because IDT/SIM runs out of file descriptors.
@ -1117,18 +1104,8 @@ 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 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
}

View file

@ -5,7 +5,6 @@ if $tracelevel then {
set prms_id 0
set bug_id 0
gdb_reinitialize_dir $srcdir/$subdir
set binfile $objdir/$subdir/signals
if ![file exists $binfile] then {
@ -16,11 +15,11 @@ 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
@ -63,7 +62,7 @@ proc signal_tests_1 {} {
# 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 $" {
@ -90,34 +89,38 @@ proc signal_tests_1 {} {
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.
@ -125,7 +128,7 @@ proc signal_tests_1 {} {
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.
@ -134,8 +137,9 @@ proc signal_tests_1 {} {
# 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 $" {
@ -143,13 +147,27 @@ proc signal_tests_1 {} {
# 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.
@ -165,13 +183,14 @@ proc signal_tests_1 {} {
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
@ -191,7 +210,7 @@ proc signal_tests_1 {} {
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.
@ -203,7 +222,8 @@ proc signal_tests_1 {} {
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 "
}
}
@ -226,6 +246,7 @@ if {[ istarget "m68*-motorola-*" ] || [ istarget "hppa*-*-bsd*" ] ||
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
signal_tests_1
@ -239,13 +260,14 @@ expect {
}
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
@ -254,31 +276,34 @@ if [runto main] then {
# 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

View file

@ -1,4 +1,4 @@
# 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
@ -36,6 +36,10 @@ if ![file exists $objdir/$subdir/$binfile] then {
return 0
}
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $objdir/$subdir/$binfile
@ -90,11 +94,11 @@ gdb_test "whatis v_unsigned_char" \
"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" \
@ -117,14 +121,14 @@ 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_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
@ -163,7 +167,7 @@ gdb_test "whatis v_short_array" \
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" \
@ -211,60 +215,60 @@ gdb_test "whatis v_double_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"
@ -291,67 +295,67 @@ gdb_test "whatis v_union2" \
# 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" \

View file

@ -48,7 +48,7 @@ proc set_lang_chill {} {
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\""]
}
@ -76,6 +76,6 @@ if ![set_lang_chill] then {
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"
}

View file

@ -41,7 +41,9 @@ proc do_tests {} {
# 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

View file

@ -41,7 +41,7 @@ proc do_tests {} {
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

View file

@ -50,7 +50,7 @@ proc default_gdb_version {} {
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 {
@ -237,7 +237,7 @@ proc gdb_test { args } {
gdb_start
set result -1
}
-re "$pattern.*$prompt $" {
-re "$pattern\r\n$prompt $" {
if ![string match "" $message] then {
pass "$message"
}
@ -296,9 +296,7 @@ proc gdb_test { args } {
#
# 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
@ -612,4 +610,6 @@ if ![info exists argv0] then {
}
}
proc skip_chill_tests {} {
return ![isnative]
}