blob: 1303fba6c36d03d0ed2d158dc4557814d5e35b5e [file] [log] [blame]
# user_th_basic.exp -- Expect script to test gdb with user threads
# Copyright (C) 1992 Free Software Foundation, Inc.
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
if $tracelevel {
strace $tracelevel
}
if { ![istarget "hppa*-*-hpux*"] || [istarget "hppa2.0w-*-*"] } {
verbose "HPUX thread test ignored for non-hppa or PA64 targets."
return 0
}
set testfile usrthfork
set srcfile ${srcdir}/${subdir}/${testfile}.c
set binfile ${srcdir}/${subdir}/${testfile}
# To build the executable we need to link against the thread library.
#
# /opt/ansic/bin/cc -Ae -g -o usrthfork -lcma usrthfork.c
#
## we have trouble building it on 11.0, so we use the prebuilt
## executable instead.
##
##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."
##}
#=========================
#
# Test looking at threads.
#
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
gdb_test "set follow-fork-mode parent" ".*" "set follow-fork-mode parent"
gdb_test "b main" "Breakpoint 1.*" "b main"
gdb_test "run" "Breakpoint 1, main.*:8.*" "run to main"
##gdb_test "next" \
## ".*New process.*Detaching after fork from process.*13.*parent.*" \
## "next on CMA fork"
send_gdb "next\n"
gdb_expect {
-re ".*Detaching after fork from.*$gdb_prompt $" {
pass "next on CMA fork"
}
-re ".*$gdb_prompt $" { fail "next on CMA fork" }
timeout { fail "(timeout) next on CMA fork" }
}
exec sleep 1
gdb_exit
return 0