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