Commit | Line | Data |
---|---|---|
37e4754d LM |
1 | # This testcase is part of GDB, the GNU debugger. |
2 | ||
3 | # Copyright 2007 | |
4 | # Free Software Foundation, Inc. | |
5 | ||
6 | # This program is free software; you can redistribute it and/or modify | |
7 | # it under the terms of the GNU General Public License as published by | |
8 | # the Free Software Foundation; either version 3 of the License, or | |
9 | # (at your option) any later version. | |
10 | # | |
11 | # This program is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
18 | ||
19 | # watch-thread_num.exp Test thread <thread_num> parameter for | |
20 | # watch commands. | |
21 | # | |
22 | ||
23 | if $tracelevel then { | |
24 | strace $tracelevel | |
25 | } | |
26 | ||
27 | set testfile watch_thread_num | |
28 | set srcfile ${testfile}.c | |
29 | set binfile ${objdir}/${subdir}/${testfile} | |
30 | ||
31 | # What compiler are we using? | |
32 | # | |
33 | if [get_compiler_info ${binfile}] { | |
34 | return -1 | |
35 | } | |
36 | ||
37 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug libs=-lpthread}] != "" } { | |
38 | untested watch_thread_num.exp | |
39 | return -1 | |
40 | } | |
41 | ||
42 | gdb_exit | |
43 | gdb_start | |
44 | gdb_reinitialize_dir $srcdir/$subdir | |
45 | gdb_load ${binfile} | |
46 | ||
47 | if { ![runto main] } then { | |
48 | fail "run to main" | |
49 | return | |
50 | } | |
51 | ||
52 | gdb_test "watch shared_var thread 0" "Unknown thread 0\." "Watchpoint on invalid thread" | |
53 | gdb_test "watch shared_var thread" "A syntax error in expression, near `thread'\." "Invalid watch syntax" | |
54 | ||
55 | gdb_test "Next 5" "" | |
56 | ||
57 | gdb_test "watch shared_var thread 2" "Hardware watchpoint 2: shared_var" "Watchpoint on shared variable" | |
58 | gdb_test "info breakpoint 2" "stop only in thread 2" | |
59 | ||
60 | for {set i 0} {$i < 10} {incr i 1} { | |
61 | gdb_test "continue" "Hardware watchpoint 2: shared_var.*" "Watchpoint triggered" | |
62 | gdb_test "thread" "\\\[Current thread is 2 \\\(Thread $hex \\\(LWP $decimal\\\)\\\)\\\]" "Check thread that triggered" | |
63 | } | |
64 |