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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.trace/] [tracecmd.exp] - Blame information for rev 394

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
#   Copyright 1998, 2007, 2008, 2009, 2010 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
# 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
 
25
gdb_exit
26
gdb_start
27
set testfile "actions"
28
set srcfile ${testfile}.c
29
set binfile $objdir/$subdir/tracecmd
30
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
31
          executable {debug nowarnings}] != "" } {
32
    untested tracecmd.exp
33
    return -1
34
}
35
gdb_reinitialize_dir $srcdir/$subdir
36
 
37
# If testing on a remote host, download the source file.
38
# remote_download host $srcdir/$subdir/$srcfile
39
 
40
gdb_file_cmd $binfile
41
 
42
# define relative source line numbers:
43
# all subsequent line numbers are relative to this first one (baseline)
44
set baseline  [gdb_find_recursion_test_baseline $srcfile];
45
if { $baseline == -1 } then {
46
    fail "Could not find gdb_recursion_test function"
47
    return;
48
}
49
 
50
set testline1 [expr $baseline + 1]
51
set testline2 [expr $baseline + 3]
52
 
53
#
54
# test "help tracepoints"
55
#
56
 
57
set helpcnt 0;
58
test_class_help "tracepoints" {
59
    "Tracing of program execution without stopping the program\.[\r\n\]+"
60
} "1.0: help tracepoints"
61
 
62
#
63
# test trace command:
64
#
65
 
66
# 1.1 trace source line
67
gdb_delete_tracepoints
68
gdb_test "trace $srcfile:$testline2" \
69
        "Tracepoint $decimal at $hex: file.*$srcfile, line $testline2." \
70
        "1.1a: set tracepoint at sourceline"
71
gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline2" \
72
        "1.1b: trace sourcefile:line"
73
 
74
# 1.2 trace invalid source line
75
gdb_delete_tracepoints
76
gdb_test "trace $srcfile:99999" "No line 99999 in file \".*$srcfile\"." \
77
        "1.2a: trace invalid line in sourcefile"
78
gdb_test "info trace" "No tracepoints.*" \
79
        "1.2b: reject invalid line in srcfile"
80
 
81
# 1.3 trace line in invalid source file
82
gdb_delete_tracepoints
83
gdb_test_no_output "set breakpoint pending off"
84
gdb_test "trace NoSuChFiLe.c:1" "No source file named NoSuChFiLe.c." \
85
        "1.3a: trace invalid source file"
86
gdb_test "info trace" "No tracepoints.*" \
87
        "1.3b: reject invalid srcfile"
88
 
89
# 1.4 trace function by name
90
gdb_delete_tracepoints
91
gdb_test "trace gdb_recursion_test" \
92
        "Tracepoint $decimal at $hex: file.*$srcfile, line $testline1." \
93
        "1.4a: trace function by name"
94
gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline1" \
95
        "1.4b: trace function by name"
96
 
97
# 1.5 trace non-existant function
98
gdb_delete_tracepoints
99
gdb_test "trace NoSuChFuNc" "Function \"NoSuChFuNc\" not defined." \
100
        "1.5a: trace invalid function"
101
gdb_test "info trace" "No tracepoints.*" \
102
        "1.5b: reject invalid srcfile"
103
 
104
# 1.6 trace at a specific address
105
#     Collect the address of "gdb_asm_test", and use that.
106
gdb_test_multiple "print gdb_asm_test" "" {
107
    -re "\[$\]\[0-9\].*0x(\[0-9a-fA-F\]+).*$gdb_prompt $" {
108
        set asm_test_addr $expect_out(1,string)
109
    }
110
}
111
 
112
gdb_delete_tracepoints
113
gdb_test "trace \*0x$asm_test_addr" \
114
        "Tracepoint $decimal at .*$asm_test_addr.*" \
115
        "1.6a: trace at specific address"
116
gdb_test "info trace" "$asm_test_addr.*gdb_asm_test.*" \
117
        "1.6b: verify trace at specific address"
118
 
119
# 1.7 trace at function's exact address
120
#     Collect the address of the function for comparison
121
gdb_test_multiple "print gdb_recursion_test" "" {
122
    -re "\[$\]\[0-9\].*0x(\[0-9a-fA-F\]+).*$gdb_prompt $" {
123
        set c_test_addr $expect_out(1,string)
124
    }
125
}
126
 
127
gdb_delete_tracepoints
128
gdb_test "trace \*gdb_recursion_test" \
129
        "Tracepoint $decimal at .*$c_test_addr.*" \
130
        "1.7a: trace at function label (before prologue)"
131
gdb_test "info trace" "$c_test_addr.*in gdb_recursion_test.*:$baseline" \
132
        "1.7b: verify trace at specific address"
133
 
134
# 1.8 trace at invalid address
135
# no address is invalid
136
 
137
# 1.9 trace no arguments
138
gdb_test "trace" "No default breakpoint address now." \
139
        "1.9: trace "
140
 
141
# 1.10 there's no 1.10.
142
 
143
# 1.11 tracepoint conditions
144
gdb_delete_tracepoints
145
gdb_test "trace gdb_recursion_test if q1 > 0" \
146
        "Tracepoint $decimal at $hex: file.*$srcfile, line $testline1." \
147
        "1.11a: conditional tracepoint"
148
gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline1.*trace only if q1 > 0" \
149
        "1.11b: verify conditional tracepoint"
150
 
151
# 1.12 set tracepoint in prologue
152
# [see tfind.exp]
153
 
154
# 1.13 trace on recursion
155
# interesting only in "live" session: see backtrace.exp for live test.
156
 
157
# 1.14 help trace
158
gdb_test "help trace" "Set a tracepoint at .*" "1.14: help trace"
159
 
160
# 1.15 ftrace
161
 
162
gdb_delete_tracepoints
163
 
164
# Acceptance vs rejection of a location are target-specific, so allow both.
165
gdb_test_multiple "ftrace gdb_recursion_test" "Set a fast tracepoint" {
166
    -re "Fast tracepoint $decimal at $hex: file.*$srcfile, line $testline1.*$gdb_prompt $" {
167
        pass "Set a fast tracepoint"
168
    }
169
    -re ".*May not have a fast tracepoint at $hex.*$gdb_prompt $" {
170
        pass "Declined to set a fast tracepoint"
171
    }
172
}

powered by: WebSVN 2.1.0

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