]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.hp/more-steps.exp
Initial creation of sourceware repository
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.hp / more-steps.exp
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
25 if $tracelevel then {
26 strace $tracelevel
27 }
28
29 #if { ![istarget "hppa*-*-hpux10.30"] && ![istarget "hppa*-*-hpux11.*"] } {
30 # verbose "HPUX thread test ignored for non-hppa or pre-HP/UX-10.30 targets."
31 # return 0
32 #}
33
34 set testfile more-steps
35 set srcfile ${srcdir}/${subdir}/${testfile}.c
36 set binfile ${objdir}/${subdir}/${testfile}
37
38 if [get_compiler_info ${binfile}] {
39 return -1
40 }
41
42 # To build the executable we need to link against the thread library.
43 #
44 # cc -Ae -g -o more-steps -lpthread more-steps.c
45 #
46 #compile "${srcfile} -Ae -g -lpthread -o ${binfile}"
47
48 if {$gcc_compiled == 0} {
49 set additional_flags "additional_flags=-Ae"
50 } else {
51 set additional_flags ""
52 }
53
54 if { [gdb_compile "${srcdir}/${subdir}/${testfile}.c" "${binfile}.o" object [list debug $additional_flags]] != "" } {
55 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
56 }
57
58 if { ![istarget "hppa*-*-hpux10.30"] && ![istarget "hppa*-*-hpux11.*"] } {
59 if { [gdb_compile "${binfile}.o" "${binfile}" executable {debug "additional_flags=-lpthread"}] != ""} {
60 gdb_suppress_entire_file "Testcase link failed, so all tests in this file will automatically fail."
61 }
62 } else {
63 remote_exec build "ld /usr/ccs/lib/crt0.o ${binfile}.o -lcl -lpthread -lc /opt/langtools/lib/end.o -o ${binfile}"
64 }
65 #remote_exec build "ld /usr/ccs/lib/crt0.o ${binfile}.o -lcl -lpthread -lc /opt/langtools/lib/end.o -o ${binfile}"
66
67
68
69 # Thread stuff is _slow_; prepare for long waits.
70 #
71 set oldtimeout $timeout
72 set timeout [expr "$timeout + 300"]
73 set oldverbose $verbose
74 #set verbose 40
75
76 # Further, this test has some "null" lines designed
77 # to consume output from gdb that was too late to be
78 # matched (sequence is "gdb_test" sends; timeout and
79 # on to next send; result finally comes in; mismatch).
80 #
81 # The null command is 'gdb_test "p \$pc" ".*" ""'
82 #
83 # NOTE: to pass a literal "$", "/" or "*" (etc.) to gdb_test,
84 # remember that the pattern will be escaped once and
85 # $-evaluated twice:
86 #
87 # "\\\*" matches "\*"
88 # "\$" matches "$"
89 #
90 proc fix_timeout {} {
91 gdb_test "p \$pc" ".*" ""
92 }
93
94 #=========================
95 #
96 # Simple sanity test first.
97 #
98 gdb_exit
99 gdb_start
100 gdb_reinitialize_dir $srcdir/$subdir
101 gdb_load ${binfile}
102
103 # First, step in the main thread.
104 #
105 gdb_test "b do_pass" ".*Breakpoint 1.*" ""
106 gdb_test "r" ".*Breakpoint 1.*do_pass.*" ""
107
108 # Breaks as well as nexts to make
109 # sure we can handle simultaneous hit
110 # of bpt and step, as well as stepping
111 # past bpts.
112 #
113 gdb_test "tb 87" ".*Breakpoint 2.*" ""
114 gdb_test "tb 91" ".*Breakpoint 3.*" ""
115 gdb_test "tb 96" ".*Breakpoint 4.*" ""
116 gdb_test "tb 113" ".*Breakpoint 5.*" ""
117 gdb_test "c" ".*do_pass.*87.*" "87"
118 gdb_test "n" ".*do_pass.*91.*" "n"
119
120 # This only gets a number, as it doesn't
121 # hit a bpt.
122 #
123 gdb_test "n" ".*95.*" "n"
124
125 gdb_test "n" ".*do_pass.*96.*" "n"
126 gdb_test "c" ".*do_pass.*113.*" "c"
127 gdb_test "c" ".*Program exited normally.*" "c"
128
129 # Now step in a thread
130 #
131 gdb_test "r" ".*Breakpoint.*do_pass.*" "do_pass"
132 gdb_test "until 87" ".*do_pass.*87.*" "until"
133 gdb_test "thr 4" ".*Switching to thread 4.*spin.*56.*" "switch"
134 gdb_test "tb 60 thr 4" ".*Breakpoint.*" ""
135
136 # If we do "next" now, all the other threads
137 # can finish!
138 #
139 gdb_test "n" ".*spin.*60.*" ""
140 gdb_test "i th" ".*\\\* 4 sys.*spin.*1 sys.*do_pass.*" "still in 4"
141
142 # Done!
143 #
144 gdb_exit
145
146 set timeout $oldtimeout
147 set verbose $oldverbose
148
149 # execute_anywhere "rm -f ${binfile}"
150 #
151 return 0
152