Commit | Line | Data |
---|---|---|
42a4f53d | 1 | # Copyright (C) 2009-2019 Free Software Foundation, Inc. |
b3444185 PA |
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 | # Test that GDB doesn't get stuck when stepping over an exec call done | |
17 | # by a thread other than the main thread. | |
18 | ||
0efbbabc | 19 | standard_testfile |
b3444185 PA |
20 | |
21 | if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ | |
0efbbabc | 22 | executable debug] != "" } { |
b3444185 PA |
23 | return -1 |
24 | } | |
25 | ||
034f788c PA |
26 | # Run the test proper. SCHEDLOCK specifies what scheduler-locking |
27 | # should be set to. | |
28 | ||
29 | proc do_test { schedlock } { | |
30 | global binfile | |
31 | ||
95e50b27 PA |
32 | if {$schedlock == "non-stop"} { |
33 | set prefix $schedlock | |
34 | } else { | |
35 | set prefix "schedlock $schedlock" | |
36 | } | |
37 | with_test_prefix "$prefix" { | |
034f788c PA |
38 | clean_restart ${binfile} |
39 | ||
95e50b27 PA |
40 | if {$schedlock == "non-stop"} { |
41 | gdb_test_no_output "set non-stop 1" | |
42 | } | |
43 | ||
034f788c PA |
44 | if ![runto_main] { |
45 | return 0 | |
46 | } | |
47 | ||
48 | # Get ourselves to the thread that execs. | |
49 | gdb_breakpoint "thread_execler" | |
50 | gdb_test "continue" ".*thread_execler.*" "continue to thread start" | |
51 | ||
95e50b27 PA |
52 | if {$schedlock == "non-stop"} { |
53 | gdb_test "thread 2" \ | |
54 | "Switching to .*thread_execler.*" \ | |
55 | "switch to event thread" | |
56 | } | |
57 | ||
034f788c PA |
58 | # Now set a breakpoint at `main', and step over the execl call. The |
59 | # breakpoint at main should be reached. GDB should not try to revert | |
60 | # back to the old thread from the old image and resume stepping it | |
61 | # (since it is gone). | |
62 | gdb_breakpoint "main" | |
95e50b27 PA |
63 | |
64 | if {$schedlock != "non-stop"} { | |
65 | gdb_test_no_output "set scheduler-locking $schedlock" | |
66 | } | |
034f788c PA |
67 | gdb_test "next" ".*main.*" "get to main in new image" |
68 | } | |
69 | } | |
b3444185 | 70 | |
95e50b27 | 71 | foreach schedlock {"off" "step" "on" "non-stop"} { |
034f788c PA |
72 | do_test $schedlock |
73 | } |