OLD | NEW |
1 # Copyright (C) 2009-2012 Free Software Foundation, Inc. | 1 # Copyright (C) 2009-2012 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 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 | 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 | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 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/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 # Test that GDB doesn't get stuck when thread hoping over a thread | 16 # Test that GDB doesn't get stuck when thread hoping over a thread |
17 # specific breakpoint when the selected thread has gone away. | 17 # specific breakpoint when the selected thread has gone away. |
18 | 18 |
19 set testfile "threxit-hop-specific" | 19 standard_testfile |
20 set srcfile ${testfile}.c | |
21 set binfile ${objdir}/${subdir}/${testfile} | |
22 | 20 |
23 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ | 21 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ |
24 » executable [list debug "incdir=${objdir}"]] != "" } { | 22 » executable debug] != "" } { |
25 return -1 | 23 return -1 |
26 } | 24 } |
27 | 25 |
28 # Start with a fresh gdb. | 26 clean_restart ${binfile} |
29 | |
30 gdb_exit | |
31 gdb_start | |
32 gdb_reinitialize_dir $srcdir/$subdir | |
33 | |
34 gdb_load ${binfile} | |
35 | 27 |
36 runto_main | 28 runto_main |
37 | 29 |
38 # Get ourselves to the thread that exits | 30 # Get ourselves to the thread that exits |
39 gdb_breakpoint "thread_function" | 31 gdb_breakpoint "thread_function" |
40 gdb_test "continue" ".*thread_function.*" "continue to thread start" | 32 gdb_test "continue" ".*thread_function.*" "continue to thread start" |
41 | 33 |
42 # Set a thread specific breakpoint somewhere the main thread will pass | 34 # Set a thread specific breakpoint somewhere the main thread will pass |
43 # by, but make it specific to the thread that is going to exit. Step | 35 # by, but make it specific to the thread that is going to exit. Step |
44 # over the pthread_exit call. GDB should still be able to step over | 36 # over the pthread_exit call. GDB should still be able to step over |
45 # the thread specific breakpoint, and reach the other breakpoint, | 37 # the thread specific breakpoint, and reach the other breakpoint, |
46 # which is not thread specific. | 38 # which is not thread specific. |
47 set bpthrline [gdb_get_line_number "set thread specific breakpoint here"] | 39 set bpthrline [gdb_get_line_number "set thread specific breakpoint here"] |
48 gdb_test "break $bpthrline thread 2" \ | 40 gdb_test "break $bpthrline thread 2" \ |
49 "Breakpoint .*$srcfile.*$bpthrline.*" \ | 41 "Breakpoint .*$srcfile.*$bpthrline.*" \ |
50 "set thread specific breakpoint" | 42 "set thread specific breakpoint" |
51 | 43 |
52 set bpexitline [gdb_get_line_number "set exit breakpoint here"] | 44 set bpexitline [gdb_get_line_number "set exit breakpoint here"] |
53 gdb_breakpoint "$bpexitline" | 45 gdb_breakpoint "$bpexitline" |
54 | 46 |
55 gdb_test "continue" \ | 47 gdb_test "continue" \ |
56 ".*set exit breakpoint here.*" \ | 48 ".*set exit breakpoint here.*" \ |
57 "get past the thread specific breakpoint" | 49 "get past the thread specific breakpoint" |
58 | 50 |
59 return 0 | 51 return 0 |
OLD | NEW |