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