This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] gdb.threads/*.exp: send_gdb vs. gdb_test


Sorry I haven't changed the changelog msg yet,
I'll do them all at once.
2010-05-26  Michael Snyder  <msnyder@msnyder-server.eng.vmware.com>

	* gdb.threads/attach-stopped.exp: Replace send_gdb with gdb_test.
	* gdb.threads/attachstop-mt.exp: Replace send_gdb with gdb_test.
	* gdb.threads/gcore-thread.exp: Replace send_gdb with gdb_test.
	* gdb.threads/hand-call-in-threads.exp: Replace send_gdb with gdb_test.
	* gdb.threads/linux-dp.exp: Replace send_gdb with gdb_test.
	* gdb.threads/print-threads.exp: Replace send_gdb with gdb_test.
	* gdb.threads/pthreads.exp: Replace send_gdb with gdb_test.
	* gdb.threads/schedlock.exp: Replace send_gdb with gdb_test.
	* gdb.threads/sigthread.exp: Replace send_gdb with gdb_test.

Index: attach-stopped.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/attach-stopped.exp,v
retrieving revision 1.4
diff -u -p -r1.4 attach-stopped.exp
--- attach-stopped.exp	1 Jan 2010 07:32:06 -0000	1.4
+++ attach-stopped.exp	27 May 2010 00:24:10 -0000
@@ -80,12 +80,10 @@ proc corefunc { threadtype } {
     # This breakpoint is there for old/non-x86 kernels not restarting syscalls.
     gdb_breakpoint [gdb_get_line_number "Second sleep"]
     set test "$threadtype: attach2 continue"
-    send_gdb "continue\n"
-    gdb_expect {
-      -re "Continuing"
-	{ pass "continue ($test)" }
-      timeout
-	{ fail "continue ($test) (timeout)" }
+    gdb_test_multiple "continue" "continue ($test)" {
+	-re "Continuing" {
+	    pass "continue ($test)"
+	}
     }
 
     # For this to work we must be sure to consume the "Continuing."
Index: attachstop-mt.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/attachstop-mt.exp,v
retrieving revision 1.5
diff -u -p -r1.5 attachstop-mt.exp
--- attachstop-mt.exp	1 Jan 2010 07:32:06 -0000	1.5
+++ attachstop-mt.exp	27 May 2010 00:24:10 -0000
@@ -211,12 +211,10 @@ gdb_test "bt" ".*sleep.*(func|main).*" "
 gdb_breakpoint [gdb_get_line_number "Ridiculous time"]
 gdb_breakpoint [gdb_get_line_number "cut the sleep time"]
 set test "attach4 continue"
-send_gdb "continue\n"
-gdb_expect {
-  -re "Continuing"
-    { pass "continue ($test)" }
-  timeout
-    { fail "continue ($test) (timeout)" }
+gdb_test_multiple "continue" "continue ($test)" {
+    -re "Continuing" {
+	pass "continue ($test)"
+    }
 }
 
 # For this to work we must be sure to consume the "Continuing."
Index: gcore-thread.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/gcore-thread.exp,v
retrieving revision 1.16
diff -u -p -r1.16 gcore-thread.exp
--- gcore-thread.exp	5 May 2010 18:07:03 -0000	1.16
+++ gcore-thread.exp	27 May 2010 00:24:10 -0000
@@ -56,8 +56,7 @@ set nl "\[\r\n\]+"
 set prev_timeout $timeout
 set timeout 30
 
-send_gdb "help gcore\n"
-gdb_expect {
+gdb_test_multiple "help gcore" "help gcore" {
     -re "Undefined command: .gcore.*$gdb_prompt $" {
 	# gcore command not supported -- nothing to test here.
 	unsupported "gdb does not support gcore on this target"
@@ -66,12 +65,6 @@ gdb_expect {
     -re "Save a core file .*$gdb_prompt $" {
 	pass "help gcore"
     }
-    -re ".*$gdb_prompt $" {
-	fail "help gcore"
-    }
-    timeout {
-	fail "help gcore (timeout)"
-    }
 }
 
 if { ! [ runto_main ] } then {
@@ -79,8 +72,7 @@ if { ! [ runto_main ] } then {
     return -1
 }
 
-send_gdb "info threads\n"
-gdb_expect {
+gdb_test_multiple "info threads" "threads are supported" {
     -re ".* main .*$gdb_prompt $" {
 	# OK, threads are supported.
     }
@@ -128,31 +120,25 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-send_gdb "core ${objdir}/${subdir}/gcore.test\n"
-gdb_expect {
-    -re ".* is not a core dump:.*$gdb_prompt $" {
-	fail "re-load generated corefile (bad file format)"
-	# No use proceeding from here.
-	return;	
-    }
-    -re ".*: No such file or directory.*$gdb_prompt $" {
-	fail "re-load generated corefile (file not found)"
-	# No use proceeding from here.
-	return;	
-    }
-    -re ".*Couldn't find .* registers in core file.*$gdb_prompt $" {
-	fail "re-load generated corefile (incomplete note section)"
+gdb_test_multiple "core ${objdir}/${subdir}/gcore.test" \
+    "re-load generated corefile" {
+	-re ".* is not a core dump:.*$gdb_prompt $" {
+	    fail "re-load generated corefile (bad file format)"
+	    # No use proceeding from here.
+	    return;
+	}
+	-re ".*: No such file or directory.*$gdb_prompt $" {
+	    fail "re-load generated corefile (file not found)"
+	    # No use proceeding from here.
+	    return;
+	}
+	-re ".*Couldn't find .* registers in core file.*$gdb_prompt $" {
+	    fail "re-load generated corefile (incomplete note section)"
+	}
+	-re "Core was generated by .*$gdb_prompt $" {
+	    pass "re-load generated corefile"
+	}
     }
-    -re "Core was generated by .*$gdb_prompt $" {
-	pass "re-load generated corefile"
-    }
-    -re ".*$gdb_prompt $" {
-	fail "re-load generated corefile"
-    }
-    timeout {
-	fail "re-load generated corefile (timeout)"
-    }
-}
 
 # FIXME: now what can we test about the thread state?
 # We do not know for certain that there should be at least 
Index: hand-call-in-threads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/hand-call-in-threads.exp,v
retrieving revision 1.2
diff -u -p -r1.2 hand-call-in-threads.exp
--- hand-call-in-threads.exp	1 Jan 2010 07:32:06 -0000	1.2
+++ hand-call-in-threads.exp	27 May 2010 00:24:10 -0000
@@ -38,24 +38,20 @@ if [target_info exists gdb,cannot_call_f
 }
 
 proc get_dummy_frame_number { } {
-  global gdb_prompt
+    global gdb_prompt
 
-  send_gdb "bt\n"
-  gdb_expect {
-    -re "#(\[0-9\]*) *<function called from gdb>.*$gdb_prompt $"
-      {
-	return $expect_out(1,string)
-      }
-    -re "$gdb_prompt $"
-      {
-	return ""
-      }
-    timeout
-      {
-	return ""
-      }
-  }
-  return ""
+    gdb_test_multiple "bt" "" {
+	-re "#(\[0-9\]*) *<function called from gdb>.*$gdb_prompt $" {
+	    return $expect_out(1,string)
+	}
+	-re "$gdb_prompt $" {
+	    return ""
+	}
+	timeout {
+	    return ""
+	}
+    }
+    return ""
 }
 
 gdb_exit
Index: linux-dp.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/linux-dp.exp,v
retrieving revision 1.24
diff -u -p -r1.24 linux-dp.exp
--- linux-dp.exp	5 May 2010 18:07:03 -0000	1.24
+++ linux-dp.exp	27 May 2010 00:24:10 -0000
@@ -54,7 +54,7 @@ if {[gdb_compile_pthreads "${srcdir}/${s
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
-send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
+gdb_test_no_output "set print sevenbit-strings"
 runto_main
 
 # There should be no threads initially.
@@ -65,9 +65,8 @@ gdb_breakpoint [gdb_get_line_number "lin
 set expect_manager -1
 for {set i 0} {$i < 5} {incr i} {
     gdb_continue_to_breakpoint "about to create philosopher: $i"
-    send_gdb "info threads\n"
     set threads_before {}
-    gdb_expect {
+    gdb_test_multiple "info threads" "info threads before: $i" {
 	-re "info threads\r\n" {
 	    exp_continue
 	}
@@ -82,13 +81,9 @@ for {set i 0} {$i < 5} {incr i} {
 	}
 	-re "^$gdb_prompt $" {
 	}
-	timeout {
-	    fail "(timeout) info threads before: $i"
-	}
     }
-    send_gdb "next\n"
     set threads_created 0
-    gdb_expect {
+    gdb_test_multiple "next" "create philosopher: $i" {
 	-re "^next\r\n" {
 	    exp_continue
 	}
@@ -114,9 +109,6 @@ for {set i 0} {$i < 5} {incr i} {
 	}
 	-re "$gdb_prompt $" {
 	}
-	timeout {
-	    fail "(timeout) create philosopher: $i"
-	}
     }
     if { $threads_created == 0 } {
 	# Not all targets announce new threads as they are created.
@@ -139,9 +131,8 @@ for {set i 0} {$i < 5} {incr i} {
 	fail "create philosopher: $i"
     }
     
-    send_gdb "info threads\n"
     set threads_after {}
-    gdb_expect {
+    gdb_test_multiple "info threads" "info threads after: $i" {
 	-re "info threads\r\n" {
 	    exp_continue
 	}
@@ -178,11 +169,7 @@ for {set i 0} {$i < 5} {incr i} {
 		fail "info threads after: $i"
 	    }
 	}
-	timeout {
-	    fail "(timeout) info threads after: $i"
-	}
     }
-    
 }
 
 set nthreads 6
@@ -257,8 +244,7 @@ gdb_test "where" "print_philosopher.*phi
 set only_five 1
 for {set i 0} {$only_five > 0 && $i < 10} {incr i} {
     gdb_continue_to_breakpoint "thread 5's print, pass: $i"
-    send_gdb "info threads\n"
-    gdb_expect {
+    gdb_test_multiple "info threads" "" {
 	-re "\\* 5 Thread .*  print_philosopher .*\r\n$gdb_prompt $" {
 	    # Okay this time.
 	}
@@ -281,18 +267,9 @@ if {$only_five == -1} { fail "$name (tim
 proc select_thread {thread} {
     global gdb_prompt
 
-    send_gdb "thread $thread\n"
-    gdb_expect {
-	-re "\\\[Switching to thread .*\\\].*\r\n$gdb_prompt $" {
-	    pass "selected thread: $thread"
-	}
-	-re "$gdb_prompt $" {
-	    fail "selected thread: $thread"
-	}
-	timeout {
-	    fail "selected thread: $thread (timeout)"
-	}
-    }
+    gdb_test "thread $thread" \
+	"\\\[Switching to thread .*\\\].*" \
+	"selected thread: $thread"
 }
 
 ### Select THREAD, check for a plausible backtrace, and make sure
@@ -314,8 +291,7 @@ proc check_philosopher_stack {thread see
     set interesting 0
 
     select_thread $thread
-    send_gdb "where\n"
-    gdb_expect {
+    gdb_test_multiple "where" "$name" {
 	-re ".* in philosopher \\(data=(0x\[0-9a-f\]+).*\r\n$gdb_prompt $" {
 	    set data $expect_out(1,string)
 	    if {[info exists seen($data)]} {
@@ -356,12 +332,6 @@ proc check_philosopher_stack {thread see
 	    ## be an xfail.
 	    pass $name
 	}
-	-re "$gdb_prompt $" {
-	    fail $name
-	}
-	timeout {
-	    fail "$name (timeout)" 
-	}
     }
 
     return $interesting
Index: print-threads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/print-threads.exp,v
retrieving revision 1.14
diff -u -p -r1.14 print-threads.exp
--- print-threads.exp	5 May 2010 18:07:03 -0000	1.14
+++ print-threads.exp	27 May 2010 00:24:10 -0000
@@ -63,8 +63,7 @@ proc test_all_threads { name kill } {
 
     set i 0
     set j 0
-    send_gdb "continue\n"
-    gdb_expect {
+    gdb_test_multiple "continue" "all threads ran once" {
 	-re "Breakpoint \[0-9\]+, thread_function \\(arg=.*\\) at .*print-threads.c:\[0-9\]+.*$gdb_prompt" {
 	    set i [expr $i + 1]
 	    pass "Hit thread_function breakpoint, $i ($name)"
@@ -96,12 +95,6 @@ proc test_all_threads { name kill } {
 		fail "Running threads ($name) (unknown output)"
 	    }
 	}
-	-re "$gdb_prompt" {
-	    fail "Running threads ($name) (unknown output)"
-	}
-	timeout {
-	    fail "Running threads ($name) (timeout)"
-	}
     }
 }
 
Index: pthreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/pthreads.exp,v
retrieving revision 1.19
diff -u -p -r1.19 pthreads.exp
--- pthreads.exp	5 May 2010 18:07:03 -0000	1.19
+++ pthreads.exp	27 May 2010 00:24:10 -0000
@@ -88,9 +88,9 @@ proc all_threads_running {} {
     # to stop.  Since no other breakpoints are set at this time
     # we should stop only when we have been previously called 15 times.
 
-    send_gdb "continue\n"
-    gdb_expect {
-	-re "Continuing.*common_routine.*at.*$srcfile.*$gdb_prompt $" {}
+    gdb_test_multiple "continue" "continue until common routine run 15 times" {
+	-re "Continuing.*common_routine.*at.*$srcfile.*$gdb_prompt $" {
+	}
 	default {
 	    fail "continue until common routine run 15 times"
 	    return 0
@@ -109,50 +109,31 @@ proc all_threads_running {} {
     # trap and the next.  So stopping after 16 or 17 hits should be
     # considered acceptable.
 
-    send_gdb "p common_routine::hits\n"
-    gdb_expect {
-	-re ".*= 15\r\n$gdb_prompt $" {
-	    pass "stopped before calling common_routine 15 times"
-	}
-	-re ".*= 16\r\n$gdb_prompt $" {
-	    pass "stopped before calling common_routine 15 times (16 times)"
-	}
-	-re ".*= 17\r\n$gdb_prompt $" {
-	    pass "stopped before calling common_routine 15 times (17 times)"
-	}
-	default {
-	    fail "stopped before calling common_routine 15 times"
-	    return 0
-	}
-	-re ".*$gdb_prompt $" {
-	    fail "stopped before calling common_routine 15 times"
-	    return 0
-	}
-	timeout {
-	    fail "stopped before calling common_routine 15 times (timeout)"
-	    return 0
+    gdb_test_multiple "p common_routine::hits" \
+	"stopped before calling common_routine 15 times" {
+	    -re ".*= 15\r\n$gdb_prompt $" {
+		pass "stopped before calling common_routine 15 times"
+	    }
+	    -re ".*= 16\r\n$gdb_prompt $" {
+		pass "stopped before calling common_routine 15 times (16 times)"
+	    }
+	    -re ".*= 17\r\n$gdb_prompt $" {
+		pass "stopped before calling common_routine 15 times (17 times)"
+	    }
 	}
-    }
 
     # Also check that all of the threads have run, which will only be true
     # if the full_coverage variable is set.
 
-    send_gdb "p common_routine::full_coverage\n"
-    gdb_expect {
-	-re ".* = 1.*$gdb_prompt $" {}
-	-re ".* = 0.*$gdb_prompt $" {
-	    fail "some threads didn't run"
-	    return 0
-	}
-	default {
-	    fail "some threads didn't run"
-	    return 0
-	}
-	timeout {
-	    fail "some threads didn't run (timeout)"
-	    return 0
+    gdb_test_multiple "p common_routine::full_coverage" \
+	"some threads didn't run" {
+	    -re ".* = 1.*$gdb_prompt $" {
+	    }
+	    -re ".* = 0.*$gdb_prompt $" {
+		fail "some threads didn't run"
+		return 0
+	    }
 	}
-    }
 
     # Looks fine, return success.
     return 1
@@ -164,8 +145,7 @@ proc test_startup {} {
     global main_id thread1_id thread2_id
 
     # We should be able to do an info threads before starting any others.
-    send_gdb "info threads\n"
-    gdb_expect {
+    gdb_test_multiple "info threads" "info threads" {
 	-re ".*Thread.*main.*$gdb_prompt $" {
 	    pass "info threads"
 	}
@@ -176,8 +156,11 @@ proc test_startup {} {
     }
 
     # Extract the thread id number of main thread from "info threads" output.
-    send_gdb "info threads\n"
-    gdb_expect -re "(\[0-9\]+)(${horiz}Thread${horiz}main.*)($gdb_prompt $)"
+    gdb_test_multiple "info threads" "get main thread id" {
+	-re "(\[0-9\]+)(${horiz}Thread${horiz}main.*)($gdb_prompt $)" {
+	}
+    }
+
     set main_id $expect_out(1,string)
 
     # Check that we can continue and create the first thread.
@@ -188,8 +171,11 @@ proc test_startup {} {
     gdb_test "disable" ""
 
     # Extract the thread id number of thread 1 from "info threads" output.
-    send_gdb "info threads\n"
-    gdb_expect -re "(\[0-9\]+)(${horiz}Thread${horiz}thread1.*)($gdb_prompt $)"
+    gdb_test_multiple "info threads" "get thread 1 id" {
+	-re "(\[0-9\]+)(${horiz}Thread${horiz}thread1.*)($gdb_prompt $)" {
+	}
+    }
+
     set thread1_id $expect_out(1,string)
 
     # Check that we can continue and create the second thread,
@@ -200,8 +186,11 @@ proc test_startup {} {
 	    "Continue to creation of second thread"
 
     # Extract the thread id number of thread 2 from "info threads" output.
-    send_gdb "info threads\n"
-    gdb_expect -re "(\[0-9\]+)(${horiz}Thread${horiz}thread2.*)($gdb_prompt $)"
+    gdb_test_multiple "info threads" "get thread 2 id" {
+	-re "(\[0-9\]+)(${horiz}Thread${horiz}thread2.*)($gdb_prompt $)" {
+	}
+    }
+
     set thread2_id $expect_out(1,string)
 
     return 1
@@ -216,14 +205,10 @@ proc check_control_c {} {
     }
 
     # Send a continue followed by ^C to the process to stop it.
-    send_gdb "continue\n"
-    gdb_expect {
+    gdb_test_multiple "continue" "continue with all threads running" {
 	-re "Continuing." {
 	    pass "Continue with all threads running"
 	}
-	timeout {
-	    fail "Continue with all threads running (timeout)"
-	}
     }
     after 2000
     send_gdb "\003"
@@ -278,22 +263,12 @@ proc check_backtraces {} {
 	    "Breakpoint .* at 0x.* file .* line .*" \
 	    "set break at common_routine in thread 2"
 
-    send_gdb "continue\n"
-    gdb_expect {
+    gdb_test_multiple "continue" "continue to bkpt at common_routine in thread 2" {
 	-re "Breakpoint .* common_routine \\(arg=2\\).*" {
 	    pass "continue to bkpt at common_routine in thread 2"
-	    send_gdb "backtrace\n"
-	    gdb_expect {
-		-re "#0.*common_routine \\(arg=2\\).*#1.*thread2.*" {
-		    pass "backtrace from thread 2 bkpt in common_routine"
-		}
-		default {
-		    fail "backtrace from thread 2 bkpt in common_routine"
-		}
-		timeout {
-		    fail "backtrace from thread 2 bkpt in common_routine (timeout)"
-		}
-	    }
+	    gdb_test "backtrace" \
+		"#0.*common_routine \\(arg=2\\).*#1.*thread2.*" \
+		"backtrace from thread 2 bkpt in common_routine"
 	}
 	-re "Breakpoint .* common_routine \\(arg=0\\).*" {
 	    fail "continue to bkpt at common_routine in thread 2 (arg=0)"
@@ -301,15 +276,6 @@ proc check_backtraces {} {
 	-re "Breakpoint .* common_routine \\(arg=1\\).*" {
 	    fail "continue to bkpt at common_routine in thread 2 (arg=1)"
 	}
-	-re ".*$gdb_prompt" {
-	    fail "continue to bkpt at common_routine in thread 2"
-	}
-	default {
-	    fail "continue to bkpt at common_routine in thread 2 (default)"
-	}
-	timeout {
-	    fail "continue to bkpt at common_routine in thread 2 (timeout)"
-	}
     }
 }
 
Index: schedlock.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/schedlock.exp,v
retrieving revision 1.13
diff -u -p -r1.13 schedlock.exp
--- schedlock.exp	5 May 2010 18:07:03 -0000	1.13
+++ schedlock.exp	27 May 2010 00:24:10 -0000
@@ -38,37 +38,27 @@ if {[gdb_compile_pthreads "${srcdir}/${s
 # Now we can proceed with the real testing.
 
 proc get_args { } {
-  global list_count
-  global gdb_prompt
-  global NUM
-
-  set pattern "(\[0-9\]+)"
-  for {set i 1} {[expr $i < $NUM]} {incr i} {
-    append pattern ", (\[0-9\]+)"
-  }
+    global list_count
+    global gdb_prompt
+    global NUM
 
-  send_gdb "print args\n"
-  gdb_expect {
-    -re "\\\$\[0-9\]+ = {$pattern}.*$gdb_prompt"
-      {
-	set list_count [expr $list_count + 1]
-	pass "listed args ($list_count)"
+    set pattern "(\[0-9\]+)"
+    for {set i 1} {[expr $i < $NUM]} {incr i} {
+	append pattern ", (\[0-9\]+)"
+    }
 
-	set result ""
-	for {set i 1} {[expr $i <= $NUM]} {incr i} {
-	  lappend result $expect_out($i,string)
+    gdb_test_multiple "print args" "listed args ($list_count)" {
+	-re "\\\$\[0-9\]+ = {$pattern}.*$gdb_prompt $" {
+	    set list_count [expr $list_count + 1]
+	    pass "listed args ($list_count)"
+
+	    set result ""
+	    for {set i 1} {[expr $i <= $NUM]} {incr i} {
+		lappend result $expect_out($i,string)
+	    }
+	    return $result
 	}
-	return $result
-      }
-    -re "$gdb_prompt"
-      {
-	fail "listed args ($list_count) (unknown output)"
-      }
-    timeout
-      {
-	fail "listed args ($list_count) (timeout)"
-      }
-  }
+    }
 }
 
 proc stop_process { description } {
@@ -90,50 +80,38 @@ proc stop_process { description } {
 }
 
 proc get_current_thread { description } {
-  global gdb_prompt
+    global gdb_prompt
 
-  send_gdb "bt\n"
-  gdb_expect {
-    -re "thread_function \\(arg=0x(\[0-9\])\\).*$gdb_prompt $"
-      {
-	pass $description
-	return $expect_out(1,string)
-      }
-    -re "$gdb_prompt $"
-      {
-	fail "$description (unknown output)"
-      }
-    timeout
-      {
-	fail "$description (timeout)"
-      }
-  }
+    gdb_test_multiple "bt" "$description" {
+	-re "thread_function \\(arg=0x(\[0-9\])\\).*$gdb_prompt $" {
+	    pass $description
+	    return $expect_out(1,string)
+	}
+    }
+    return ""
 }
 
 proc my_continue { msg } {
-  send_gdb "continue\n"
-  gdb_expect {
-    -re "Continuing"
-      { pass "continue ($msg)" }
-    timeout
-      { fail "continue ($msg) (timeout)" }
-  }
+    gdb_test_multiple "continue" "continuing ($msg)" {
+	-re "Continuing" {
+	    pass "continue ($msg)"
+	}
+    }
 
-  stop_process "stop all threads ($msg)"
+    stop_process "stop all threads ($msg)"
 
-  # Make sure we're in one of the non-main looping threads.
-  gdb_breakpoint [concat [gdb_get_line_number "schedlock.exp: main loop"] " if arg != 0"]
-  gdb_continue_to_breakpoint "return to loop ($msg)"
-  delete_breakpoints
+    # Make sure we're in one of the non-main looping threads.
+    gdb_breakpoint [concat [gdb_get_line_number "schedlock.exp: main loop"] " if arg != 0"]
+    gdb_continue_to_breakpoint "return to loop ($msg)"
+    delete_breakpoints
 }
 
 proc step_ten_loops { msg } {
     global gdb_prompt
 
     for {set i 0} {[expr $i < 10]} {set i [expr $i + 1]} {
-	send_gdb "step\n"
 	set other_step 0
-	gdb_expect {
+	gdb_test_multiple "step" "step to increment ($msg $i)" {
 	    -re ".*myp\\) \\+\\+;\[\r\n\]+$gdb_prompt $" {
 		pass "step to increment ($msg $i)"
 	    }
@@ -147,9 +125,6 @@ proc step_ten_loops { msg } {
 		    # FIXME cascade?
 		}
 	    }
-	    timeout {
-		fail "step to increment ($msg $i) (timeout)"
-	    }
 	}
     }
 }
@@ -176,22 +151,18 @@ gdb_test "set width 0" ""
 runto_main
 
 # See if scheduler locking is available on this target.
-send_gdb "set scheduler-locking off\n"
 global gdb_prompt
-gdb_expect {
-  -re "Target .* cannot support this command"
-    {
-      unsupported "target does not support scheduler locking"
-      return
-    }
-  -re "$gdb_prompt $"
-    {
-      pass "scheduler locking set to none"
-    }
-  timeout
-    {
-      unsupported "target does not support scheduler locking (timeout)"
-      return
+gdb_test_multiple "set scheduler-locking off" "scheduler locking set to none" {
+    -re "Target .* cannot support this command" {
+	unsupported "target does not support scheduler locking"
+	return
+    }
+    -re "$gdb_prompt $" {
+	pass "scheduler locking set to none"
+    }
+    timeout {
+	unsupported "target does not support scheduler locking (timeout)"
+	return
     }
 }
 
Index: sigthread.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/sigthread.exp,v
retrieving revision 1.5
diff -u -p -r1.5 sigthread.exp
--- sigthread.exp	1 Jan 2010 07:32:06 -0000	1.5
+++ sigthread.exp	27 May 2010 00:24:10 -0000
@@ -36,14 +36,10 @@ if ![runto_main] then {
 gdb_test "handle SIGUSR1 nostop noprint pass"
 gdb_test "handle SIGUSR2 nostop noprint pass"
 
-send_gdb "continue\n"
-gdb_expect {
+gdb_test_multiple "continue" "continue" {
     -re "Continuing" {
 	pass "continue"
     }
-    timeout {
-	fail "continue (timeout)"
-    }
 }
 
 # For this to work we must be sure to consume the "Continuing."

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]