]> Git Repo - binutils.git/blobdiff - gdb/testsuite/gdb.base/watchpoint.exp
* gdb.base/break.exp: Don't test for program exit or exit status
[binutils.git] / gdb / testsuite / gdb.base / watchpoint.exp
index 86877def87ac545e3f264a8f99ac6ea88b242c14..2956313ab6e068fbf45e1d14a48e811748aadaab 100644 (file)
@@ -12,7 +12,7 @@
 # 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 # Please email any bugs, comments, and/or additions to this file to:
@@ -26,15 +26,14 @@ if $tracelevel then {
 set prms_id 0
 set bug_id 0
 
-set binfile "watchpoint"
-set srcfile $binfile.c
-
-if ![file exists $objdir/$subdir/$binfile] then {
-    perror "$objdir/$subdir/$binfile does not exist."
-    return 0
+set testfile "watchpoint"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if  { [compile "${srcdir}/${subdir}/${srcfile} -g -o ${binfile}"] != "" } {
+    perror "Couldn't compile ${srcfile}"
+    return -1
 }
 
-
 # Prepare for watchpoint tests by setting up two breakpoints and one
 # watchpoint.
 #
@@ -112,7 +111,7 @@ proc initialize {} {
 
     send "disable 3\n"
     expect {
-       -re "disable 3\r\n$prompt $" { pass "disable watchpoint" }
+       -re "disable 3\[\r\n\]+$prompt $" { pass "disable watchpoint" }
        -re ".*$prompt $" { fail "disable watchpoint" ; return 0 }
        timeout { fail "disable watchpoint (timeout)" ; return 0 }
     }
@@ -128,12 +127,13 @@ proc test_simple_watchpoint {} {
     global prompt
     global hex
     global decimal
+    global noresults
 
     # Ensure that the watchpoint is disabled when we startup.
 
     send "disable 3\n"
     expect {
-       -re "^disable 3\r\n$prompt $" {
+       -re "^disable 3\[\r\n\]+$prompt $" {
            pass "disable watchpoint in test_simple_watchpoint"
        }
        -re ".*$prompt $" {
@@ -167,7 +167,7 @@ proc test_simple_watchpoint {} {
 
     send "enable 3\n"
     expect {
-       -re "^enable 3\r\n$prompt $" { pass "enable watchpoint" }
+       -re "^enable 3\[\r\n\]+$prompt $" { pass "enable watchpoint" }
        -re ".*$prompt $" { fail "enable watchpoint" ; return }
        timeout { fail "enable watchpoint (timeout)" ; return }
     }
@@ -224,13 +224,15 @@ Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count
 
     send "disable 3\n"
     expect {
-       -re "^disable 3\r\n$prompt $" { pass "watchpoint disabled" }
+       -re "^disable 3\[\r\n\]+$prompt $" { pass "watchpoint disabled" }
        -re ".*$prompt $" { fail "watchpoint disabled" ; return }
        timeout { fail "watchpoint disabled (timeout)" ; return }
     }
 
     # Run until process exits.
 
+    if $noresults==1 then { return }
+
     gdb_test "cont" "Continuing.*Program exited normally.*" \
        "continue to exit in test_simple_watchpoint"
 }
@@ -243,12 +245,13 @@ proc test_disabling_watchpoints {} {
     global srcfile
     global decimal
     global hex
+    global noresults
 
     # Ensure that the watchpoint is disabled when we startup.
 
     send "disable 3\n"
     expect {
-       -re "^disable 3\r\n$prompt $" {
+       -re "^disable 3\[\r\n\]+$prompt $" {
            pass "disable watchpoint in test_disabling_watchpoints"
        }
        -re ".*$prompt $" {
@@ -282,7 +285,7 @@ proc test_disabling_watchpoints {} {
 
     send "enable 3\n"
     expect {
-       -re "^enable 3\r\n$prompt $" { pass "watchpoint enabled" }
+       -re "^enable 3\[\r\n\]+$prompt $" { pass "watchpoint enabled" }
        -re ".*$prompt $" { fail "watchpoint enabled" ; return }
        timeout { fail "watchpoint enabled (timeout)" ; return }
     }
@@ -299,7 +302,7 @@ proc test_disabling_watchpoints {} {
 
     send "disable 3\n"
     expect {
-       -re "^disable 3\r\n$prompt $" {
+       -re "^disable 3\[\r\n\]+$prompt $" {
            pass "disable watchpoint #2 in test_disabling_watchpoints"
        }
        -re ".*$prompt $" {
@@ -321,6 +324,8 @@ proc test_disabling_watchpoints {} {
     gdb_test "cont" "Continuing.*Breakpoint.*marker2 \\(\\).*" \
        "disabled watchpoint skipped"
     
+    if $noresults==1 then { return }
+
     gdb_test "cont" "Continuing.*Program exited normally.*" \
        "continue to exit in test_disabling_watchpoints"
 }
@@ -424,8 +429,12 @@ proc test_stepping {} {
 # Test stepping and other mundane operations with watchpoints enabled
 proc test_watchpoint_triggered_in_syscall {} {
     global prompt
-    global timeout
+    global noinferiorio
 
+    if $noinferiorio {
+       verbose "Skipping test_watchpoint_triggered_in_syscall due to noinferiorio"
+       return
+    }
     # Run until we get to the first marker function.
     set x 0
     set y 0
@@ -538,7 +547,7 @@ proc test_complex_watchpoint {} {
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $objdir/$subdir/$binfile
+gdb_load $binfile
 
 if [initialize] then {
 
@@ -551,7 +560,7 @@ if [initialize] then {
        gdb_exit
        gdb_start
        gdb_reinitialize_dir $srcdir/$subdir
-       gdb_load $objdir/$subdir/$binfile
+       gdb_load $binfile
        initialize
     }
 
@@ -562,7 +571,7 @@ if [initialize] then {
        gdb_exit
        gdb_start
        gdb_reinitialize_dir $srcdir/$subdir
-       gdb_load $objdir/$subdir/$binfile
+       gdb_load $binfile
        initialize
     }
 
@@ -573,7 +582,7 @@ if [initialize] then {
        gdb_exit
        gdb_start
        gdb_reinitialize_dir $srcdir/$subdir
-       gdb_load $objdir/$subdir/$binfile
+       gdb_load $binfile
        initialize
     }
 
@@ -590,7 +599,7 @@ if [initialize] then {
        gdb_exit
        gdb_start
        gdb_reinitialize_dir $srcdir/$subdir
-       gdb_load $objdir/$subdir/$binfile
+       gdb_load $binfile
        initialize
     }
 
This page took 0.034279 seconds and 4 git commands to generate.