diff options
author | Pedro Alves <palves@redhat.com> | 2012-02-20 13:20:38 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2012-02-20 13:20:38 +0000 |
commit | c5a006e6e8a687c49b8165a7405b1f9193d03f28 (patch) | |
tree | 09d7e423475671f51b3d7e3437336f3e153f6097 /gdb | |
parent | cc51a17021cee2a8b4fa4429d4d24ee47b1f2611 (diff) | |
download | gdb-c5a006e6e8a687c49b8165a7405b1f9193d03f28.zip gdb-c5a006e6e8a687c49b8165a7405b1f9193d03f28.tar.gz gdb-c5a006e6e8a687c49b8165a7405b1f9193d03f28.tar.bz2 |
2012-02-20 Pedro Alves <palves@redhat.com>
* gdb.threads/attach-into-signal.exp (corefunc): Don't enable
lin-lwp output. Set SIGALRM to stop. Adjust tests to not rely on
gdb's internal debug output. For the non-threaded case, look for
"Program received signal SIGLARM", for the threaded case, peek at
the thread's siginfo.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/attach-into-signal.exp | 57 |
2 files changed, 49 insertions, 16 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index fa4b063..a7235a6 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,13 @@ 2012-02-20 Pedro Alves <palves@redhat.com> + * gdb.threads/attach-into-signal.exp (corefunc): Don't enable + lin-lwp output. Set SIGALRM to stop. Adjust tests to not rely on + gdb's internal debug output. For the non-threaded case, look for + "Program received signal SIGLARM", for the threaded case, peek at + the thread's siginfo. + +2012-02-20 Pedro Alves <palves@redhat.com> + General cleanup, make output test messages unique, and build different executable files for the non-threaded and threaded cases. diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.exp b/gdb/testsuite/gdb.threads/attach-into-signal.exp index 651ce1c..e072e51 100644 --- a/gdb/testsuite/gdb.threads/attach-into-signal.exp +++ b/gdb/testsuite/gdb.threads/attach-into-signal.exp @@ -45,7 +45,6 @@ proc corefunc { threadtype executable } { lappend pf_prefix "$threadtype:" clean_restart ${executable} - gdb_test_no_output "set debug lin-lwp 1" "" set binfile ${objdir}/${subdir}/${executable} set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${executable}] @@ -55,6 +54,8 @@ proc corefunc { threadtype executable } { return -1 } + gdb_test "handle SIGALRM stop print pass" "Yes.*Yes.*Yes.*" + # Start the program running and then wait for a bit, to be sure # that it can be attached to. # Statistically there is a better chance without giving process a nice. @@ -97,27 +98,51 @@ proc corefunc { threadtype executable } { # Main test: set test "attach (pass $passes), pending signal catch" if {[gdb_test_multiple "attach $testpid" $test { - -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*Received Alarm clock.*$gdb_prompt $" { + -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*Program received signal SIGALRM.*$gdb_prompt $" { # nonthreaded: pass $test verbose -log "$test succeeded on the attempt # $attempt of $attempts" set passes [expr $passes + 1] } -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" { - # nonthreaded: - # We just lack the luck, we should try it again. - set attempt [expr $attempt + 1] - } - -re "Attaching to process $testpid.*Received Alarm clock.*$gdb_prompt $" { - # threaded: - pass $test - verbose -log "$test succeeded on the attempt # $attempt of $attempts" - set passes [expr $passes + 1] - } - -re "Attaching to process $testpid.*$gdb_prompt $" { - # threaded: - # We just lack the luck, we should try it again. - set attempt [expr $attempt - 1] + set ok 0 + + if { $threadtype == "threaded" } { + # In the threaded case, the signal is left pending + # on the second thread. Check for that by peeking + # at the thread's siginfo. SIGALRM is 14, SIGSTOP + # is 19. + + # With remote targets, we need to pull the thread + # list explicitly before GDB even knows about + # thread 2. + set test2 "pull thread list" + gdb_test_multiple "info threads" $test2 { + -re "\r\n$gdb_prompt $" { + } + } + + set test2 "thread apply 2 print \$_siginfo.si_signo" + gdb_test_multiple $test2 $test2 { + -re " = 14\r\n$gdb_prompt $" { + set ok 1 + } + -re " = 19\r\n$gdb_prompt $" { + } + } + } else { + # In the nonthreaded case, GDB should tell the + # user about having seen a signal. + } + + if { $ok == 0} { + # We just lack the luck, we should try it again. + set attempt [expr $attempt + 1] + } else { + pass $test + verbose -log "$test succeeded on the attempt # $attempt of $attempts" + set passes [expr $passes + 1] + } } }] != 0 } { break |