mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 20:28:28 +08:00
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.
This commit is contained in:
@ -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>
|
2010-06-02 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
* gdb.cp/re-set-overloaded.exp, gdb.cp/re-set-overloaded.cc: New.
|
* gdb.cp/re-set-overloaded.exp, gdb.cp/re-set-overloaded.cc: New.
|
||||||
|
@ -80,12 +80,10 @@ proc corefunc { threadtype } {
|
|||||||
# This breakpoint is there for old/non-x86 kernels not restarting syscalls.
|
# This breakpoint is there for old/non-x86 kernels not restarting syscalls.
|
||||||
gdb_breakpoint [gdb_get_line_number "Second sleep"]
|
gdb_breakpoint [gdb_get_line_number "Second sleep"]
|
||||||
set test "$threadtype: attach2 continue"
|
set test "$threadtype: attach2 continue"
|
||||||
send_gdb "continue\n"
|
gdb_test_multiple "continue" "continue ($test)" {
|
||||||
gdb_expect {
|
-re "Continuing" {
|
||||||
-re "Continuing"
|
pass "continue ($test)"
|
||||||
{ pass "continue ($test)" }
|
}
|
||||||
timeout
|
|
||||||
{ fail "continue ($test) (timeout)" }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# For this to work we must be sure to consume the "Continuing."
|
# For this to work we must be sure to consume the "Continuing."
|
||||||
|
@ -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 "Ridiculous time"]
|
||||||
gdb_breakpoint [gdb_get_line_number "cut the sleep time"]
|
gdb_breakpoint [gdb_get_line_number "cut the sleep time"]
|
||||||
set test "attach4 continue"
|
set test "attach4 continue"
|
||||||
send_gdb "continue\n"
|
gdb_test_multiple "continue" "continue ($test)" {
|
||||||
gdb_expect {
|
-re "Continuing" {
|
||||||
-re "Continuing"
|
pass "continue ($test)"
|
||||||
{ pass "continue ($test)" }
|
}
|
||||||
timeout
|
|
||||||
{ fail "continue ($test) (timeout)" }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# For this to work we must be sure to consume the "Continuing."
|
# For this to work we must be sure to consume the "Continuing."
|
||||||
|
@ -56,8 +56,7 @@ set nl "\[\r\n\]+"
|
|||||||
set prev_timeout $timeout
|
set prev_timeout $timeout
|
||||||
set timeout 30
|
set timeout 30
|
||||||
|
|
||||||
send_gdb "help gcore\n"
|
gdb_test_multiple "help gcore" "help gcore" {
|
||||||
gdb_expect {
|
|
||||||
-re "Undefined command: .gcore.*$gdb_prompt $" {
|
-re "Undefined command: .gcore.*$gdb_prompt $" {
|
||||||
# gcore command not supported -- nothing to test here.
|
# gcore command not supported -- nothing to test here.
|
||||||
unsupported "gdb does not support gcore on this target"
|
unsupported "gdb does not support gcore on this target"
|
||||||
@ -66,12 +65,6 @@ gdb_expect {
|
|||||||
-re "Save a core file .*$gdb_prompt $" {
|
-re "Save a core file .*$gdb_prompt $" {
|
||||||
pass "help gcore"
|
pass "help gcore"
|
||||||
}
|
}
|
||||||
-re ".*$gdb_prompt $" {
|
|
||||||
fail "help gcore"
|
|
||||||
}
|
|
||||||
timeout {
|
|
||||||
fail "help gcore (timeout)"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if { ! [ runto_main ] } then {
|
if { ! [ runto_main ] } then {
|
||||||
@ -79,8 +72,7 @@ if { ! [ runto_main ] } then {
|
|||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
send_gdb "info threads\n"
|
gdb_test_multiple "info threads" "threads are supported" {
|
||||||
gdb_expect {
|
|
||||||
-re ".* main .*$gdb_prompt $" {
|
-re ".* main .*$gdb_prompt $" {
|
||||||
# OK, threads are supported.
|
# OK, threads are supported.
|
||||||
}
|
}
|
||||||
@ -128,31 +120,25 @@ gdb_start
|
|||||||
gdb_reinitialize_dir $srcdir/$subdir
|
gdb_reinitialize_dir $srcdir/$subdir
|
||||||
gdb_load ${binfile}
|
gdb_load ${binfile}
|
||||||
|
|
||||||
send_gdb "core ${objdir}/${subdir}/gcore.test\n"
|
gdb_test_multiple "core ${objdir}/${subdir}/gcore.test" \
|
||||||
gdb_expect {
|
"re-load generated corefile" {
|
||||||
-re ".* is not a core dump:.*$gdb_prompt $" {
|
-re ".* is not a core dump:.*$gdb_prompt $" {
|
||||||
fail "re-load generated corefile (bad file format)"
|
fail "re-load generated corefile (bad file format)"
|
||||||
# No use proceeding from here.
|
# No use proceeding from here.
|
||||||
return;
|
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 ".*: 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 ".*$gdb_prompt $" {
|
|
||||||
fail "re-load generated corefile"
|
|
||||||
}
|
|
||||||
timeout {
|
|
||||||
fail "re-load generated corefile (timeout)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# FIXME: now what can we test about the thread state?
|
# FIXME: now what can we test about the thread state?
|
||||||
# We do not know for certain that there should be at least
|
# We do not know for certain that there should be at least
|
||||||
|
@ -38,24 +38,20 @@ if [target_info exists gdb,cannot_call_functions] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc get_dummy_frame_number { } {
|
proc get_dummy_frame_number { } {
|
||||||
global gdb_prompt
|
global gdb_prompt
|
||||||
|
|
||||||
send_gdb "bt\n"
|
gdb_test_multiple "bt" "" {
|
||||||
gdb_expect {
|
-re "#(\[0-9\]*) *<function called from gdb>.*$gdb_prompt $" {
|
||||||
-re "#(\[0-9\]*) *<function called from gdb>.*$gdb_prompt $"
|
return $expect_out(1,string)
|
||||||
{
|
}
|
||||||
return $expect_out(1,string)
|
-re "$gdb_prompt $" {
|
||||||
}
|
return ""
|
||||||
-re "$gdb_prompt $"
|
}
|
||||||
{
|
timeout {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
timeout
|
}
|
||||||
{
|
return ""
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb_exit
|
gdb_exit
|
||||||
|
@ -54,7 +54,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
|
|||||||
gdb_start
|
gdb_start
|
||||||
gdb_reinitialize_dir $srcdir/$subdir
|
gdb_reinitialize_dir $srcdir/$subdir
|
||||||
gdb_load ${binfile}
|
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
|
runto_main
|
||||||
|
|
||||||
# There should be no threads initially.
|
# There should be no threads initially.
|
||||||
@ -65,9 +65,8 @@ gdb_breakpoint [gdb_get_line_number "linuxthreads.exp: create philosopher"]
|
|||||||
set expect_manager -1
|
set expect_manager -1
|
||||||
for {set i 0} {$i < 5} {incr i} {
|
for {set i 0} {$i < 5} {incr i} {
|
||||||
gdb_continue_to_breakpoint "about to create philosopher: $i"
|
gdb_continue_to_breakpoint "about to create philosopher: $i"
|
||||||
send_gdb "info threads\n"
|
|
||||||
set threads_before {}
|
set threads_before {}
|
||||||
gdb_expect {
|
gdb_test_multiple "info threads" "info threads before: $i" {
|
||||||
-re "info threads\r\n" {
|
-re "info threads\r\n" {
|
||||||
exp_continue
|
exp_continue
|
||||||
}
|
}
|
||||||
@ -82,13 +81,9 @@ for {set i 0} {$i < 5} {incr i} {
|
|||||||
}
|
}
|
||||||
-re "^$gdb_prompt $" {
|
-re "^$gdb_prompt $" {
|
||||||
}
|
}
|
||||||
timeout {
|
|
||||||
fail "(timeout) info threads before: $i"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
send_gdb "next\n"
|
|
||||||
set threads_created 0
|
set threads_created 0
|
||||||
gdb_expect {
|
gdb_test_multiple "next" "create philosopher: $i" {
|
||||||
-re "^next\r\n" {
|
-re "^next\r\n" {
|
||||||
exp_continue
|
exp_continue
|
||||||
}
|
}
|
||||||
@ -114,9 +109,6 @@ for {set i 0} {$i < 5} {incr i} {
|
|||||||
}
|
}
|
||||||
-re "$gdb_prompt $" {
|
-re "$gdb_prompt $" {
|
||||||
}
|
}
|
||||||
timeout {
|
|
||||||
fail "(timeout) create philosopher: $i"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if { $threads_created == 0 } {
|
if { $threads_created == 0 } {
|
||||||
# Not all targets announce new threads as they are created.
|
# 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"
|
fail "create philosopher: $i"
|
||||||
}
|
}
|
||||||
|
|
||||||
send_gdb "info threads\n"
|
|
||||||
set threads_after {}
|
set threads_after {}
|
||||||
gdb_expect {
|
gdb_test_multiple "info threads" "info threads after: $i" {
|
||||||
-re "info threads\r\n" {
|
-re "info threads\r\n" {
|
||||||
exp_continue
|
exp_continue
|
||||||
}
|
}
|
||||||
@ -178,11 +169,7 @@ for {set i 0} {$i < 5} {incr i} {
|
|||||||
fail "info threads after: $i"
|
fail "info threads after: $i"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
timeout {
|
|
||||||
fail "(timeout) info threads after: $i"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set nthreads 6
|
set nthreads 6
|
||||||
@ -257,8 +244,7 @@ gdb_test "where" "print_philosopher.*philosopher.* \(from .*libpthread\|at pthre
|
|||||||
set only_five 1
|
set only_five 1
|
||||||
for {set i 0} {$only_five > 0 && $i < 10} {incr i} {
|
for {set i 0} {$only_five > 0 && $i < 10} {incr i} {
|
||||||
gdb_continue_to_breakpoint "thread 5's print, pass: $i"
|
gdb_continue_to_breakpoint "thread 5's print, pass: $i"
|
||||||
send_gdb "info threads\n"
|
gdb_test_multiple "info threads" "" {
|
||||||
gdb_expect {
|
|
||||||
-re "\\* 5 Thread .* print_philosopher .*\r\n$gdb_prompt $" {
|
-re "\\* 5 Thread .* print_philosopher .*\r\n$gdb_prompt $" {
|
||||||
# Okay this time.
|
# Okay this time.
|
||||||
}
|
}
|
||||||
@ -281,18 +267,9 @@ if {$only_five == -1} { fail "$name (timeout)" }
|
|||||||
proc select_thread {thread} {
|
proc select_thread {thread} {
|
||||||
global gdb_prompt
|
global gdb_prompt
|
||||||
|
|
||||||
send_gdb "thread $thread\n"
|
gdb_test "thread $thread" \
|
||||||
gdb_expect {
|
"\\\[Switching to thread .*\\\].*" \
|
||||||
-re "\\\[Switching to thread .*\\\].*\r\n$gdb_prompt $" {
|
"selected thread: $thread"
|
||||||
pass "selected thread: $thread"
|
|
||||||
}
|
|
||||||
-re "$gdb_prompt $" {
|
|
||||||
fail "selected thread: $thread"
|
|
||||||
}
|
|
||||||
timeout {
|
|
||||||
fail "selected thread: $thread (timeout)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
### Select THREAD, check for a plausible backtrace, and make sure
|
### Select THREAD, check for a plausible backtrace, and make sure
|
||||||
@ -314,8 +291,7 @@ proc check_philosopher_stack {thread seen_name} {
|
|||||||
set interesting 0
|
set interesting 0
|
||||||
|
|
||||||
select_thread $thread
|
select_thread $thread
|
||||||
send_gdb "where\n"
|
gdb_test_multiple "where" "$name" {
|
||||||
gdb_expect {
|
|
||||||
-re ".* in philosopher \\(data=(0x\[0-9a-f\]+).*\r\n$gdb_prompt $" {
|
-re ".* in philosopher \\(data=(0x\[0-9a-f\]+).*\r\n$gdb_prompt $" {
|
||||||
set data $expect_out(1,string)
|
set data $expect_out(1,string)
|
||||||
if {[info exists seen($data)]} {
|
if {[info exists seen($data)]} {
|
||||||
@ -356,12 +332,6 @@ proc check_philosopher_stack {thread seen_name} {
|
|||||||
## be an xfail.
|
## be an xfail.
|
||||||
pass $name
|
pass $name
|
||||||
}
|
}
|
||||||
-re "$gdb_prompt $" {
|
|
||||||
fail $name
|
|
||||||
}
|
|
||||||
timeout {
|
|
||||||
fail "$name (timeout)"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $interesting
|
return $interesting
|
||||||
|
@ -63,8 +63,7 @@ proc test_all_threads { name kill } {
|
|||||||
|
|
||||||
set i 0
|
set i 0
|
||||||
set j 0
|
set j 0
|
||||||
send_gdb "continue\n"
|
gdb_test_multiple "continue" "all threads ran once" {
|
||||||
gdb_expect {
|
|
||||||
-re "Breakpoint \[0-9\]+, thread_function \\(arg=.*\\) at .*print-threads.c:\[0-9\]+.*$gdb_prompt" {
|
-re "Breakpoint \[0-9\]+, thread_function \\(arg=.*\\) at .*print-threads.c:\[0-9\]+.*$gdb_prompt" {
|
||||||
set i [expr $i + 1]
|
set i [expr $i + 1]
|
||||||
pass "Hit thread_function breakpoint, $i ($name)"
|
pass "Hit thread_function breakpoint, $i ($name)"
|
||||||
@ -96,12 +95,6 @@ proc test_all_threads { name kill } {
|
|||||||
fail "Running threads ($name) (unknown output)"
|
fail "Running threads ($name) (unknown output)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
-re "$gdb_prompt" {
|
|
||||||
fail "Running threads ($name) (unknown output)"
|
|
||||||
}
|
|
||||||
timeout {
|
|
||||||
fail "Running threads ($name) (timeout)"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,19 +88,18 @@ proc all_threads_running {} {
|
|||||||
# to stop. Since no other breakpoints are set at this time
|
# to stop. Since no other breakpoints are set at this time
|
||||||
# we should stop only when we have been previously called 15 times.
|
# we should stop only when we have been previously called 15 times.
|
||||||
|
|
||||||
send_gdb "continue\n"
|
set return_me 1
|
||||||
gdb_expect {
|
|
||||||
-re "Continuing.*common_routine.*at.*$srcfile.*$gdb_prompt $" {}
|
gdb_test_multiple "continue" "continue until common routine run 15 times" {
|
||||||
default {
|
-re "Continuing.*common_routine.*at.*$srcfile.*$gdb_prompt $" {
|
||||||
fail "continue until common routine run 15 times"
|
set return_me 0
|
||||||
return 0
|
|
||||||
}
|
|
||||||
timeout {
|
|
||||||
fail "continue until common routine run 15 times (timeout)"
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if { $return_me == 1 } then {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
# Check that we stopped when we actually expected to stop, by
|
# Check that we stopped when we actually expected to stop, by
|
||||||
# verifying that there have been 15 previous hits.
|
# 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
|
# trap and the next. So stopping after 16 or 17 hits should be
|
||||||
# considered acceptable.
|
# considered acceptable.
|
||||||
|
|
||||||
send_gdb "p common_routine::hits\n"
|
gdb_test_multiple "p common_routine::hits" \
|
||||||
gdb_expect {
|
"stopped before calling common_routine 15 times" {
|
||||||
-re ".*= 15\r\n$gdb_prompt $" {
|
-re ".*= 15\r\n$gdb_prompt $" {
|
||||||
pass "stopped before calling common_routine 15 times"
|
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)"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
-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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Also check that all of the threads have run, which will only be true
|
# Also check that all of the threads have run, which will only be true
|
||||||
# if the full_coverage variable is set.
|
# if the full_coverage variable is set.
|
||||||
|
|
||||||
send_gdb "p common_routine::full_coverage\n"
|
set return_me 1
|
||||||
gdb_expect {
|
gdb_test_multiple "p common_routine::full_coverage" \
|
||||||
-re ".* = 1.*$gdb_prompt $" {}
|
"some threads didn't run" {
|
||||||
-re ".* = 0.*$gdb_prompt $" {
|
-re ".* = 1.*$gdb_prompt $" {
|
||||||
fail "some threads didn't run"
|
}
|
||||||
return 0
|
-re ".* = 0.*$gdb_prompt $" {
|
||||||
|
fail "some threads didn't run"
|
||||||
|
set return_me 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
default {
|
|
||||||
fail "some threads didn't run"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
timeout {
|
|
||||||
fail "some threads didn't run (timeout)"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Looks fine, return success.
|
# Looks fine, return success.
|
||||||
return 1
|
return $return_me
|
||||||
}
|
}
|
||||||
|
|
||||||
proc test_startup {} {
|
proc test_startup {} {
|
||||||
@ -164,20 +145,27 @@ proc test_startup {} {
|
|||||||
global main_id thread1_id thread2_id
|
global main_id thread1_id thread2_id
|
||||||
|
|
||||||
# We should be able to do an info threads before starting any others.
|
# We should be able to do an info threads before starting any others.
|
||||||
send_gdb "info threads\n"
|
set return_me 1
|
||||||
gdb_expect {
|
gdb_test_multiple "info threads" "info threads" {
|
||||||
-re ".*Thread.*main.*$gdb_prompt $" {
|
-re ".*Thread.*main.*$gdb_prompt $" {
|
||||||
pass "info threads"
|
pass "info threads"
|
||||||
|
set return_me 0
|
||||||
}
|
}
|
||||||
-re "\r\n$gdb_prompt $" {
|
-re "\r\n$gdb_prompt $" {
|
||||||
unsupported "gdb does not support pthreads for this machine"
|
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.
|
# Extract the thread id number of main thread from "info threads" output.
|
||||||
send_gdb "info threads\n"
|
gdb_test_multiple "info threads" "get main thread id" {
|
||||||
gdb_expect -re "(\[0-9\]+)(${horiz}Thread${horiz}main.*)($gdb_prompt $)"
|
-re "(\[0-9\]+)(${horiz}Thread${horiz}main.*)($gdb_prompt $)" {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
set main_id $expect_out(1,string)
|
set main_id $expect_out(1,string)
|
||||||
|
|
||||||
# Check that we can continue and create the first thread.
|
# Check that we can continue and create the first thread.
|
||||||
@ -188,8 +176,11 @@ proc test_startup {} {
|
|||||||
gdb_test "disable" ""
|
gdb_test "disable" ""
|
||||||
|
|
||||||
# Extract the thread id number of thread 1 from "info threads" output.
|
# Extract the thread id number of thread 1 from "info threads" output.
|
||||||
send_gdb "info threads\n"
|
gdb_test_multiple "info threads" "get thread 1 id" {
|
||||||
gdb_expect -re "(\[0-9\]+)(${horiz}Thread${horiz}thread1.*)($gdb_prompt $)"
|
-re "(\[0-9\]+)(${horiz}Thread${horiz}thread1.*)($gdb_prompt $)" {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
set thread1_id $expect_out(1,string)
|
set thread1_id $expect_out(1,string)
|
||||||
|
|
||||||
# Check that we can continue and create the second thread,
|
# Check that we can continue and create the second thread,
|
||||||
@ -200,8 +191,11 @@ proc test_startup {} {
|
|||||||
"Continue to creation of second thread"
|
"Continue to creation of second thread"
|
||||||
|
|
||||||
# Extract the thread id number of thread 2 from "info threads" output.
|
# Extract the thread id number of thread 2 from "info threads" output.
|
||||||
send_gdb "info threads\n"
|
gdb_test_multiple "info threads" "get thread 2 id" {
|
||||||
gdb_expect -re "(\[0-9\]+)(${horiz}Thread${horiz}thread2.*)($gdb_prompt $)"
|
-re "(\[0-9\]+)(${horiz}Thread${horiz}thread2.*)($gdb_prompt $)" {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
set thread2_id $expect_out(1,string)
|
set thread2_id $expect_out(1,string)
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
@ -216,14 +210,10 @@ proc check_control_c {} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Send a continue followed by ^C to the process to stop it.
|
# Send a continue followed by ^C to the process to stop it.
|
||||||
send_gdb "continue\n"
|
gdb_test_multiple "continue" "continue with all threads running" {
|
||||||
gdb_expect {
|
|
||||||
-re "Continuing." {
|
-re "Continuing." {
|
||||||
pass "Continue with all threads running"
|
pass "Continue with all threads running"
|
||||||
}
|
}
|
||||||
timeout {
|
|
||||||
fail "Continue with all threads running (timeout)"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
after 2000
|
after 2000
|
||||||
send_gdb "\003"
|
send_gdb "\003"
|
||||||
@ -278,22 +268,12 @@ proc check_backtraces {} {
|
|||||||
"Breakpoint .* at 0x.* file .* line .*" \
|
"Breakpoint .* at 0x.* file .* line .*" \
|
||||||
"set break at common_routine in thread 2"
|
"set break at common_routine in thread 2"
|
||||||
|
|
||||||
send_gdb "continue\n"
|
gdb_test_multiple "continue" "continue to bkpt at common_routine in thread 2" {
|
||||||
gdb_expect {
|
|
||||||
-re "Breakpoint .* common_routine \\(arg=2\\).*" {
|
-re "Breakpoint .* common_routine \\(arg=2\\).*" {
|
||||||
pass "continue to bkpt at common_routine in thread 2"
|
pass "continue to bkpt at common_routine in thread 2"
|
||||||
send_gdb "backtrace\n"
|
gdb_test "backtrace" \
|
||||||
gdb_expect {
|
"#0.*common_routine \\(arg=2\\).*#1.*thread2.*" \
|
||||||
-re "#0.*common_routine \\(arg=2\\).*#1.*thread2.*" {
|
"backtrace from thread 2 bkpt in common_routine"
|
||||||
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)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
-re "Breakpoint .* common_routine \\(arg=0\\).*" {
|
-re "Breakpoint .* common_routine \\(arg=0\\).*" {
|
||||||
fail "continue to bkpt at common_routine in thread 2 (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\\).*" {
|
-re "Breakpoint .* common_routine \\(arg=1\\).*" {
|
||||||
fail "continue to bkpt at common_routine in thread 2 (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)"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,37 +38,27 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
|
|||||||
# Now we can proceed with the real testing.
|
# Now we can proceed with the real testing.
|
||||||
|
|
||||||
proc get_args { } {
|
proc get_args { } {
|
||||||
global list_count
|
global list_count
|
||||||
global gdb_prompt
|
global gdb_prompt
|
||||||
global NUM
|
global NUM
|
||||||
|
|
||||||
set pattern "(\[0-9\]+)"
|
set pattern "(\[0-9\]+)"
|
||||||
for {set i 1} {[expr $i < $NUM]} {incr i} {
|
for {set i 1} {[expr $i < $NUM]} {incr i} {
|
||||||
append pattern ", (\[0-9\]+)"
|
append pattern ", (\[0-9\]+)"
|
||||||
}
|
}
|
||||||
|
|
||||||
send_gdb "print args\n"
|
gdb_test_multiple "print args" "listed args ($list_count)" {
|
||||||
gdb_expect {
|
-re "\\\$\[0-9\]+ = {$pattern}.*$gdb_prompt $" {
|
||||||
-re "\\\$\[0-9\]+ = {$pattern}.*$gdb_prompt"
|
set list_count [expr $list_count + 1]
|
||||||
{
|
pass "listed args ($list_count)"
|
||||||
set list_count [expr $list_count + 1]
|
|
||||||
pass "listed args ($list_count)"
|
|
||||||
|
|
||||||
set result ""
|
set result ""
|
||||||
for {set i 1} {[expr $i <= $NUM]} {incr i} {
|
for {set i 1} {[expr $i <= $NUM]} {incr i} {
|
||||||
lappend result $expect_out($i,string)
|
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 } {
|
proc stop_process { description } {
|
||||||
@ -90,50 +80,38 @@ proc stop_process { description } {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc get_current_thread { description } {
|
proc get_current_thread { description } {
|
||||||
global gdb_prompt
|
global gdb_prompt
|
||||||
|
|
||||||
send_gdb "bt\n"
|
gdb_test_multiple "bt" "$description" {
|
||||||
gdb_expect {
|
-re "thread_function \\(arg=0x(\[0-9\])\\).*$gdb_prompt $" {
|
||||||
-re "thread_function \\(arg=0x(\[0-9\])\\).*$gdb_prompt $"
|
pass $description
|
||||||
{
|
return $expect_out(1,string)
|
||||||
pass $description
|
}
|
||||||
return $expect_out(1,string)
|
}
|
||||||
}
|
return ""
|
||||||
-re "$gdb_prompt $"
|
|
||||||
{
|
|
||||||
fail "$description (unknown output)"
|
|
||||||
}
|
|
||||||
timeout
|
|
||||||
{
|
|
||||||
fail "$description (timeout)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proc my_continue { msg } {
|
proc my_continue { msg } {
|
||||||
send_gdb "continue\n"
|
gdb_test_multiple "continue" "continuing ($msg)" {
|
||||||
gdb_expect {
|
-re "Continuing" {
|
||||||
-re "Continuing"
|
pass "continue ($msg)"
|
||||||
{ pass "continue ($msg)" }
|
}
|
||||||
timeout
|
}
|
||||||
{ fail "continue ($msg) (timeout)" }
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_process "stop all threads ($msg)"
|
stop_process "stop all threads ($msg)"
|
||||||
|
|
||||||
# Make sure we're in one of the non-main looping threads.
|
# 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_breakpoint [concat [gdb_get_line_number "schedlock.exp: main loop"] " if arg != 0"]
|
||||||
gdb_continue_to_breakpoint "return to loop ($msg)"
|
gdb_continue_to_breakpoint "return to loop ($msg)"
|
||||||
delete_breakpoints
|
delete_breakpoints
|
||||||
}
|
}
|
||||||
|
|
||||||
proc step_ten_loops { msg } {
|
proc step_ten_loops { msg } {
|
||||||
global gdb_prompt
|
global gdb_prompt
|
||||||
|
|
||||||
for {set i 0} {[expr $i < 10]} {set i [expr $i + 1]} {
|
for {set i 0} {[expr $i < 10]} {set i [expr $i + 1]} {
|
||||||
send_gdb "step\n"
|
|
||||||
set other_step 0
|
set other_step 0
|
||||||
gdb_expect {
|
gdb_test_multiple "step" "step to increment ($msg $i)" {
|
||||||
-re ".*myp\\) \\+\\+;\[\r\n\]+$gdb_prompt $" {
|
-re ".*myp\\) \\+\\+;\[\r\n\]+$gdb_prompt $" {
|
||||||
pass "step to increment ($msg $i)"
|
pass "step to increment ($msg $i)"
|
||||||
}
|
}
|
||||||
@ -147,9 +125,6 @@ proc step_ten_loops { msg } {
|
|||||||
# FIXME cascade?
|
# FIXME cascade?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
timeout {
|
|
||||||
fail "step to increment ($msg $i) (timeout)"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,22 +151,18 @@ gdb_test "set width 0" ""
|
|||||||
runto_main
|
runto_main
|
||||||
|
|
||||||
# See if scheduler locking is available on this target.
|
# See if scheduler locking is available on this target.
|
||||||
send_gdb "set scheduler-locking off\n"
|
|
||||||
global gdb_prompt
|
global gdb_prompt
|
||||||
gdb_expect {
|
gdb_test_multiple "set scheduler-locking off" "scheduler locking set to none" {
|
||||||
-re "Target .* cannot support this command"
|
-re "Target .* cannot support this command" {
|
||||||
{
|
unsupported "target does not support scheduler locking"
|
||||||
unsupported "target does not support scheduler locking"
|
return
|
||||||
return
|
|
||||||
}
|
}
|
||||||
-re "$gdb_prompt $"
|
-re "$gdb_prompt $" {
|
||||||
{
|
pass "scheduler locking set to none"
|
||||||
pass "scheduler locking set to none"
|
|
||||||
}
|
}
|
||||||
timeout
|
timeout {
|
||||||
{
|
unsupported "target does not support scheduler locking (timeout)"
|
||||||
unsupported "target does not support scheduler locking (timeout)"
|
return
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,14 +36,10 @@ if ![runto_main] then {
|
|||||||
gdb_test "handle SIGUSR1 nostop noprint pass"
|
gdb_test "handle SIGUSR1 nostop noprint pass"
|
||||||
gdb_test "handle SIGUSR2 nostop noprint pass"
|
gdb_test "handle SIGUSR2 nostop noprint pass"
|
||||||
|
|
||||||
send_gdb "continue\n"
|
gdb_test_multiple "continue" "continue" {
|
||||||
gdb_expect {
|
|
||||||
-re "Continuing" {
|
-re "Continuing" {
|
||||||
pass "continue"
|
pass "continue"
|
||||||
}
|
}
|
||||||
timeout {
|
|
||||||
fail "continue (timeout)"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# For this to work we must be sure to consume the "Continuing."
|
# For this to work we must be sure to consume the "Continuing."
|
||||||
|
Reference in New Issue
Block a user