]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.hp/more-steps.exp
import gdb-19990422 snapshot
[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 { [skip_hp_tests] } then { continue }
30
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
36 set testfile more-steps
37 set srcfile ${srcdir}/${subdir}/${testfile}.c
38 set binfile ${objdir}/${subdir}/${testfile}
39
40 if [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
50 if {$gcc_compiled == 0} {
51 set additional_flags "additional_flags=-Ae"
52 } else {
53 set additional_flags ""
54 }
55
56 if { [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
60 if { ![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 #
73 set oldtimeout $timeout
74 set timeout [expr "$timeout + 300"]
75 set 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 #
92 proc fix_timeout {} {
93 gdb_test "p \$pc" ".*" ""
94 }
95
96 #=========================
97 #
98 # Simple sanity test first.
99 #
100 gdb_exit
101 gdb_start
102 gdb_reinitialize_dir $srcdir/$subdir
103 gdb_load ${binfile}
104
105 # First, step in the main thread.
106 #
107 gdb_test "b do_pass" ".*Breakpoint 1.*" ""
108 gdb_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 #
115 gdb_test "tb 87" ".*Breakpoint 2.*" ""
116 gdb_test "tb 91" ".*Breakpoint 3.*" ""
117 gdb_test "tb 96" ".*Breakpoint 4.*" ""
118 gdb_test "tb 113" ".*Breakpoint 5.*" ""
119 gdb_test "c" ".*do_pass.*87.*" "87"
120 gdb_test "n" ".*do_pass.*91.*" "n"
121
122 # This only gets a number, as it doesn't
123 # hit a bpt.
124 #
125 gdb_test "n" ".*95.*" "n"
126
127 gdb_test "n" ".*do_pass.*96.*" "n"
128 gdb_test "c" ".*do_pass.*113.*" "c"
129 gdb_test "c" ".*Program exited normally.*" "c"
130
131 # Now step in a thread
132 #
133 gdb_test "r" ".*Breakpoint.*do_pass.*" "do_pass"
134 gdb_test "until 87" ".*do_pass.*87.*" "until"
135 gdb_test "thr 4" ".*Switching to thread 4.*spin.*56.*" "switch"
136 gdb_test "tb 60 thr 4" ".*Breakpoint.*" ""
137
138 # If we do "next" now, all the other threads
139 # can finish!
140 #
141 gdb_test "n" ".*spin.*60.*" ""
142 gdb_test "i th" ".*\\\* 4 sys.*spin.*1 sys.*do_pass.*" "still in 4"
143
144 # Done!
145 #
146 gdb_exit
147
148 set timeout $oldtimeout
149 set verbose $oldverbose
150
151 # execute_anywhere "rm -f ${binfile}"
152 #
153 return 0
154