]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.hp/more-steps.exp
import gdb-1999-08-16 snapshot
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.hp / more-steps.exp
CommitLineData
c906108c
SS
1# more-steps.exp -- Expect script to test gdb's ability to step threaded pgms
2# Copyright (C) 1992 Free Software Foundation, Inc.
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17
18# Please email any bugs, comments, and/or additions to this file to:
19# bug-gdb@prep.ai.mit.edu
20
21# use this to debug:
22#
23#log_user 1
24
25if $tracelevel then {
26 strace $tracelevel
27}
28
7a292a7a
SS
29if { [skip_hp_tests] } then { continue }
30
c906108c
SS
31#if { ![istarget "hppa*-*-hpux10.30"] && ![istarget "hppa*-*-hpux11.*"] } {
32# verbose "HPUX thread test ignored for non-hppa or pre-HP/UX-10.30 targets."
33# return 0
34#}
35
36set testfile more-steps
37set srcfile ${srcdir}/${subdir}/${testfile}.c
38set binfile ${objdir}/${subdir}/${testfile}
39
40if [get_compiler_info ${binfile}] {
41 return -1
42}
43
44# To build the executable we need to link against the thread library.
45#
46# cc -Ae -g -o more-steps -lpthread more-steps.c
47#
48#compile "${srcfile} -Ae -g -lpthread -o ${binfile}"
49
50if {$gcc_compiled == 0} {
51 set additional_flags "additional_flags=-Ae"
52} else {
53 set additional_flags ""
54}
55
56if { [gdb_compile "${srcdir}/${subdir}/${testfile}.c" "${binfile}.o" object [list debug $additional_flags]] != "" } {
57 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
58}
59
60if { ![istarget "hppa*-*-hpux10.30"] && ![istarget "hppa*-*-hpux11.*"] } {
61 if { [gdb_compile "${binfile}.o" "${binfile}" executable {debug "additional_flags=-lpthread"}] != ""} {
62 gdb_suppress_entire_file "Testcase link failed, so all tests in this file will automatically fail."
63 }
64} else {
65 remote_exec build "ld /usr/ccs/lib/crt0.o ${binfile}.o -lcl -lpthread -lc /opt/langtools/lib/end.o -o ${binfile}"
66}
67#remote_exec build "ld /usr/ccs/lib/crt0.o ${binfile}.o -lcl -lpthread -lc /opt/langtools/lib/end.o -o ${binfile}"
68
69
70
71# Thread stuff is _slow_; prepare for long waits.
72#
73set oldtimeout $timeout
74set timeout [expr "$timeout + 300"]
75set oldverbose $verbose
76#set verbose 40
77
78# Further, this test has some "null" lines designed
79# to consume output from gdb that was too late to be
80# matched (sequence is "gdb_test" sends; timeout and
81# on to next send; result finally comes in; mismatch).
82#
83# The null command is 'gdb_test "p \$pc" ".*" ""'
84#
85# NOTE: to pass a literal "$", "/" or "*" (etc.) to gdb_test,
86# remember that the pattern will be escaped once and
87# $-evaluated twice:
88#
89# "\\\*" matches "\*"
90# "\$" matches "$"
91#
92proc fix_timeout {} {
93 gdb_test "p \$pc" ".*" ""
94}
95
96#=========================
97#
98# Simple sanity test first.
99#
100gdb_exit
101gdb_start
102gdb_reinitialize_dir $srcdir/$subdir
103gdb_load ${binfile}
104
105# First, step in the main thread.
106#
107gdb_test "b do_pass" ".*Breakpoint 1.*" ""
108gdb_test "r" ".*Breakpoint 1.*do_pass.*" ""
109
110# Breaks as well as nexts to make
111# sure we can handle simultaneous hit
112# of bpt and step, as well as stepping
113# past bpts.
114#
115gdb_test "tb 87" ".*Breakpoint 2.*" ""
116gdb_test "tb 91" ".*Breakpoint 3.*" ""
117gdb_test "tb 96" ".*Breakpoint 4.*" ""
118gdb_test "tb 113" ".*Breakpoint 5.*" ""
119gdb_test "c" ".*do_pass.*87.*" "87"
120gdb_test "n" ".*do_pass.*91.*" "n"
121
122# This only gets a number, as it doesn't
123# hit a bpt.
124#
125gdb_test "n" ".*95.*" "n"
126
127gdb_test "n" ".*do_pass.*96.*" "n"
128gdb_test "c" ".*do_pass.*113.*" "c"
129gdb_test "c" ".*Program exited normally.*" "c"
130
131# Now step in a thread
132#
133gdb_test "r" ".*Breakpoint.*do_pass.*" "do_pass"
134gdb_test "until 87" ".*do_pass.*87.*" "until"
135gdb_test "thr 4" ".*Switching to thread 4.*spin.*56.*" "switch"
136gdb_test "tb 60 thr 4" ".*Breakpoint.*" ""
137
138# If we do "next" now, all the other threads
139# can finish!
140#
141gdb_test "n" ".*spin.*60.*" ""
142gdb_test "i th" ".*\\\* 4 sys.*spin.*1 sys.*do_pass.*" "still in 4"
143
144# Done!
145#
146gdb_exit
147
148set timeout $oldtimeout
149set verbose $oldverbose
150
151# execute_anywhere "rm -f ${binfile}"
152#
153return 0
154