OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [testsuite/] [gdb.trace/] [tracecmd.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
#   Copyright 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
    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 additional_flags=-w}] != "" } {
42
        gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
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 + 1]
61
set testline2 [expr $baseline + 3]
62
 
63
#
64
# test "help tracepoints"
65
#
66
 
67
set helpcnt 0;
68
send_gdb "help tracepoints\n"
69
gdb_expect {
70
    -re "Tracing of program execution without stopping the program." {
71
        incr helpcnt;
72
        exp_continue
73
    }
74
    -re "actions -- Specify the actions to be taken at a tracepoint" {
75
        incr helpcnt;
76
        exp_continue
77
    }
78
    -re "collect -- Specify one or more data items to be collected" {
79
        incr helpcnt;
80
        exp_continue
81
    }
82
    -re "delete tracepoints -- Delete specified tracepoints" {
83
        incr helpcnt;
84
        exp_continue
85
    }
86
    -re "end -- Ends a list of.*actions" {
87
        incr helpcnt;
88
        exp_continue
89
    }
90
    -re "info tracepoints -- Status of tracepoints" {
91
        incr helpcnt;
92
        exp_continue
93
    }
94
    -re "passcount -- Set the passcount for a tracepoint" {
95
        incr helpcnt;
96
        exp_continue
97
    }
98
    -re "save-tracepoints -- Save current tracepoint definitions" {
99
        incr helpcnt;
100
        exp_continue
101
    }
102
    -re "tdump -- Print everything collected at the current tracepoint" {
103
        incr helpcnt;
104
        exp_continue
105
    }
106
    -re "tfind -- Select a trace frame" {
107
        incr helpcnt;
108
        exp_continue
109
    }
110
    -re "tfind end -- Synonym for 'none'" {
111
        incr helpcnt;
112
        exp_continue
113
    }
114
    -re "tfind line -- Select a trace frame by line number" {
115
        incr helpcnt;
116
        exp_continue
117
    }
118
    -re "tfind none -- De-select any trace frame and resume 'live' debugging" {
119
        incr helpcnt;
120
        exp_continue
121
    }
122
    -re "tfind outside -- Select a trace frame whose PC is outside" {
123
        incr helpcnt;
124
        exp_continue
125
    }
126
    -re "tfind pc -- Select a trace frame by PC" {
127
        incr helpcnt;
128
        exp_continue
129
    }
130
    -re "tfind range -- Select a trace frame whose PC is in the given" {
131
        incr helpcnt;
132
        exp_continue
133
    }
134
    -re "tfind start -- Select the first trace frame in the trace buffer" {
135
        incr helpcnt;
136
        exp_continue
137
    }
138
    -re "tfind tracepoint -- Select a trace frame by tracepoint number" {
139
        incr helpcnt;
140
        exp_continue
141
    }
142
    -re "trace -- Set a tracepoint at a specified line or function or addr" {
143
        incr helpcnt;
144
        exp_continue
145
    }
146
    -re "tstart -- Start trace data collection" {
147
        incr helpcnt;
148
        exp_continue
149
    }
150
    -re "tstatus -- Display the status of the current trace data collection" {
151
        incr helpcnt;
152
        exp_continue
153
    }
154
    -re "tstop -- Stop trace data collection" {
155
        incr helpcnt;
156
        exp_continue
157
    }
158
    -re "while-stepping -- Specify single-stepping behavior at a tracepoint" {
159
        incr helpcnt;
160
        exp_continue
161
    }
162
    -re ".*$gdb_prompt $" {
163
        if { $helpcnt == 21 } {
164
            pass "1.0: help tracepoints"
165
        } else {
166
            warning "$helpcnt";
167
            fail "1.0: help tracepoints"
168
        }
169
    }
170
}
171
 
172
#
173
# test trace command:
174
#
175
 
176
# 1.1 trace source line
177
gdb_delete_tracepoints
178
gdb_test "trace $srcfile:$testline2" \
179
        "Tracepoint $decimal at $hex: file.*$srcfile, line $testline2." \
