Commit | Line | Data |
---|---|---|
88b9d363 | 1 | # Copyright 2019-2022 Free Software Foundation, Inc. |
d8c06f22 AB |
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 | |
32d1f47a | 18 | # multi-threaded inferior encounters an event that causes all threads |
d8c06f22 AB |
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 | fail "can't run to main" | |
33 | return 0 | |
34 | } | |
35 | ||
36 | # Have SIGSTOP sent to the inferior. | |
37 | gdb_test "handle SIGSTOP nostop noprint pass" \ | |
38 | [multi_line \ | |
39 | "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description" \ | |
40 | "SIGSTOP\[ \t\]+No\[ \t\]+No\[ \t\]+Yes\[ \t\]+Stopped \\(signal\\)"] | |
41 | ||
42 | # Create a breakpoint, and when we hit it automatically finish the | |
43 | # current frame. | |
44 | gdb_breakpoint breakpt | |
45 | ||
46 | # When the bug triggers this continue never completes. GDB hits the | |
47 | # breakpoint in thread 1, and then tries to stop the second thread by | |
48 | # sending it SIGSTOP. GDB sees the SIGSTOP arrive in thread 2 but | |
49 | # incorrect decides to pass the SIGSTOP to the thread rather than | |
50 | # bringing the thread to a stop. | |
51 | gdb_continue_to_breakpoint breakpt |