]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.threads/hand-call-in-threads.exp
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.threads / hand-call-in-threads.exp
index 2b65e8fc2bbe24c6af99616bb2af4a1ab2a87795..8ffd74a7c5caf897c1b16706d0be5351d3666a38 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2004-2013 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
 
 set NR_THREADS 4
 
-if $tracelevel then {
-       strace $tracelevel
-}
-
-set testfile "hand-call-in-threads"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}" "additional_flags=-DNR_THREADS=$NR_THREADS"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-DNR_THREADS=$NR_THREADS"]] != "" } {
     return -1
 }
 
@@ -38,30 +32,23 @@ if [target_info exists gdb,cannot_call_functions] {
 }
 
 proc get_dummy_frame_number { } {
-  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 ""
+    global gdb_prompt
+
+    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
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 if { ![runto_main] } {
     fail "Can't run to main"
@@ -85,7 +72,7 @@ gdb_test "continue" \
 
 # Before we start making hand function calls, turn on scheduler locking.
 
-gdb_test "set scheduler-locking on" "" "enable scheduler locking"
+gdb_test_no_output "set scheduler-locking on" "enable scheduler locking"
 gdb_test "show scheduler-locking" ".* locking scheduler .* is \"on\"." "show scheduler locking on"
 
 # Now hand-call a function in each thread, having the function
@@ -97,20 +84,23 @@ set total_nr_threads [expr $NR_THREADS + 1]
 # Thread numbering in gdb is origin-1, so begin numbering at 1.
 for { set i 1 } { $i <= $total_nr_threads } { incr i } {
     set thread_nr $i
-    gdb_test "thread $thread_nr" "" "prepare to make hand call, thread $thread_nr"
-    gdb_test "call hand_call()" "Breakpoint 3, .*" "hand call, thread $thread_nr"
+    gdb_test "thread $thread_nr" ".*" \
+       "prepare to make hand call, thread $thread_nr"
+    gdb_test "call hand_call()" "Breakpoint 3, .*" \
+       "hand call, thread $thread_nr"
 }
 
 # Now have each hand-called function return.
 
 # Turn confirmation off for the "return" command.
-gdb_test "set confirm off" ""
+gdb_test_no_output "set confirm off"
 
 clear_xfail "*-*-*"
 
 for { set i 1 } { $i <= $total_nr_threads } { incr i } {
     set thread_nr $i
-    gdb_test "thread $thread_nr" "" "prepare to discard hand call, thread $thread_nr"
+    gdb_test "thread $thread_nr" ".*" \
+       "prepare to discard hand call, thread $thread_nr"
     set frame_number [get_dummy_frame_number]
     if { "$frame_number" == "" } {
        fail "dummy stack frame number, thread $thread_nr"
@@ -120,8 +110,8 @@ for { set i 1 } { $i <= $total_nr_threads } { incr i } {
        pass "dummy stack frame number, thread $thread_nr"
     }
     # Pop the dummy frame.
-    gdb_test "frame $frame_number" "" "setting frame, thread $thread_nr"
-    gdb_test "return" "" "discard hand call, thread $thread_nr"
+    gdb_test "frame $frame_number" ".*" "setting frame, thread $thread_nr"
+    gdb_test "return" ".*" "discard hand call, thread $thread_nr"
     # In case getting the dummy frame number failed, re-enable for next iter.
     clear_xfail "*-*-*"
 }
@@ -137,8 +127,8 @@ gdb_test_multiple "maint print dummy-frames" "all dummies popped" {
     }
 }
 
-# Before we resume the full program, turn of scheduler locking.
-gdb_test "set scheduler-locking off" "" "disable scheduler locking"
+# Before we resume the full program, turn off scheduler locking.
+gdb_test_no_output "set scheduler-locking off" "disable scheduler locking"
 gdb_test "show scheduler-locking" ".* locking scheduler .* is \"off\"." "show scheduler locking off"
 
 # Continue one last time, the program should exit normally.
@@ -153,7 +143,7 @@ gdb_test "show scheduler-locking" ".* locking scheduler .* is \"off\"." "show sc
 # all_threads_running breakpoint, which wasn't the last thread to run,
 # and gdb doesn't know how to singlestep over reported breakpoints that
 # weren't in the last thread to run.
-#gdb_test "thread 1" "" "set thread to 1, prepare to resume"
+#gdb_test "thread 1" ".*" "set thread to 1, prepare to resume"
 #
 #gdb_continue_to_end "hand-call-in-threads"