OLD | NEW |
1 # Copyright 2004, 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 2004, 2007-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 # This file was written by Daniel Jacobowitz <drow@mvista.com>. | 16 # This file was written by Daniel Jacobowitz <drow@mvista.com>. |
17 # It tests that the correct breakpoint is reported when we hit a | 17 # It tests that the correct breakpoint is reported when we hit a |
18 # thread-specific breakpoint inserted for several threads. | 18 # thread-specific breakpoint inserted for several threads. |
19 | 19 |
20 if $tracelevel then { | |
21 strace $tracelevel | |
22 } | |
23 | 20 |
| 21 standard_testfile |
24 | 22 |
25 set testfile "thread-specific" | 23 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
le debug] != "" } { |
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}"]] != "" } { | |
30 return -1 | 24 return -1 |
31 } | 25 } |
32 | 26 |
33 # Return a list of the valid thread IDs, with the initial thread first. | 27 # Return a list of the valid thread IDs, with the initial thread first. |
34 proc get_thread_list { } { | 28 proc get_thread_list { } { |
35 global gdb_prompt | 29 global gdb_prompt |
36 global expect_out | 30 global expect_out |
37 | 31 |
38 set thr_list "" | 32 set thr_list "" |
39 | 33 |
(...skipping 20 matching lines...) Expand all Loading... |
60 pass "get threads list" | 54 pass "get threads list" |
61 } else { | 55 } else { |
62 fail "get threads list (no threads)" | 56 fail "get threads list (no threads)" |
63 } | 57 } |
64 } | 58 } |
65 } | 59 } |
66 | 60 |
67 return $thr_list | 61 return $thr_list |
68 } | 62 } |
69 | 63 |
70 # Start with a fresh gdb. | 64 clean_restart ${binfile} |
71 | |
72 gdb_exit | |
73 gdb_start | |
74 gdb_reinitialize_dir $srcdir/$subdir | |
75 | |
76 gdb_load ${binfile} | |
77 | 65 |
78 gdb_test_no_output "set print sevenbit-strings" | 66 gdb_test_no_output "set print sevenbit-strings" |
79 gdb_test_no_output "set width 0" | 67 gdb_test_no_output "set width 0" |
80 | 68 |
81 gdb_test {print $_thread} ".* = 0" "thread var when not running" | 69 gdb_test {print $_thread} ".* = 0" "thread var when not running" |
82 | 70 |
83 runto_main | 71 runto_main |
84 | 72 |
85 gdb_breakpoint [gdb_get_line_number "thread-specific.exp: last thread start"] | 73 gdb_breakpoint [gdb_get_line_number "thread-specific.exp: last thread start"] |
86 gdb_continue_to_breakpoint "all threads started" | 74 gdb_continue_to_breakpoint "all threads started" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 gdb_test_multiple "info breakpoint $this_breakpoint" "info on bp" { | 108 gdb_test_multiple "info breakpoint $this_breakpoint" "info on bp" { |
121 -re ".*stop only in thread (\[0-9\]*).*$gdb_prompt $" { | 109 -re ".*stop only in thread (\[0-9\]*).*$gdb_prompt $" { |
122 set this_thread $expect_out(1,string) | 110 set this_thread $expect_out(1,string) |
123 pass "found breakpoint for thread number" | 111 pass "found breakpoint for thread number" |
124 } | 112 } |
125 } | 113 } |
126 | 114 |
127 gdb_test {print $_thread} ".* = $this_thread" "thread var at break" | 115 gdb_test {print $_thread} ".* = $this_thread" "thread var at break" |
128 | 116 |
129 return 0 | 117 return 0 |
OLD | NEW |