diff options
author | Michael Snyder <msnyder@vmware.com> | 2010-06-02 19:58:21 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2010-06-02 19:58:21 +0000 |
commit | 9db7054520d96d6e4d4c40a54280a2cec73b7adb (patch) | |
tree | 24e7b50f1e92ca99d9092839614139e221c0f477 /gdb | |
parent | 0ab48859b9a642d6393ccb0c43bda33360b83750 (diff) | |
download | gdb-9db7054520d96d6e4d4c40a54280a2cec73b7adb.zip gdb-9db7054520d96d6e4d4c40a54280a2cec73b7adb.tar.gz gdb-9db7054520d96d6e4d4c40a54280a2cec73b7adb.tar.bz2 |
2010-06-02 Michael Snyder <msnyder@msnyder-server.eng.vmware.com>
* gdb.threads/attach-stopped.exp:
Replace uses of send_gdb / gdb_expect.
* gdb.threads/attachstop-mt.exp:
Replace uses of send_gdb / gdb_expect.
* gdb.threads/gcore-thread.exp:
Replace uses of send_gdb / gdb_expect.
* gdb.threads/hand-call-in-threads.exp:
Replace uses of send_gdb / gdb_expect.
* gdb.threads/linux-dp.exp: Replace uses of send_gdb / gdb_expect.
* gdb.threads/print-threads.exp:
Replace uses of send_gdb / gdb_expect.
* gdb.threads/pthreads.exp: Replace uses of send_gdb / gdb_expect.
* gdb.threads/schedlock.exp: Replace uses of send_gdb / gdb_expect.
* gdb.threads/sigthread.exp: Replace uses of send_gdb / gdb_expect.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/ChangeLog | 29 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/attach-stopped.exp | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/attachstop-mt.exp | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/gcore-thread.exp | 54 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/hand-call-in-threads.exp | 32 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/linux-dp.exp | 48 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/print-threads.exp | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/pthreads.exp | 143 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/schedlock.exp | 119 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/sigthread.exp | 6 |
10 files changed, 184 insertions, 276 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f46bede..5b0a76d 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,32 @@ +2010-06-02 Michael Snyder <msnyder@msnyder-server.eng.vmware.com> + + * gdb.threads/attach-stopped.exp: + Replace uses of send_gdb / gdb_expect. + * gdb.threads/attachstop-mt.exp: + Replace uses of send_gdb / gdb_expect. + * gdb.threads/gcore-thread.exp: + Replace uses of send_gdb / gdb_expect. + * gdb.threads/hand-call-in-threads.exp: + Replace uses of send_gdb / gdb_expect. + * gdb.threads/linux-dp.exp: Replace uses of send_gdb / gdb_expect. + * gdb.threads/print-threads.exp: + Replace uses of send_gdb / gdb_expect. + * gdb.threads/pthreads.exp: Replace uses of send_gdb / gdb_expect. + * gdb.threads/schedlock.exp: Replace uses of send_gdb / gdb_expect. + * gdb.threads/sigthread.exp: Replace uses of send_gdb / gdb_expect. + + * gdb.trace/actions.exp: Replace uses of send_gdb / gdb_expect. + * gdb.trace/backtrace.exp: Replace uses of send_gdb / gdb_expect. + * gdb.trace/collection.exp: Replace uses of send_gdb / gdb_expect. + * gdb.trace/deltrace.exp: Replace uses of send_gdb / gdb_expect. + * gdb.trace/infotrace.exp: Replace uses of send_gdb / gdb_expect. + * gdb.trace/limits.exp: Replace uses of send_gdb / gdb_expect. + * gdb.trace/report.exp: Replace uses of send_gdb / gdb_expect. + * gdb.trace/save-trace.exp: Replace uses of send_gdb / gdb_expect. + * gdb.trace/tfind.exp: Replace uses of send_gdb / gdb_expect. + * gdb.trace/tracecmd.exp: Replace uses of send_gdb / gdb_expect. + * gdb.trace/tsv.exp: Replace uses of send_gdb / gdb_expect. + 2010-06-02 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.cp/re-set-overloaded.exp, gdb.cp/re-set-overloaded.cc: New. diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp index 8d81d35..e0998ba 100644 --- a/gdb/testsuite/gdb.threads/attach-stopped.exp +++ b/gdb/testsuite/gdb.threads/attach-stopped.exp @@ -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." diff --git a/gdb/testsuite/gdb.threads/attachstop-mt.exp b/gdb/testsuite/gdb.threads/attachstop-mt.exp index 665a4e7..c0e1e60 100644 --- a/gdb/testsuite/gdb.threads/attachstop-mt.exp +++ b/gdb/testsuite/gdb.threads/attachstop-mt.exp @@ -211,12 +211,10 @@ gdb_test "bt" ".*sleep.*(func|main).*" "attach4 to stopped bt" 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." diff --git a/gdb/testsuite/gdb.threads/gcore-thread.exp b/gdb/testsuite/gdb.threads/gcore-thread.exp index a595b28..83f8641 100644 --- a/gdb/testsuite/gdb.threads/gcore-thread.exp +++ b/gdb/testsuite/gdb.threads/gcore-thread.exp @@ -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 diff --git a/gdb/testsuite/gdb.threads/hand-call-in-threads.exp b/gdb/testsuite/gdb.threads/hand-call-in-threads.exp index 8028bcc..572982a 100644 --- a/gdb/testsuite/gdb.threads/hand-call-in-threads.exp +++ b/gdb/testsuite/gdb.threads/hand-call-in-threads.exp @@ -38,24 +38,20 @@ 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 diff --git a/gdb/testsuite/gdb.threads/linux-dp.exp b/gdb/testsuite/gdb.threads/linux-dp.exp index 654ffc5..d798a9c 100644 --- a/gdb/testsuite/gdb.threads/linux-dp.exp +++ b/gdb/testsuite/gdb.threads/linux-dp.exp @@ -54,7 +54,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab 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 "linuxthreads.exp: create philosopher"] 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.*philosopher.* \(from .*libpthread\|at pthre 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 (timeout)" } 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 seen_name} { 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 seen_name} { ## be an xfail. pass $name } - -re "$gdb_prompt $" { - fail $name - } - timeout { - fail "$name (timeout)" - } } return $interesting diff --git a/gdb/testsuite/gdb.threads/print-threads.exp b/gdb/testsuite/gdb.threads/print-threads.exp index a671479..1159540 100644 --- a/gdb/testsuite/gdb.threads/print-threads.exp +++ b/gdb/testsuite/gdb.threads/print-threads.exp @@ -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)" - } } } diff --git a/gdb/testsuite/gdb.threads/pthreads.exp b/gdb/testsuite/gdb.threads/pthreads.exp index 94138c5..0a315cb 100644 --- a/gdb/testsuite/gdb.threads/pthreads.exp +++ b/gdb/testsuite/gdb.threads/pthreads.exp @@ -88,19 +88,18 @@ 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 $" {} - default { - fail "continue until common routine run 15 times" - return 0 - } - timeout { - fail "continue until common routine run 15 times (timeout)" - return 0 + set return_me 1 + + gdb_test_multiple "continue" "continue until common routine run 15 times" { + -re "Continuing.*common_routine.*at.*$srcfile.*$gdb_prompt $" { + set return_me 0 } } + if { $return_me == 1 } then { + return 0; + } + # Check that we stopped when we actually expected to stop, by # verifying that there have been 15 previous hits. @@ -109,53 +108,35 @@ 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 + set return_me 1 + 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" + set return_me 0 + } } - } # Looks fine, return success. - return 1 + return $return_me } proc test_startup {} { @@ -164,20 +145,27 @@ 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 { + set return_me 1 + gdb_test_multiple "info threads" "info threads" { -re ".*Thread.*main.*$gdb_prompt $" { pass "info threads" + set return_me 0 } -re "\r\n$gdb_prompt $" { unsupported "gdb does not support pthreads for this machine" - return 0 } } + if { $return_me == 1 } then { + return 0; + } + # 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 +176,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 +191,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 +210,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 +268,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 +281,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)" - } } } diff --git a/gdb/testsuite/gdb.threads/schedlock.exp b/gdb/testsuite/gdb.threads/schedlock.exp index 5f966f9..5a3ab5b 100644 --- a/gdb/testsuite/gdb.threads/schedlock.exp +++ b/gdb/testsuite/gdb.threads/schedlock.exp @@ -38,37 +38,27 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab # Now we can proceed with the real testing. proc get_args { } { - global list_count - global gdb_prompt - global NUM + 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\]+)" - } + set pattern "(\[0-9\]+)" + for {set i 1} {[expr $i < $NUM]} {incr i} { + append pattern ", (\[0-9\]+)" + } - 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)" + 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) + 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 +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" + -re "$gdb_prompt $" { + pass "scheduler locking set to none" } - timeout - { - unsupported "target does not support scheduler locking (timeout)" - return + timeout { + unsupported "target does not support scheduler locking (timeout)" + return } } diff --git a/gdb/testsuite/gdb.threads/sigthread.exp b/gdb/testsuite/gdb.threads/sigthread.exp index aba1953..5acc01c 100644 --- a/gdb/testsuite/gdb.threads/sigthread.exp +++ b/gdb/testsuite/gdb.threads/sigthread.exp @@ -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." |