Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 1998-2020 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 | ||
4ec70201 | 18 | load_lib "trace-support.exp" |
c906108c | 19 | |
c906108c SS |
20 | |
21 | gdb_exit | |
22 | gdb_start | |
497a5eb0 | 23 | standard_testfile actions.c |
8bca2978 SL |
24 | if ![gdb_trace_common_supports_arch] { |
25 | unsupported "no trace-common.h support for arch" | |
26 | return -1 | |
27 | } | |
f8b7eaf3 DJ |
28 | if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ |
29 | executable {debug nowarnings}] != "" } { | |
5b362f04 | 30 | untested "failed to compile" |
f8b7eaf3 | 31 | return -1 |
c906108c | 32 | } |
f8b7eaf3 | 33 | gdb_load $binfile |
de7ff789 MS |
34 | gdb_test "tstop" ".*" "" |
35 | gdb_test "tfind none" ".*" "" | |
f8b7eaf3 | 36 | runto_main |
c906108c SS |
37 | gdb_reinitialize_dir $srcdir/$subdir |
38 | ||
c906108c | 39 | if { ![gdb_target_supports_trace] } then { |
bc6c7af4 | 40 | unsupported "current target does not support trace" |
ae59b1da | 41 | return 1 |
c906108c SS |
42 | |
43 | } | |
44 | ||
45 | # If testing on a remote host, download the source file. | |
46 | # remote_download host $srcdir/$subdir/$srcfile | |
47 | ||
48 | ||
49 | # | |
50 | # test passcount dynamically (live target) | |
51 | # | |
52 | ||
4ec70201 | 53 | set baseline [gdb_find_recursion_test_baseline $srcfile] |
c906108c SS |
54 | |
55 | if { $baseline == -1 } then { | |
bc6c7af4 | 56 | fail "could not find gdb_recursion_test function" |
4ec70201 | 57 | return |
c906108c SS |
58 | } |
59 | ||
60 | # define relative source line numbers: | |
61 | # all subsequent line numbers are relative to this first one (baseline) | |
62 | ||
63 | set testline2 [expr $baseline + 4] | |
64 | set testline3 [expr $baseline + 5] | |
65 | set testline4 [expr $baseline + 6] | |
66 | ||
67 | # | |
68 | # test passcount command semantics (live test) | |
69 | # | |
70 | ||
71 | ## Set three tracepoints with three different passcounts. | |
72 | ## Verify that the experiment stops after the one with the | |
73 | ## lowest passcount is hit. | |
74 | ||
75 | gdb_delete_tracepoints | |
76 | set tdp2 [gdb_gettpnum "$testline2"] | |
77 | set tdp3 [gdb_gettpnum "$testline3"] | |
78 | set tdp4 [gdb_gettpnum "$testline4"] | |
79 | if { $tdp2 <= 0 || $tdp3 <= 0 || $tdp4 <= 0 } then { | |
80 | fail "setting tracepoints" | |
4ec70201 | 81 | return |
c906108c SS |
82 | } |
83 | ||
84 | gdb_test "passcount 4 $tdp2" "Setting tracepoint $tdp2's passcount to 4" \ | |
85 | "4.5: set passcount for tracepoint $tdp2" | |
86 | gdb_test "passcount 2 $tdp3" "Setting tracepoint $tdp3's passcount to 2" \ | |
87 | "4.5: set passcount for tracepoint $tdp3" | |
88 | gdb_test "passcount 3 $tdp4" "Setting tracepoint $tdp4's passcount to 3" \ | |
89 | "4.5: set passcount for tracepoint $tdp4" | |
90 | ||
de7ff789 | 91 | gdb_test "tstart" ".*" "" |
c906108c | 92 | |
194ed413 | 93 | gdb_breakpoint "end" qualified |
f8b7eaf3 DJ |
94 | gdb_test "continue" \ |
95 | "Continuing.*Breakpoint $decimal, end.*" \ | |
96 | "run trace experiment" | |
de7ff789 | 97 | gdb_test "tstop" ".*" "" |
c906108c | 98 | |
de7ff789 | 99 | gdb_test "tfind none" ".*" "" |
c906108c | 100 | if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x -1 x" ""] { |
5b362f04 | 101 | untested "skipping further tests due to print failure" |
b60f0898 | 102 | return -1 |
c906108c SS |
103 | } |
104 | ||
de7ff789 | 105 | gdb_test "tfind tracepoint $tdp2" ".*" "" |
c906108c | 106 | if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 0 x" ""] { |
5b362f04 | 107 | untested "skipping further tests due to print failure" |
b60f0898 | 108 | return -1 |
c906108c SS |
109 | } |
110 | ||
de7ff789 | 111 | gdb_test "tfind tracepoint $tdp3" ".*" "" |
c906108c | 112 | if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 1 x" ""] { |
5b362f04 | 113 | untested "skipping further tests due to print failure" |
b60f0898 | 114 | return -1 |
c906108c SS |
115 | } |
116 | ||
de7ff789 | 117 | gdb_test "tfind tracepoint $tdp4" ".*" "" |
c906108c | 118 | if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 2 x" ""] { |
5b362f04 | 119 | untested "skipping further tests due to print failure" |
b60f0898 | 120 | return -1 |
c906108c SS |
121 | } |
122 | ||
de7ff789 | 123 | gdb_test "tfind tracepoint $tdp2" ".*" "" |
c906108c | 124 | if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 3 x" ""] { |
5b362f04 | 125 | untested "skipping further tests due to print failure" |
b60f0898 | 126 | return -1 |
c906108c SS |
127 | } |
128 | ||
de7ff789 | 129 | gdb_test "tfind tracepoint $tdp3" ".*" "" |
c906108c | 130 | if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 4 x" ""] { |
5b362f04 | 131 | untested "skipping further tests due to print failure" |
b60f0898 | 132 | return -1 |
c906108c SS |
133 | } |
134 | ||
135 | ## We should now be at the last frame, because this frame's passcount | |
136 | ## should have caused collection to stop. If we do a tfind now, | |
137 | ## it should fail. | |
138 | ||
139 | gdb_test "tfind" "failed to find.*" "4.5: dynamic passcount test" | |
140 | ||
141 | # Finished! | |
de7ff789 | 142 | gdb_test "tfind none" ".*" "" |
c906108c | 143 |