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