aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/break.exp
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>2003-12-09 18:19:20 +0000
committerFred Fish <fnf@specifix.com>2003-12-09 18:19:20 +0000
commita1dea79abed02b14c9984aecc843f1295366e54c (patch)
treeef2d6de68f91bb2ad567f20f2d21bd9016dbcbef /gdb/testsuite/gdb.base/break.exp
parent5533419b3dc29dea299870ccddd08fcb77187465 (diff)
downloadgdb-a1dea79abed02b14c9984aecc843f1295366e54c.zip
gdb-a1dea79abed02b14c9984aecc843f1295366e54c.tar.gz
gdb-a1dea79abed02b14c9984aecc843f1295366e54c.tar.bz2
Committed after testing and independent approval/endorsement.
2003-12-09 Fred Fish <fnf@redhat.com> * gdb.base/break.c (marker1, marker2, marker3, marker4): Move functions to break1.c and leave prototypes behind. Add more "set breakpoint NN here" comments. * gdb.base/break1.c: New file. * gdb.base/break.exp: Handle compiling test case from multiple source files and change source file references as needed. * gdb.base/completion.exp: Ditto. * gdb.base/condbreak.exp: Ditto. * gdb.base/define.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/info-proc.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/until.exp: Ditto. * gdb.base/condbreak.exp: Use bp_locationNN variables instead of hardcoded line numbers. * gdb.base/define.exp: Ditto. * gdb.base/ena-dis-br.exp: Ditto. * gdb.base/maint.exp: Ditto. * gdb.base/until.exp: Ditto. * gdb.base/completion.exp: Use "break1" for completion tests since "break" is no longer a unique prefix.
Diffstat (limited to 'gdb/testsuite/gdb.base/break.exp')
-rw-r--r--gdb/testsuite/gdb.base/break.exp83
1 files changed, 50 insertions, 33 deletions
diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp
index aa2e1dd..c425d14 100644
--- a/gdb/testsuite/gdb.base/break.exp
+++ b/gdb/testsuite/gdb.base/break.exp
@@ -34,10 +34,19 @@ set bug_id 0
set testfile "break"
set srcfile ${testfile}.c
+set srcfile1 ${testfile}1.c
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
if [get_compiler_info ${binfile}] {
@@ -87,7 +96,7 @@ gdb_test "break main" \
# test break at quoted function
#
gdb_test "break \"marker2\"" \
- "Breakpoint.*at.* file .*$srcfile, line.*" \
+ "Breakpoint.*at.* file .*$srcfile1, line.*" \
"breakpoint quoted function"
#
@@ -165,13 +174,13 @@ if {$hp_aCC_compiler} {
}
set bp_location7 [gdb_get_line_number "set breakpoint 7 here"]
-set bp_location8 [gdb_get_line_number "set breakpoint 8 here"]
-set bp_location9 [gdb_get_line_number "set breakpoint 9 here"]
+set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1]
+set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
gdb_test "info break" \
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.*
-\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile:($bp_location8|$bp_location9).*
+\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile1:($bp_location8|$bp_location9).*
\[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:$bp_location7.*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.*
@@ -232,7 +241,7 @@ for {set i 6} {$i >= 1} {incr i -1} {
#
# Run until the breakpoint set at a quoted function
#
-gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile:($bp_location8|$bp_location9).*" \
+gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*" \
"run until quoted breakpoint"
#
# run until the file:function breakpoint at a line number in a file
@@ -393,7 +402,7 @@ gdb_expect {
# Run to the desired default location. If not positioned here, the
# tests below don't work.
#
-gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" "until $bp_location1"
+gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" "until bp_location1"
# Verify that GDB allows one to just say "break", which is treated
@@ -445,10 +454,10 @@ if ![runto_main] then { fail "break tests suppressed" }
send_gdb "break $bp_location1\n"
gdb_expect {
-re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $"\
- {pass "set to-be-silent break $bp_location1"}
+ {pass "set to-be-silent break bp_location1"}
-re "$gdb_prompt $"\
- {fail "set to-be-silent break $bp_location1"}
- timeout {fail "(timeout) set to-be-silent break $bp_location1"}
+ {fail "set to-be-silent break bp_location1"}
+ timeout {fail "(timeout) set to-be-silent break bp_location1"}
}
send_gdb "commands $expect_out(1,string)\n"
@@ -456,33 +465,33 @@ send_gdb "silent\n"
send_gdb "end\n"
gdb_expect {
-re ".*$gdb_prompt $"\
- {pass "set silent break $bp_location1"}
- timeout {fail "(timeout) set silent break $bp_location1"}
+ {pass "set silent break bp_location1"}
+ timeout {fail "(timeout) set silent break bp_location1"}
}
send_gdb "info break $expect_out(1,string)\n"
gdb_expect {
-re "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*$gdb_prompt $"\
- {pass "info silent break $bp_location1"}
+ {pass "info silent break bp_location1"}
-re "$gdb_prompt $"\
- {fail "info silent break $bp_location1"}
- timeout {fail "(timeout) info silent break $bp_location1"}
+ {fail "info silent break bp_location1"}
+ timeout {fail "(timeout) info silent break bp_location1"}
}
send_gdb "continue\n"
gdb_expect {
-re "Continuing.\r\n$gdb_prompt $"\
- {pass "hit silent break $bp_location1"}
+ {pass "hit silent break bp_location1"}
-re "$gdb_prompt $"\
- {fail "hit silent break $bp_location1"}
- timeout {fail "(timeout) hit silent break $bp_location1"}
+ {fail "hit silent break bp_location1"}
+ timeout {fail "(timeout) hit silent break bp_location1"}
}
send_gdb "bt\n"
gdb_expect {
-re "#0 main .* at .*:$bp_location1.*$gdb_prompt $"\
- {pass "stopped for silent break $bp_location1"}
+ {pass "stopped for silent break bp_location1"}
-re "$gdb_prompt $"\
- {fail "stopped for silent break $bp_location1"}
- timeout {fail "(timeout) stopped for silent break $bp_location1"}
+ {fail "stopped for silent break bp_location1"}
+ timeout {fail "(timeout) stopped for silent break bp_location1"}
}
# Verify that GDB can at least parse a breakpoint with the
@@ -561,8 +570,8 @@ gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*}
send_gdb "set \$foo=$bp_location11\n"
gdb_expect {
-re "$gdb_prompt $"\
- {pass "set convenience variable \$foo to $bp_location11"}
- timeout {fail "(timeout) set convenience variable \$foo to $bp_location11"}
+ {pass "set convenience variable \$foo to bp_location11"}
+ timeout {fail "(timeout) set convenience variable \$foo to bp_location11"}
}
send_gdb "break \$foo\n"
gdb_expect {
@@ -849,8 +858,16 @@ test_next_with_recursion
set binfileo2 ${objdir}/${subdir}/${testfile}o2
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfileo2}" executable {debug additional_flags="-O2" }] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}O0.o" object {debug "additional_flags=-w -O2"}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}O1.o" object {debug "additional_flags=-w -O2"}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if { [gdb_compile "${binfile}O0.o ${binfile}O1.o" "${binfileo2}" executable {debug additional_flags=-w}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
if [get_compiler_info ${binfileo2}] {
@@ -877,7 +894,7 @@ gdb_test "break main" \
# test break at function
#
gdb_test "break marker4" \
- "Breakpoint.*at.* file .*$srcfile, line.*" \
+ "Breakpoint.*at.* file .*$srcfile1, line.*" \
"breakpoint small function, optimized file"
#
@@ -922,19 +939,19 @@ if ![target_info exists use_gdb_stub] {
# has no exactly matching line symbol, and GDB reports the breakpoint
# as if it were in the middle of a line rather than at the beginning.
-set bp_location13 [gdb_get_line_number "set breakpoint 13 here"]
-set bp_location14 [gdb_get_line_number "set breakpoint 14 here"]
+set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1]
+set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1]
send_gdb "continue\n"
gdb_expect {
- -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" {
+ -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" {
pass "run until breakpoint set at small function, optimized file"
}
- -re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" {
+ -re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" {
pass "run until breakpoint set at small function, optimized file"
}
- -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" {
+ -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" {
# marker4() is defined at line 46 when compiled with -DPROTOTYPES
- pass "run until breakpoint set at small function, optimized file (line $bp_location14)"
+ pass "run until breakpoint set at small function, optimized file (line bp_location14)"
}
-re ".*$gdb_prompt " {
fail "run until breakpoint set at small function, optimized file"