OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.base/] [watch_thread_num.exp] - Blame information for rev 321

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.