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