OLD | NEW |
1 # Copyright (C) 2004, 2007-2008, 2010-2012 Free Software Foundation, | 1 # Copyright (C) 2004, 2007-2008, 2010-2012 Free Software Foundation, |
2 # Inc. | 2 # Inc. |
3 | 3 |
4 # This program is free software; you can redistribute it and/or modify | 4 # This program is free software; you can redistribute it and/or modify |
5 # it under the terms of the GNU General Public License as published by | 5 # it under the terms of the GNU General Public License as published by |
6 # the Free Software Foundation; either version 3 of the License, or | 6 # the Free Software Foundation; either version 3 of the License, or |
7 # (at your option) any later version. | 7 # (at your option) any later version. |
8 # | 8 # |
9 # This program is distributed in the hope that it will be useful, | 9 # This program is distributed in the hope that it will be useful, |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 # GNU General Public License for more details. | 12 # GNU General Public License for more details. |
13 # | 13 # |
14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 |
17 # Test making hand function calls in multiple threads. | 17 # Test making hand function calls in multiple threads. |
18 | 18 |
19 set NR_THREADS 4 | 19 set NR_THREADS 4 |
20 | 20 |
21 if $tracelevel then { | 21 standard_testfile |
22 » strace $tracelevel | |
23 } | |
24 | 22 |
25 set testfile "hand-call-in-threads" | 23 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
le [list debug "additional_flags=-DNR_THREADS=$NR_THREADS"]] != "" } { |
26 set srcfile ${testfile}.c | |
27 set binfile ${objdir}/${subdir}/${testfile} | |
28 | |
29 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
le [list debug "incdir=${objdir}" "additional_flags=-DNR_THREADS=$NR_THREADS"]]
!= "" } { | |
30 return -1 | 24 return -1 |
31 } | 25 } |
32 | 26 |
33 # Some targets can't do function calls, so don't even bother with this | 27 # Some targets can't do function calls, so don't even bother with this |
34 # test. | 28 # test. |
35 if [target_info exists gdb,cannot_call_functions] { | 29 if [target_info exists gdb,cannot_call_functions] { |
36 setup_xfail "*-*-*" 2416 | 30 setup_xfail "*-*-*" 2416 |
37 fail "This target can not call functions" | 31 fail "This target can not call functions" |
38 continue | 32 continue |
39 } | 33 } |
40 | 34 |
41 proc get_dummy_frame_number { } { | 35 proc get_dummy_frame_number { } { |
42 global gdb_prompt | 36 global gdb_prompt |
43 | 37 |
44 gdb_test_multiple "bt" "" { | 38 gdb_test_multiple "bt" "" { |
45 -re "#(\[0-9\]*) *<function called from gdb>.*$gdb_prompt $" { | 39 -re "#(\[0-9\]*) *<function called from gdb>.*$gdb_prompt $" { |
46 return $expect_out(1,string) | 40 return $expect_out(1,string) |
47 } | 41 } |
48 -re "$gdb_prompt $" { | 42 -re "$gdb_prompt $" { |
49 return "" | 43 return "" |
50 } | 44 } |
51 timeout { | 45 timeout { |
52 return "" | 46 return "" |
53 } | 47 } |
54 } | 48 } |
55 return "" | 49 return "" |
56 } | 50 } |
57 | 51 |
58 gdb_exit | 52 clean_restart ${binfile} |
59 gdb_start | |
60 gdb_reinitialize_dir $srcdir/$subdir | |
61 gdb_load ${binfile} | |
62 | 53 |
63 if { ![runto_main] } { | 54 if { ![runto_main] } { |
64 fail "Can't run to main" | 55 fail "Can't run to main" |
65 return 0 | 56 return 0 |
66 } | 57 } |
67 | 58 |
68 gdb_test "break all_threads_running" \ | 59 gdb_test "break all_threads_running" \ |
69 "Breakpoint 2 at .*: file .*${srcfile}, line .*" \ | 60 "Breakpoint 2 at .*: file .*${srcfile}, line .*" \ |
70 "breakpoint on all_threads_running" | 61 "breakpoint on all_threads_running" |
71 | 62 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 # An alternative is to manually work around the issue by manually setting | 142 # An alternative is to manually work around the issue by manually setting |
152 # the thread back to the first thread: the program is still at the | 143 # the thread back to the first thread: the program is still at the |
153 # all_threads_running breakpoint, which wasn't the last thread to run, | 144 # all_threads_running breakpoint, which wasn't the last thread to run, |
154 # and gdb doesn't know how to singlestep over reported breakpoints that | 145 # and gdb doesn't know how to singlestep over reported breakpoints that |
155 # weren't in the last thread to run. | 146 # weren't in the last thread to run. |
156 #gdb_test "thread 1" ".*" "set thread to 1, prepare to resume" | 147 #gdb_test "thread 1" ".*" "set thread to 1, prepare to resume" |
157 # | 148 # |
158 #gdb_continue_to_end "hand-call-in-threads" | 149 #gdb_continue_to_end "hand-call-in-threads" |
159 | 150 |
160 return 0 | 151 return 0 |
OLD | NEW |