• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/gdb/gdb/testsuite/gdb.base/
1#   Copyright 1995, 1996, 1997, 1999, 2007 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 3 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, see <http://www.gnu.org/licenses/>.
15
16if [target_info exists gdb,nosignals] {
17    verbose "Skipping sigall.exp because of nosignals."
18    continue
19}
20
21if $tracelevel then {
22	strace $tracelevel
23}
24
25set prms_id 0
26set bug_id 0
27
28gdb_exit
29gdb_start
30gdb_reinitialize_dir $srcdir/$subdir
31
32set testfile sigall
33set srcfile ${testfile}.c
34set binfile ${objdir}/${subdir}/${testfile}
35if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
36     untested sigall.exp
37     return -1
38}
39
40# Make the first signal SIGABRT because it is always supported.
41set sig_supported 1
42set thissig "ABRT"
43
44proc test_one_sig {nextsig} {
45    global sig_supported
46    global gdb_prompt
47    global thissig
48
49    set this_sig_supported $sig_supported
50    gdb_test "handle SIG$thissig stop print" \
51	"SIG$thissig\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
52    gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*"
53    gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*"
54
55    set need_another_continue 1
56    set missed_handler 0
57    if $this_sig_supported then {
58	send_gdb "continue\n"
59	if { $thissig == "IO" } {
60	    setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
61	}
62	gdb_expect {
63	    -re "Continuing.*Program received signal SIG$thissig.*$gdb_prompt $" {
64		pass "get signal $thissig"
65	    }
66	    -re ".*$gdb_prompt $" {
67		fail "get signal $thissig"
68		set need_another_continue 0
69	    }
70	    default {
71		fail "get signal $thissig (eof or timeout)"
72	    }
73	}
74    }
75    if [ istarget "alpha-dec-osf3*" ] then {
76	# OSF/1-3.x is unable to continue with a job control stop signal.
77	# The inferior remains stopped without an event of interest
78	# and GDB waits forever for the inferior to stop on an event
79	# of interest. Work around the kernel bug.
80	if { $thissig == "TSTP" || $thissig == "TTIN" || $thissig == "TTOU" } {
81	    setup_xfail "alpha-dec-osf3*"
82	    fail "cannot continue from signal $thissig"
83	    set need_another_continue 0
84	}
85    }
86
87    if $need_another_continue then {
88	send_gdb "continue\n"
89	if { $thissig == "URG" } {
90	    setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
91	}
92        # Either Lynx or GDB screws up on SIGPRIO
93	if { $thissig == "PRIO" } {
94	    setup_xfail "*-*-*lynx*"
95	}
96	gdb_expect {
97	    -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" {
98		pass "send signal $thissig"
99	    }
100	    -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
101		fail "missed breakpoint at handle_$thissig"
102		set missed_handler 1
103	    }
104	}
105    }
106
107    if { $missed_handler == "0" } then {
108        send_gdb "signal 0\n"
109        gdb_expect {
110	    -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
111	        pass "advance to $nextsig"
112	        set sig_supported 1
113	    }
114	    -re "Breakpoint.*gen_$nextsig.*handle.*$gdb_prompt $" {
115	        pass "advance to $nextsig"
116	        set sig_supported 0
117	    }
118	    -re ".*$gdb_prompt $" { fail "advance to $nextsig" }
119	    default { fail "advance to $nextsig (eof or timeout)" }
120        }
121    }
122    set thissig $nextsig
123}
124
125gdb_load $binfile
126
127runto gen_ABRT
128test_one_sig HUP
129test_one_sig QUIT
130test_one_sig ILL
131test_one_sig EMT
132test_one_sig FPE
133test_one_sig BUS
134test_one_sig SEGV
135test_one_sig SYS
136test_one_sig PIPE
137test_one_sig ALRM
138test_one_sig URG
139test_one_sig TSTP
140test_one_sig CONT
141test_one_sig CHLD
142test_one_sig TTIN
143test_one_sig TTOU
144test_one_sig IO
145test_one_sig XCPU
146test_one_sig XFSZ
147test_one_sig VTALRM
148test_one_sig PROF
149test_one_sig WINCH
150test_one_sig LOST
151test_one_sig USR1
152test_one_sig USR2
153test_one_sig PWR
154test_one_sig POLL
155test_one_sig WIND
156test_one_sig PHONE
157test_one_sig WAITING
158test_one_sig LWP
159test_one_sig DANGER
160test_one_sig GRANT
161test_one_sig RETRACT
162test_one_sig MSG
163test_one_sig SOUND
164test_one_sig SAK
165test_one_sig PRIO
166test_one_sig 33
167test_one_sig 34
168test_one_sig 35
169test_one_sig 36
170test_one_sig 37
171test_one_sig 38
172test_one_sig 39
173test_one_sig 40
174test_one_sig 41
175test_one_sig 42
176test_one_sig 43
177test_one_sig 44
178test_one_sig 45
179test_one_sig 46
180test_one_sig 47
181test_one_sig 48
182test_one_sig 49
183test_one_sig 50
184test_one_sig 51
185test_one_sig 52
186test_one_sig 53
187test_one_sig 54
188test_one_sig 55
189test_one_sig 56
190test_one_sig 57
191test_one_sig 58
192test_one_sig 59
193test_one_sig 60
194test_one_sig 61
195test_one_sig 62
196test_one_sig 63
197test_one_sig TERM
198
199# The last signal (SIGTERM) gets handled slightly differently because
200# we are not setting up for another test.
201gdb_test "handle SIGTERM stop print" \
202    "SIGTERM\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes.*"
203gdb_test "b handle_TERM" "Breakpoint \[0-9\]+ .*"
204gdb_test "continue" \
205    "Continuing.*Program received signal SIGTERM.*" \
206    "get signal TERM"
207gdb_test "continue" "Breakpoint.*handle_TERM.*" "send signal TERM"
208gdb_continue_to_end "continue to sigall exit"
209
210return 0
211