Commit | Line | Data |
---|---|---|
7b6bb8da | 1 | # Copyright 1998, 1999, 2007, 2008, 2009, 2010, 2011 |
4c38e0a4 | 2 | # Free Software Foundation, Inc. |
c906108c SS |
3 | # |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
c906108c SS |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
e22f8b7c | 13 | # |
c906108c | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 16 | |
c906108c SS |
17 | # This file was written by Michael Snyder (msnyder@cygnus.com) |
18 | ||
19 | load_lib "trace-support.exp"; | |
20 | ||
21 | if $tracelevel then { | |
22 | strace $tracelevel | |
23 | } | |
24 | ||
c906108c SS |
25 | |
26 | gdb_exit | |
27 | gdb_start | |
28 | ||
f8b7eaf3 DJ |
29 | set testfile "actions" |
30 | set srcfile ${testfile}.c | |
31 | set binfile $objdir/$subdir/deltrace | |
32 | if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ | |
33 | executable {debug nowarnings}] != "" } { | |
34 | untested deltrace.exp | |
35 | return -1 | |
c906108c SS |
36 | } |
37 | gdb_reinitialize_dir $srcdir/$subdir | |
38 | ||
39 | # If testing on a remote host, download the source file. | |
40 | # remote_download host $srcdir/$subdir/$srcfile | |
41 | ||
42 | gdb_file_cmd $binfile | |
43 | ||
44 | # define relative source line numbers: | |
45 | # all subsequent line numbers are relative to this first one (baseline) | |
46 | set baseline [gdb_find_recursion_test_baseline $srcfile]; | |
47 | if { $baseline == -1 } then { | |
48 | fail "Could not find gdb_recursion_test function" | |
49 | return; | |
50 | } | |
51 | set testline1 [expr $baseline + 4] | |
52 | ||
53 | # | |
54 | # test "delete tracepoints" command | |
55 | # | |
56 | ||
57 | # 3.1 delete tracepoints (all) | |
58 | gdb_delete_tracepoints | |
59 | gdb_test "trace gdb_c_test" "Tracepoint \[0-9\]+ at .*" "set tracepoint 1" | |
60 | gdb_test "trace gdb_asm_test" "Tracepoint \[0-9\]+ at .*" "set tracepoint 2" | |
61 | gdb_test "trace $testline1" "Tracepoint \[0-9\]+ at .*" "set tracepoint 3" | |
62 | ||
63 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
64 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
65 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
66 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
67 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ | |
c906108c SS |
68 | "3.1a: set three tracepoints" |
69 | ||
0ab48859 MS |
70 | gdb_test "delete tracepoints" \ |
71 | "" \ | |
72 | "3.1b: delete all tracepoints" \ | |
73 | "Delete all tracepoints.*y or n.*$" \ | |
74 | "y" | |
75 | ||
c906108c SS |
76 | |
77 | # 3.2 delete tracepoint <n> | |
78 | gdb_delete_tracepoints | |
79 | set trcpt1 [gdb_gettpnum gdb_c_test]; | |
80 | set trcpt2 [gdb_gettpnum gdb_asm_test]; | |
81 | set trcpt3 [gdb_gettpnum $testline1]; | |
82 | if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then { | |
83 | fail "setting tracepoints" | |
84 | return; | |
85 | } | |
86 | ||
87 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
88 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
89 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
90 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
91 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ | |
c906108c SS |
92 | "3.2a: set three tracepoints" |
93 | ||
35ec993f | 94 | #gdb_test_no_output "delete tracepoint $trcpt1" "" |
0ab48859 | 95 | gdb_test_multiple "delete tracepoint $trcpt1" "3.2b: delete first tracepoint" { |
c906108c SS |
96 | -re "No tracepoint number.*$gdb_prompt $" { |
97 | fail "3.2b: delete first tracepoint" | |
98 | } | |
99 | -re ".*\[Ee\]rror.*$gdb_prompt $" { | |
100 | fail "3.2b: delete first tracepoint" | |
101 | } | |
102 | -re "$gdb_prompt $" { | |
103 | pass "3.2b: delete first tracepoint" | |
104 | } | |
c906108c SS |
105 | } |
106 | ||
1042e4c0 SS |
107 | gdb_test "info tracepoints" \ |
108 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* | |
109 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
110 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ | |
111 | "3.2c: verify delete first tracepoint" | |
c906108c | 112 | |
35ec993f | 113 | #gdb_test_no_output "delete tracepoint $trcpt2" "" |
0ab48859 | 114 | gdb_test_multiple "delete tracepoint $trcpt2" "3.2d: delete second tracepoint" { |
c906108c SS |
115 | -re "No tracepoint number.*$gdb_prompt $" { |
116 | fail "3.2d: delete second tracepoint" | |
117 | } | |
118 | -re ".*\[Ee\]rror.*$gdb_prompt $" { | |
119 | fail "3.2d: delete second tracepoint" | |
120 | } | |
121 | -re "$gdb_prompt $" { | |
122 | pass "3.2d: delete second tracepoint" | |
123 | } | |
c906108c SS |
124 | } |
125 | ||
1042e4c0 SS |
126 | gdb_test "info tracepoints" \ |
127 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* | |
128 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ | |
129 | "3.2e: verify delete second tracepoint" | |
c906108c | 130 | |
35ec993f | 131 | #gdb_test_no_output "delete tracepoint $trcpt3" "" |
0ab48859 | 132 | gdb_test_multiple "delete tracepoint $trcpt3" "3.2f: delete third tracepoint" { |
c906108c SS |
133 | -re "No tracepoint number.*$gdb_prompt $" { |
134 | fail "3.2f: delete third tracepoint" | |
135 | } | |
136 | -re ".*\[Ee\]rror.*$gdb_prompt $" { | |
137 | fail "3.2f: delete third tracepoint" | |
138 | } | |
139 | -re "$gdb_prompt $" { | |
140 | pass "3.2f: delete third tracepoint" | |
141 | } | |
c906108c SS |
142 | } |
143 | ||
144 | # send_gdb "ARF! \\n\n" | |
1042e4c0 SS |
145 | gdb_test "info tracepoints" \ |
146 | "No tracepoints." \ | |
147 | "3.2g: verify delete third tracepoint" | |
c906108c SS |
148 | |
149 | # 3.3 delete three tracepoints at once | |
150 | gdb_delete_tracepoints | |
151 | set trcpt1 [gdb_gettpnum gdb_c_test]; | |
152 | set trcpt2 [gdb_gettpnum gdb_asm_test]; | |
153 | set trcpt3 [gdb_gettpnum $testline1]; | |
154 | if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then { | |
155 | fail "setting tracepoints" | |
156 | return; | |
157 | } | |
158 | ||
159 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
160 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
161 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
162 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
163 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ | |
c906108c SS |
164 | "3.3a: set three tracepoints" |
165 | ||
35ec993f | 166 | #gdb_test_no_output "delete tracepoint $trcpt1 $trcpt2 $trcpt3" "" |
0ab48859 MS |
167 | gdb_test_multiple "delete tracepoint $trcpt1 $trcpt2 $trcpt3" \ |
168 | "3.3b: delete three tracepoints" { | |
169 | -re "No tracepoint number.*$gdb_prompt $" { | |
170 | fail "3.3b: delete three tracepoints" | |
171 | } | |
172 | -re ".*\[Ee\]rror.*$gdb_prompt $" { | |
173 | fail "3.3b: delete three tracepoints" | |
174 | } | |
175 | -re "$gdb_prompt $" { | |
176 | pass "3.3b: delete three tracepoints" | |
177 | } | |
c906108c | 178 | } |
c906108c | 179 | |
1042e4c0 SS |
180 | gdb_test "info tracepoints" \ |
181 | "No tracepoints." \ | |
182 | "3.3c: verify delete three tracepoints" | |
c906108c SS |
183 | |
184 | # 3.4 delete invalid tracepoint number | |
185 | gdb_test "delete tracepoint [expr $trcpt2 + $trcpt3]" \ | |
1042e4c0 | 186 | "No breakpoint number [expr $trcpt2 + $trcpt3]." \ |
c906108c SS |
187 | "3.4: delete invalid tracepoint number" |
188 | ||
189 | # 3.5 delete tracepoint number zero | |
1042e4c0 | 190 | gdb_test "delete tracepoint 0" "bad breakpoint number at or near '0'" \ |
c906108c SS |
191 | "3.5: delete tracepoint number zero" |
192 | ||
193 | # 3.6 help delete tracepoints | |
194 | gdb_test "help delete tracepoints" \ | |
195 | "Delete specified tracepoints.*" \ | |
196 | "3.6: help delete tracepoints" |