180
        "1.1a: set tracepoint at sourceline"
181
gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline2" \
182
        "1.1b: trace sourcefile:line"
183
 
184
# 1.2 trace invalid source line
185
gdb_delete_tracepoints
186
gdb_test "trace $srcfile:99999" "No line 99999 in file \".*$srcfile\"." \
187
        "1.2a: trace invalid line in sourcefile"
188
gdb_test "info trace" "No tracepoints.*" \
189
        "1.2b: reject invalid line in srcfile"
190
 
191
# 1.3 trace line in invalid source file
192
gdb_delete_tracepoints
193
gdb_test "trace NoSuChFiLe.c:1" "No source file named NoSuChFiLe.c." \
194
        "1.3a: trace invalid source file"
195
gdb_test "info trace" "No tracepoints.*" \
196
        "1.3b: reject invalid srcfile"
197
 
198
# 1.4 trace function by name
199
gdb_delete_tracepoints
200
gdb_test "trace gdb_recursion_test" \
201
        "Tracepoint $decimal at $hex: file.*$srcfile, line $testline1." \
202
        "1.4a: trace function by name"
203
gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline1" \
204
        "1.4b: trace function by name"
205
 
206
# 1.5 trace non-existant function
207
gdb_delete_tracepoints
208
gdb_test "trace NoSuChFuNc" "Function \"NoSuChFuNc\" not defined." \
209
        "1.5a: trace invalid function"
210
gdb_test "info trace" "No tracepoints.*" \
211
        "1.5b: reject invalid srcfile"
212
 
213
# 1.6 trace at a specific address
214
#     Collect the address of "gdb_asm_test", and use that.
215
send_gdb "print gdb_asm_test\n"
216
gdb_expect {
217
    -re "\[$\]\[0-9\].*0x(\[0-9a-fA-F\]+).*$gdb_prompt $" {
218
        set asm_test_addr $expect_out(1,string)
219
    }
220
    timeout { }
221
}
222
 
223
gdb_delete_tracepoints
224
gdb_test "trace \*0x$asm_test_addr" \
225
        "Tracepoint $decimal at .*$asm_test_addr.*" \
226
        "1.6a: trace at specific address"
227
gdb_test "info trace" "$asm_test_addr.*gdb_asm_test.*" \
228
        "1.6b: verify trace at specific address"
229
 
230
# 1.7 trace at function's exact address
231
#     Collect the address of the function for comparison
232
send_gdb "print gdb_recursion_test\n"
233
gdb_expect {
234
    -re "\[$\]\[0-9\].*0x(\[0-9a-fA-F\]+).*$gdb_prompt $" {
235
        set c_test_addr $expect_out(1,string)
236
    }
237
    timeout { }
238
}
239
 
240
gdb_delete_tracepoints
241
gdb_test "trace \*gdb_recursion_test" \
242
        "Tracepoint $decimal at .*$c_test_addr.*" \
243
        "1.7a: trace at function label (before prologue)"
244
gdb_test "info trace" "$c_test_addr.*in gdb_recursion_test.*:$baseline" \
245
        "1.7b: verify trace at specific address"
246
 
247
# 1.8 trace at invalid address
248
# no address is invalid
249
 
250
# 1.9 trace no arguments
251
gdb_test "trace" "trace command requires an argument" \
252
        "1.9: trace "
253
 
254
# 1.10 set large number of tracepoints
255
# deferred to limits test module
256
 
257
# 1.11 tracepoint conditions
258
# conditions on tracepoints not implemented
259
 
260
# 1.12 set tracepoint in prologue
261
# [see tfind.exp]
262
 
263
# 1.13 trace on recursion
264
# interesting only in "live" session: see backtrace.exp for live test.
265
 
266
# 1.14 help trace
267
gdb_test "help trace" "Set a tracepoint at .*" "1.14: help trace"
268
 
269
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.