OSDN Git Service

Copyright updates for 2007.
[pf3gnuchains/pf3gnuchains3x.git] / gdb / testsuite / gdb.trace / passcount.exp
1 #   Copyright 1998, 2007 Free Software Foundation, Inc.
2 #
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
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
19
20 # This file was written by Michael Snyder (msnyder@cygnus.com)
21
22 load_lib "trace-support.exp";
23
24 if $tracelevel then {
25     strace $tracelevel
26 }
27
28 set prms_id 0
29 set bug_id 0
30
31 gdb_exit
32 gdb_start
33 if [istarget "m68k-*-elf"] then {
34     set srcfile gdb_c_test.c
35     set binfile [board_info target d490_binfile];
36 } else {
37     set testfile "actions"
38     set srcfile ${testfile}.c
39     set binfile $objdir/$subdir/$testfile
40     if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
41             executable {debug nowarnings}] != "" } {
42         untested passcount.exp
43         return -1
44     }
45 }
46 gdb_reinitialize_dir $srcdir/$subdir
47
48 # If testing on a remote host, download the source file.
49 # remote_download host $srcdir/$subdir/$srcfile
50
51 gdb_file_cmd $binfile
52
53 # define relative source line numbers:
54 # all subsequent line numbers are relative to this first one (baseline)
55 set baseline  [gdb_find_recursion_test_baseline $srcfile];
56 if { $baseline == -1 } then {
57     fail "Could not find gdb_recursion_test function"
58     return;
59 }
60
61 set testline1  [expr $baseline + 3]
62
63 #
64 # test "passcount" command
65 #
66
67 gdb_delete_tracepoints
68 set trcpt1 [gdb_gettpnum gdb_c_test];
69 set trcpt2 [gdb_gettpnum gdb_asm_test];
70 set trcpt3 [gdb_gettpnum $testline1];
71 if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then {
72     fail "setting tracepoints"
73     return;
74 }
75
76 # 4.1 passcount of specified tracepoint
77
78 gdb_test "info tracepoints" \
79     "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_recursion_test.*" \
80                         "4.1a: set three tracepoints, passcounts all zero"
81
82 gdb_test "passcount 2 $trcpt1" \
83         "Setting tracepoint $trcpt1.s passcount to 2" \
84         "4.1b: set 1st tracepoint's passcount to two"
85
86 gdb_test "info tracepoints" \
87         "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_recursion_test.*" \
88         "4.1c: verify 1st tracepoint's passcount set to two"
89
90 gdb_test "passcount 4 $trcpt2" \
91         "Setting tracepoint $trcpt2.s passcount to 4" \
92         "4.1d: set 2nd tracepoint's passcount to four"
93
94 gdb_test "info tracepoints" \
95         "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_recursion_test.*" \
96         "4.1c: verify 2nd tracepoint's passcount set to four"
97
98 # 4.2 passcount of last (default) tracepoint
99
100 gdb_test "passcount 6" \
101         "Setting tracepoint $trcpt3.s passcount to 6" \
102         "4.2b: set last (default) tp's passcount to six"
103
104 gdb_test "info tracepoints" \
105         "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+6\[\t \]+.*in gdb_recursion_test.*" \
106         "4.2b: verify last (default) tp's passcount set to six"
107
108 # 4.3 run until stopped explicitly by user
109 #     [deferred to dynamic test section]
110
111 # 4.4 reset the previously set passcounts to new values
112
113 gdb_test "passcount 7" \
114         "Setting tracepoint $trcpt3.s passcount to 7" \
115         "4.4a: reset last (default) tp's passcount to seven"
116
117 gdb_test "info tracepoints" \
118         "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+7\[\t \]+.*in gdb_recursion_test.*" \
119         "4.4a: verify reset last (default) tp's passcount to seven"
120
121 gdb_test "passcount 5 $trcpt2" \
122         "Setting tracepoint $trcpt2.s passcount to 5" \
123         "4.4b: reset second tracepoint's passcount to five"
124
125 gdb_test "info tracepoints" \
126         "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+2\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+5\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+7\[\t \]+.*in gdb_recursion_test.*" \
127         "4.4c: verify reset second tracepoint's passcount to five"
128
129 # 4.20 <FIXME test number> passcount for "all"
130
131 gdb_test "passcount 3 all" \
132         ".*$trcpt1.s pass.* 3.*$trcpt2.s pass.* 3.*$trcpt3.s pass.* 3" \
133         "4.20a: set all three passcounts to three"
134
135 gdb_test "info tracepoints" \
136         "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+3\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+3\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+3\[\t \]+.*in gdb_recursion_test.*" \
137         "4.20a: set all three passcounts to three"
138
139 gdb_test "passcount 4 all" \
140         ".*$trcpt1.s pass.* 4.*$trcpt2.s pass.* 4.*$trcpt3.s pass.* 4" \
141         "4.20a: reset all three passcounts to four"
142
143 gdb_test "info tracepoints" \
144         "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*in gdb_recursion_test.*" \
145         "4.20b: reset all three passcounts to four"
146
147 # 4.5 Verify trace stops on first "satisfied" passcount
148 #     [deferred to dynamic test section]
149
150 # 4.6 minimum passcount boundary condition
151
152 gdb_test "passcount 0 $trcpt1" \
153         "Setting tracepoint $trcpt1.s passcount to 0" \
154         "4.6: set passcount to zero"
155
156 gdb_test "info tracepoints" \
157         "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+0\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*in gdb_recursion_test.*" \
158         "4.6: set passcount to zero"
159
160 # 4.7 (test a very large passcount)
161
162 gdb_test "passcount 32767 $trcpt1" \
163         "Setting tracepoint $trcpt1.s passcount to 32767" \
164         "4.7: set passcount to large number (32767)"
165
166 gdb_test "info tracepoints" \
167         "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+$hex\[\t \]+32767\[\t \]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+$hex\[\t \]+4\[\t \]+.*in gdb_recursion_test.*" \
168         "4.7: set passcount to large number (32767)"
169
170 # 4.8 set passcount for invalid tracepoint
171
172 gdb_test "passcount 1 [expr $trcpt2 + $trcpt3]" \
173         "No tracepoint number [expr $trcpt2 + $trcpt3]." \
174         "4.8: invalid tracepoint number in passcount"
175
176 # 4.9 help passcount
177 gdb_test "help passcount" "Set the passcount for a tracepoint.*" \
178         "4.9: help passcount"
179