Copyright year update in most files of the GDB Project.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.trace / while-dyn.exp
CommitLineData
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 (msnyder@cygnus.com)
17
18load_lib "trace-support.exp"
19
20if $tracelevel then {
21 strace $tracelevel
22}
23
c906108c
SS
24
25gdb_exit
26gdb_start
27
f8b7eaf3
DJ
28set testfile "actions"
29set srcfile $testfile.c
d350db38
PA
30set executable while-dyn
31set binfile $objdir/$subdir/$executable
f8b7eaf3
DJ
32if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
33 executable {debug nowarnings}] != "" } {
34 untested while-dyn.exp
35 return -1
c906108c 36}
f8b7eaf3 37gdb_load $binfile
de7ff789
MS
38gdb_test "tstop" ".*" ""
39gdb_test "tfind none" ".*" ""
f8b7eaf3 40runto_main
c906108c
SS
41gdb_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!
45if { ![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 54if [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
62proc 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
115test_while_stepping "while-stepping"
116test_while_stepping "stepping"
117test_while_stepping "ws"
This page took 2.536698 seconds and 4 git commands to generate.