]>
Commit | Line | Data |
---|---|---|
9b254dd1 | 1 | # Copyright 1998, 2005, 2007, 2008 Free Software Foundation, Inc. |
c906108c SS |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
c906108c SS |
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. | |
e22f8b7c | 12 | # |
c906108c | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c SS |
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 | load_lib "emc-support.exp"; | |
34 | set srcfile gdb_c_test.c | |
35 | set binfile [board_info target d490_binfile]; | |
36 | gdb_test "set remotetimeout 6" "" "" | |
37 | set timeout 500 | |
38 | gdb_target_monitor $binfile | |
39 | # Give a TSTOP and ignore errors, to make sure any previous trace is off | |
40 | gdb_test "tstop" "" "" | |
41 | gdb_test "tfind none" "" "" | |
42 | send_gdb "compare-sections CS\n" | |
43 | gdb_expect { | |
44 | -re "MIS-MATCHED.*$gdb_prompt $" { | |
b60f0898 JB |
45 | untested passc-dyn.exp |
46 | return -1 | |
c906108c SS |
47 | all tests in this module will fail."; |
48 | } | |
49 | -re ".*$gdb_prompt $" { } | |
50 | } | |
51 | } else { | |
52 | set testfile "actions" | |
53 | set srcfile ${testfile}.c | |
54 | set binfile $objdir/$subdir/$testfile | |
55 | if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ | |
fc91c6c2 | 56 | executable {debug nowarnings}] != "" } { |
b60f0898 JB |
57 | untested passc-dyn.exp |
58 | return -1 | |
c906108c SS |
59 | } |
60 | gdb_load $binfile | |
61 | gdb_test "tstop" "" "" | |
62 | gdb_test "tfind none" "" "" | |
63 | runto_main | |
64 | } | |
65 | gdb_reinitialize_dir $srcdir/$subdir | |
66 | ||
67 | # We generously give ourselves one "pass" if we successfully | |
68 | # detect that this test cannot be run on this target! | |
69 | if { ![gdb_target_supports_trace] } then { | |
5f579bc5 | 70 | pass "Current target does not support trace" |
c906108c SS |
71 | return 1; |
72 | ||
73 | } | |
74 | ||
75 | # If testing on a remote host, download the source file. | |
76 | # remote_download host $srcdir/$subdir/$srcfile | |
77 | ||
78 | ||
79 | # | |
80 | # test passcount dynamically (live target) | |
81 | # | |
82 | ||
83 | set baseline [gdb_find_recursion_test_baseline $srcfile]; | |
84 | ||
85 | if { $baseline == -1 } then { | |
86 | fail "Could not find gdb_recursion_test function" | |
87 | return; | |
88 | } | |
89 | ||
90 | # define relative source line numbers: | |
91 | # all subsequent line numbers are relative to this first one (baseline) | |
92 | ||
93 | set testline2 [expr $baseline + 4] | |
94 | set testline3 [expr $baseline + 5] | |
95 | set testline4 [expr $baseline + 6] | |
96 | ||
97 | # | |
98 | # test passcount command semantics (live test) | |
99 | # | |
100 | ||
101 | ## Set three tracepoints with three different passcounts. | |
102 | ## Verify that the experiment stops after the one with the | |
103 | ## lowest passcount is hit. | |
104 | ||
105 | gdb_delete_tracepoints | |
106 | set tdp2 [gdb_gettpnum "$testline2"] | |
107 | set tdp3 [gdb_gettpnum "$testline3"] | |
108 | set tdp4 [gdb_gettpnum "$testline4"] | |
109 | if { $tdp2 <= 0 || $tdp3 <= 0 || $tdp4 <= 0 } then { | |
110 | fail "setting tracepoints" | |
111 | return; | |
112 | } | |
113 | ||
114 | gdb_test "passcount 4 $tdp2" "Setting tracepoint $tdp2's passcount to 4" \ | |
115 | "4.5: set passcount for tracepoint $tdp2" | |
116 | gdb_test "passcount 2 $tdp3" "Setting tracepoint $tdp3's passcount to 2" \ | |
117 | "4.5: set passcount for tracepoint $tdp3" | |
118 | gdb_test "passcount 3 $tdp4" "Setting tracepoint $tdp4's passcount to 3" \ | |
119 | "4.5: set passcount for tracepoint $tdp4" | |
120 | ||
121 | gdb_test "tstart" "" "" | |
122 | ||
123 | if [istarget "m68k-*-elf"] then { | |
124 | gdb_emclaptop_command "85,1,2,3,4,5,6" | |
125 | sleep 5 | |
126 | gdb_emclaptop_command "85,7,8,9,A,B,C" | |
127 | sleep 5 | |
128 | gdb_emclaptop_command "85,D,E,F,10,11,12" | |
129 | sleep 5 | |
130 | # gdb_test "tstop" | |
131 | ## | |
132 | ## Note! Must NOT give the tstop command, because the passcount | |
133 | ## has already stopped the experiment. You would not | |
134 | ## think this would be an error, but in EMC's mind it is... | |
135 | ## | |
136 | } else { | |
137 | gdb_test "break end" "" "" | |
138 | gdb_test "continue" \ | |
139 | "Continuing.*Breakpoint $decimal, end.*" \ | |
140 | "run trace experiment" | |
141 | gdb_test "tstop" "" "" | |
142 | } | |
143 | ||
144 | gdb_test "tfind none" "" "" | |
145 | if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x -1 x" ""] { | |
b60f0898 JB |
146 | untested passc-dyn.exp |
147 | return -1 | |
c906108c SS |
148 | } |
149 | ||
150 | gdb_test "tfind tracepoint $tdp2" "" "" | |
151 | if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 0 x" ""] { | |
b60f0898 JB |
152 | untested passc-dyn.exp |
153 | return -1 | |
c906108c SS |
154 | } |
155 | ||
156 | gdb_test "tfind tracepoint $tdp3" "" "" | |
157 | if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 1 x" ""] { | |
b60f0898 JB |
158 | untested passc-dyn.exp |
159 | return -1 | |
c906108c SS |
160 | } |
161 | ||
162 | gdb_test "tfind tracepoint $tdp4" "" "" | |
163 | if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 2 x" ""] { | |
b60f0898 JB |
164 | untested passc-dyn.exp |
165 | return -1 | |
c906108c SS |
166 | } |
167 | ||
168 | gdb_test "tfind tracepoint $tdp2" "" "" | |
169 | if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 3 x" ""] { | |
b60f0898 JB |
170 | untested passc-dyn.exp |
171 | return -1 | |
c906108c SS |
172 | } |
173 | ||
174 | gdb_test "tfind tracepoint $tdp3" "" "" | |
175 | if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 4 x" ""] { | |
b60f0898 JB |
176 | untested passc-dyn.exp |
177 | return -1 | |
c906108c SS |
178 | } |
179 | ||
180 | ## We should now be at the last frame, because this frame's passcount | |
181 | ## should have caused collection to stop. If we do a tfind now, | |
182 | ## it should fail. | |
183 | ||
184 | gdb_test "tfind" "failed to find.*" "4.5: dynamic passcount test" | |
185 | ||
186 | # Finished! | |
187 | gdb_test "tfind none" "" "" | |
188 |