]>
Commit | Line | Data |
---|---|---|
c5a57081 | 1 | # Copyright 1998, 2007-2012 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 ([email protected]) |
17 | ||
18 | load_lib "trace-support.exp" | |
19 | ||
20 | if $tracelevel then { | |
21 | strace $tracelevel | |
22 | } | |
23 | ||
c906108c SS |
24 | |
25 | gdb_exit | |
26 | gdb_start | |
27 | ||
f8b7eaf3 DJ |
28 | set testfile "actions" |
29 | set srcfile $testfile.c | |
d350db38 PA |
30 | set executable while-dyn |
31 | set binfile $objdir/$subdir/$executable | |
f8b7eaf3 DJ |
32 | if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ |
33 | executable {debug nowarnings}] != "" } { | |
34 | untested while-dyn.exp | |
35 | return -1 | |
c906108c | 36 | } |
f8b7eaf3 | 37 | gdb_load $binfile |
de7ff789 MS |
38 | gdb_test "tstop" ".*" "" |
39 | gdb_test "tfind none" ".*" "" | |
f8b7eaf3 | 40 | runto_main |
c906108c SS |
41 | gdb_reinitialize_dir $srcdir/$subdir |
42 | ||
43 | # We generously give ourselves one "pass" if we successfully | |
44 | # detect that this test cannot be run on this target! | |
45 | if { ![gdb_target_supports_trace] } then { | |
0ef2251b | 46 | pass "Current target does not support trace" |
c906108c | 47 | return 1; |
c906108c SS |
48 | } |
49 | ||
c906108c SS |
50 | # |
51 | # test while-stepping dynamically (live target) | |
52 | # | |
53 | ||
7f062217 | 54 | if [is_amd64_regs_target] { |
6a8f2671 | 55 | set fpreg "\$rbp" |
7f062217 | 56 | } elseif [is_x86_like_target] { |
6a8f2671 PA |
57 | set fpreg "\$ebp" |
58 | } else { | |
59 | set fpreg "\$fp" | |
60 | } | |
61 | ||
d350db38 PA |
62 | proc test_while_stepping { while_stepping } { |
63 | global fpreg | |
64 | global decimal | |
65 | global gdb_prompt | |
66 | global executable | |
67 | ||
68 | clean_restart $executable | |
69 | ||
de7ff789 MS |
70 | gdb_test "tstop" ".*" "" |
71 | gdb_test "tfind none" ".*" "" | |
d350db38 PA |
72 | runto_main |
73 | ||
74 | ## verify number of trace frames collected matches stepcount | |
75 | ||
76 | gdb_delete_tracepoints | |
77 | gdb_test "trace gdb_c_test" \ | |
78 | "Tracepoint $decimal at .*" \ | |
79 | "$while_stepping: Set tracepoint at gdb_c_test" | |
80 | ||
81 | gdb_trace_setactions "5.12: define $while_stepping <stepcount>" \ | |
c906108c | 82 | "" \ |
6a8f2671 | 83 | "collect $fpreg" "^$" \ |
d350db38 | 84 | "$while_stepping 5" "^$" \ |
c906108c SS |
85 | "collect p" "^$" \ |
86 | "end" "^$" \ | |
87 | "end" "" | |
88 | ||
de7ff789 | 89 | gdb_test "tstart" ".*" "" |
c906108c | 90 | |
de7ff789 | 91 | gdb_test "break end" ".*" "" |
d350db38 PA |
92 | gdb_test "continue" \ |
93 | "Continuing.*Breakpoint $decimal, end.*" \ | |
94 | "$while_stepping: run trace experiment" | |
c906108c | 95 | |
de7ff789 | 96 | gdb_test "tstop" ".*" "" |
c906108c | 97 | |
d350db38 | 98 | gdb_tfind_test "$while_stepping: frame 5 should be the last one collected" "5" "5" |
c906108c | 99 | |
d350db38 PA |
100 | set test "$while_stepping: trace stopped after 5 stepping frames" |
101 | gdb_test_multiple "tfind 6" "$test" { | |
102 | -re "failed to find.*$gdb_prompt $" { | |
103 | pass "$test" | |
104 | } | |
105 | -re ".*$gdb_prompt $" { | |
106 | fail "$test" | |
107 | } | |
c906108c | 108 | } |
d350db38 | 109 | |
de7ff789 | 110 | gdb_test "tfind none" ".*" "" |
c906108c SS |
111 | } |
112 | ||
d350db38 PA |
113 | # Test all while-stepping aliases. |
114 | ||
115 | test_while_stepping "while-stepping" | |
116 | test_while_stepping "stepping" | |
117 | test_while_stepping "ws" |