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