1 # This testcase is part of GDB, the GNU debugger.
4 # Free Software Foundation, Inc.
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.
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.
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/>. */
19 # watch-thread_num.exp Test thread <thread_num> parameter for
27 set testfile watch_thread_num
28 set srcfile ${testfile}.c
29 set binfile ${objdir}/${subdir}/${testfile}
31 # What compiler are we using?
33 if [get_compiler_info ${binfile}] {
37 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug libs=-lpthread}] != "" } {
38 untested watch_thread_num.exp
44 gdb_reinitialize_dir $srcdir/$subdir
47 if { ![runto main] } then {
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"
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"
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"