2004-09-01 18:02:45 +00:00
|
|
|
# static.exp -- test script, for GDB, the GNU debugger.
|
|
|
|
|
2010-01-01 07:32:07 +00:00
|
|
|
# Copyright 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
2004-09-01 18:02:45 +00:00
|
|
|
|
|
|
|
# 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
|
2007-08-23 18:14:19 +00:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
2004-09-01 18:02:45 +00:00
|
|
|
# (at your option) any later version.
|
2007-08-23 18:14:19 +00:00
|
|
|
#
|
2004-09-01 18:02:45 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2007-08-23 18:14:19 +00:00
|
|
|
#
|
2004-09-01 18:02:45 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-08-23 18:14:19 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2004-09-01 18:02:45 +00:00
|
|
|
|
|
|
|
# Based on manythreads written by Jeff Johnston, contributed by Red
|
|
|
|
# Hat.
|
|
|
|
|
|
|
|
if $tracelevel then {
|
|
|
|
strace $tracelevel
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set testfile "staticthreads"
|
|
|
|
set srcfile ${testfile}.c
|
|
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
|
|
|
set static_flag "-static"
|
|
|
|
|
|
|
|
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
|
|
|
|
executable \
|
|
|
|
[list debug "incdir=${objdir}" "additional_flags=${static_flag}" \
|
|
|
|
]] != "" } {
|
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_start
|
|
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
|
|
|
gdb_load ${binfile}
|
2010-06-02 21:53:28 +00:00
|
|
|
gdb_test_no_output "set print sevenbit-strings"
|
2004-09-01 18:02:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
# See if the static multi-threaded program runs.
|
|
|
|
|
|
|
|
runto_main
|
|
|
|
gdb_test "break sem_post"
|
|
|
|
set test "Continue to main's call of sem_post"
|
|
|
|
gdb_test_multiple "continue" "$test" {
|
2007-07-27 15:45:06 +00:00
|
|
|
-re "Breakpoint .*, .*sem_post .*$gdb_prompt " {
|
2004-09-01 18:02:45 +00:00
|
|
|
pass "$test"
|
|
|
|
}
|
|
|
|
-re "Program received signal .*$gdb_prompt " {
|
|
|
|
kfail gdb/1328 "$test"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# See if handle SIG32 helps (a little) with a static multi-threaded
|
|
|
|
# program.
|
|
|
|
|
2005-04-30 19:56:47 +00:00
|
|
|
set sig "SIG32"
|
|
|
|
|
|
|
|
# SIGRTMIN is 37 on hppa-linux and hpux
|
|
|
|
if [istarget hppa*-*-*] {
|
|
|
|
set sig "SIG37"
|
|
|
|
}
|
|
|
|
|
2004-09-01 18:02:45 +00:00
|
|
|
rerun_to_main
|
2005-04-30 19:56:47 +00:00
|
|
|
gdb_test "handle $sig nostop noprint pass"
|
|
|
|
set test "Handle $sig helps"
|
|
|
|
gdb_test "continue" " .*sem_post .*" "handle $sig helps"
|
2004-09-01 18:02:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
# See if info threads produces anything approaching a thread list.
|
|
|
|
|
|
|
|
set test "info threads"
|
|
|
|
gdb_test_multiple "info threads" "$test" {
|
|
|
|
-re " Thread .*$gdb_prompt " {
|
|
|
|
pass "$test"
|
|
|
|
}
|
|
|
|
-re "$gdb_prompt " {
|
|
|
|
kfail gdb/1328 "$test"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Check that the program can be quit.
|
|
|
|
|
|
|
|
set test "GDB exits with static thread program"
|
|
|
|
gdb_test_multiple "quit" "$test" {
|
2009-08-14 14:28:15 +00:00
|
|
|
-re "Quit anyway\\? \\(y or n\\) $" {
|
2004-09-01 18:02:45 +00:00
|
|
|
send_gdb "y\n"
|
|
|
|
exp_continue
|
|
|
|
}
|
|
|
|
eof {
|
|
|
|
pass "$test"
|
|
|
|
}
|
|
|
|
}
|