* symtab.h: #include "defs.h".
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / watch_thread_num.exp
CommitLineData
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
23if $tracelevel then {
24 strace $tracelevel
25}
26
27set testfile watch_thread_num
28set srcfile ${testfile}.c
29set binfile ${objdir}/${subdir}/${testfile}
30
31# What compiler are we using?
32#
33if [get_compiler_info ${binfile}] {
34 return -1
35}
36
37if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug libs=-lpthread}] != "" } {
38 untested watch_thread_num.exp
39 return -1
40}
41
42gdb_exit
43gdb_start
44gdb_reinitialize_dir $srcdir/$subdir
45gdb_load ${binfile}
46
47if { ![runto main] } then {
48 fail "run to main"
49 return
50}
51
52gdb_test "watch shared_var thread 0" "Unknown thread 0\." "Watchpoint on invalid thread"
53gdb_test "watch shared_var thread" "A syntax error in expression, near `thread'\." "Invalid watch syntax"
54
55gdb_test "Next 5" ""
56
57gdb_test "watch shared_var thread 2" "Hardware watchpoint 2: shared_var" "Watchpoint on shared variable"
58gdb_test "info breakpoint 2" "stop only in thread 2"
59
60for {set i 0} {$i < 10} {incr i 1} {
61gdb_test "continue" "Hardware watchpoint 2: shared_var.*" "Watchpoint triggered"
62gdb_test "thread" "\\\[Current thread is 2 \\\(Thread $hex \\\(LWP $decimal\\\)\\\)\\\]" "Check thread that triggered"
63}
64
This page took 0.026094 seconds and 4 git commands to generate.