* gdb.base/sigall.c (gen_*): Pass argument to handle_* to avoid
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / sigall.exp
1 # Copyright (C) 1995 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
16
17 if $tracelevel then {
18 strace $tracelevel
19 }
20
21 set prms_id 0
22 set bug_id 0
23
24 gdb_reinitialize_dir $srcdir/$subdir
25 set binfile $objdir/$subdir/sigall
26
27 if ![file exists $binfile] then {
28 perror "$binfile does not exist."
29 return 0
30 }
31
32 # Make the first signal SIGABRT because it is always supported.
33 set sig_supported 1
34 set thissig "ABRT"
35
36 proc test_one_sig {nextsig} {
37 global sig_supported
38 global prompt
39 global thissig
40
41 set this_sig_supported $sig_supported
42 gdb_test "handle SIG$thissig stop print" \
43 "SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes"
44 gdb_test "b handle_$thissig" "Breakpoint \[0-9\]"
45 gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]"
46 if $this_sig_supported then {
47 gdb_test "continue" \
48 "Continuing.*Program received signal SIG$thissig" \
49 "get signal $thissig"
50 }
51
52 gdb_test "continue" "Breakpoint.*handle_$thissig" "send signal $thissig"
53
54 send "continue\n"
55 expect {
56 -re "Breakpoint.*gen_$nextsig.*kill.*$prompt $" {
57 pass "advance to $nextsig"
58 set sig_supported 1
59 }
60 -re "Breakpoint.*gen_$nextsig.*handle.*$prompt $" {
61 pass "advance to $nextsig"
62 set sig_supported 0
63 }
64 -re ".*$prompt $" { fail "advance to $nextsig" }
65 default { fail "advance to $nextsig (eof or timeout)" }
66 }
67 set thissig $nextsig
68 }
69
70 gdb_load $binfile
71
72 runto gen_ABRT
73 test_one_sig HUP
74 test_one_sig QUIT
75 test_one_sig ILL
76 test_one_sig EMT
77 test_one_sig FPE
78 test_one_sig BUS
79 test_one_sig SEGV
80 test_one_sig SYS
81 test_one_sig PIPE
82 test_one_sig ALRM
83 test_one_sig URG
84 test_one_sig TSTP
85 test_one_sig CONT
86 test_one_sig CHLD
87 test_one_sig TTIN
88 test_one_sig TTOU
89 test_one_sig IO
90 test_one_sig XCPU
91 test_one_sig XFSZ
92 test_one_sig VTALRM
93 test_one_sig PROF
94 test_one_sig WINCH
95 test_one_sig LOST
96 test_one_sig USR1
97 test_one_sig USR2
98 test_one_sig PWR
99 test_one_sig POLL
100 test_one_sig WIND
101 test_one_sig PHONE
102 test_one_sig WAITING
103 test_one_sig LWP
104 test_one_sig DANGER
105 test_one_sig GRANT
106 test_one_sig RETRACT
107 test_one_sig MSG
108 test_one_sig SOUND
109 test_one_sig SAK
110 test_one_sig PRIO
111 test_one_sig 33
112 test_one_sig 34
113 test_one_sig 35
114 test_one_sig 36
115 test_one_sig 37
116 test_one_sig 38
117 test_one_sig 39
118 test_one_sig 40
119 test_one_sig 41
120 test_one_sig 42
121 test_one_sig 43
122 test_one_sig 44
123 test_one_sig 45
124 test_one_sig 46
125 test_one_sig 47
126 test_one_sig 48
127 test_one_sig 49
128 test_one_sig 50
129 test_one_sig 51
130 test_one_sig 52
131 test_one_sig 53
132 test_one_sig 54
133 test_one_sig 55
134 test_one_sig 56
135 test_one_sig 57
136 test_one_sig 58
137 test_one_sig 59
138 test_one_sig 60
139 test_one_sig 61
140 test_one_sig 62
141 test_one_sig 63
142 test_one_sig TERM
143
144 # The last signal (SIGTERM) gets handled slightly differently because
145 # we are not setting up for another test.
146 gdb_test "handle SIGTERM stop print" \
147 "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes"
148 gdb_test "b handle_TERM" "Breakpoint \[0-9\]"
149 gdb_test "continue" \
150 "Continuing.*Program received signal SIGTERM" \
151 "get signal TERM"
152 gdb_test "continue" "Breakpoint.*handle_TERM" "send signal TERM"
153 gdb_test "continue" "Program exited normally" "continue to sigall exit"
154
155 return 0
This page took 0.040545 seconds and 5 git commands to generate.