]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.threads/stop-with-handle.exp
Automatic Copyright Year update after running gdb/copyright.py
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.threads / stop-with-handle.exp
1 # Copyright 2019-2022 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
16 # This test covers a case where SIGSTOP has been configured to be
17 # passed to the target with GDB's 'handle' command, and then a
18 # multi-threaded inferior encounters an event that causes all threads
19 # to be stopped.
20 #
21 # The problem that (used) to exist was that GDB would see the SIGSTOP,
22 # but decide to ignore the signal based on the handle table.
23
24 standard_testfile
25
26 if {[prepare_for_testing "failed to prepare" \
27 "${testfile}" "${srcfile}" {debug pthreads}]} {
28 return -1
29 }
30
31 if ![runto_main] then {
32 return 0
33 }
34
35 # Have SIGSTOP sent to the inferior.
36 gdb_test "handle SIGSTOP nostop noprint pass" \
37 [multi_line \
38 "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description" \
39 "SIGSTOP\[ \t\]+No\[ \t\]+No\[ \t\]+Yes\[ \t\]+Stopped \\(signal\\)"]
40
41 # Create a breakpoint, and when we hit it automatically finish the
42 # current frame.
43 gdb_breakpoint breakpt
44
45 # When the bug triggers this continue never completes. GDB hits the
46 # breakpoint in thread 1, and then tries to stop the second thread by
47 # sending it SIGSTOP. GDB sees the SIGSTOP arrive in thread 2 but
48 # incorrect decides to pass the SIGSTOP to the thread rather than
49 # bringing the thread to a stop.
50 gdb_continue_to_breakpoint breakpt