# user_th_basic.exp -- Expect script to test gdb with user threads
|
# user_th_basic.exp -- Expect script to test gdb with user threads
|
# Copyright (C) 1992 Free Software Foundation, Inc.
|
# Copyright (C) 1992 Free Software Foundation, Inc.
|
|
|
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 2 of the License, or
|
# (at your option) any later version.
|
# (at your option) any later version.
|
#
|
#
|
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
#
|
#
|
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
# Please email any bugs, comments, and/or additions to this file to:
|
# bug-gdb@prep.ai.mit.edu
|
# bug-gdb@prep.ai.mit.edu
|
|
|
if $tracelevel {
|
if $tracelevel {
|
strace $tracelevel
|
strace $tracelevel
|
}
|
}
|
|
|
if { ![istarget "hppa*-*-hpux*"] || [istarget "hppa2.0w-*-*"] } {
|
if { ![istarget "hppa*-*-hpux*"] || [istarget "hppa2.0w-*-*"] } {
|
verbose "HPUX thread test ignored for non-hppa or PA64 targets."
|
verbose "HPUX thread test ignored for non-hppa or PA64 targets."
|
return 0
|
return 0
|
}
|
}
|
|
|
set testfile usrthfork
|
set testfile usrthfork
|
set srcfile ${srcdir}/${subdir}/${testfile}.c
|
set srcfile ${srcdir}/${subdir}/${testfile}.c
|
set binfile ${srcdir}/${subdir}/${testfile}
|
set binfile ${srcdir}/${subdir}/${testfile}
|
|
|
# To build the executable we need to link against the thread library.
|
# To build the executable we need to link against the thread library.
|
#
|
#
|
# /opt/ansic/bin/cc -Ae -g -o usrthfork -lcma usrthfork.c
|
# /opt/ansic/bin/cc -Ae -g -o usrthfork -lcma usrthfork.c
|
#
|
#
|
## we have trouble building it on 11.0, so we use the prebuilt
|
## we have trouble building it on 11.0, so we use the prebuilt
|
## executable instead.
|
## executable instead.
|
##
|
##
|
##if { [gdb_compile "${srcdir}/${subdir}/${testfile}.c" "${binfile}" executable {debug additional_flags=-Ae ldflags=-lcma}] != "" } {
|
##if { [gdb_compile "${srcdir}/${subdir}/${testfile}.c" "${binfile}" executable {debug additional_flags=-Ae ldflags=-lcma}] != "" } {
|
## gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
## gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
##}
|
##}
|
|
|
#=========================
|
#=========================
|
#
|
#
|
# Test looking at threads.
|
# Test looking at threads.
|
#
|
#
|
gdb_exit
|
gdb_exit
|
gdb_start
|
gdb_start
|
gdb_reinitialize_dir $srcdir/$subdir
|
gdb_reinitialize_dir $srcdir/$subdir
|
gdb_load ${binfile}
|
gdb_load ${binfile}
|
|
|
gdb_test "set follow-fork-mode parent" ".*" "set follow-fork-mode parent"
|
gdb_test "set follow-fork-mode parent" ".*" "set follow-fork-mode parent"
|
gdb_test "b main" "Breakpoint 1.*" "b main"
|
gdb_test "b main" "Breakpoint 1.*" "b main"
|
gdb_test "run" "Breakpoint 1, main.*:8.*" "run to main"
|
gdb_test "run" "Breakpoint 1, main.*:8.*" "run to main"
|
##gdb_test "next" \
|
##gdb_test "next" \
|
## ".*New process.*Detaching after fork from process.*13.*parent.*" \
|
## ".*New process.*Detaching after fork from process.*13.*parent.*" \
|
## "next on CMA fork"
|
## "next on CMA fork"
|
send_gdb "next\n"
|
send_gdb "next\n"
|
gdb_expect {
|
gdb_expect {
|
-re ".*Detaching after fork from.*$gdb_prompt $" {
|
-re ".*Detaching after fork from.*$gdb_prompt $" {
|
pass "next on CMA fork"
|
pass "next on CMA fork"
|
}
|
}
|
-re ".*$gdb_prompt $" { fail "next on CMA fork" }
|
-re ".*$gdb_prompt $" { fail "next on CMA fork" }
|
timeout { fail "(timeout) next on CMA fork" }
|
timeout { fail "(timeout) next on CMA fork" }
|
}
|
}
|
exec sleep 1
|
exec sleep 1
|
|
|
gdb_exit
|
gdb_exit
|
|
|
return 0
|
return 0
|
|
|