]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.trace/while-dyn.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.trace / while-dyn.exp
CommitLineData
6aba47ca 1# Copyright 1998, 2007 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
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
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.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@prep.ai.mit.edu
19
20# This file was written by Michael Snyder (msnyder@cygnus.com)
21
22load_lib "trace-support.exp"
23
24if $tracelevel then {
25 strace $tracelevel
26}
27
28set prms_id 0
29set bug_id 0
30
31gdb_exit
32gdb_start
33
34if [istarget "m68k-*-elf"] then {
35 load_lib "emc-support.exp"
36 set testfile "gdb_c_test"
37 set srcfile $testfile.c
38 set binfile [board_info target d490_binfile];
39 gdb_test "set remotetimeout 6" "" ""
40 set timeout 500
41 gdb_target_monitor "$binfile"
42 # Give a TSTOP and ignore errors, to make sure any previous trace is off
43 gdb_test "tstop" "" ""
44 gdb_test "tfind none" "" ""
45 send_gdb "compare-section CS\n"
46 gdb_expect {
47 -re "MIS-MATCHED.*$gdb_prompt $" {
b60f0898
JB
48 untested while-dyn.exp
49 return -1
c906108c
SS
50 all tests in this module will fail.";
51 }
52 -re ".*$gdb_prompt $" { }
53 }
54} else {
55 set testfile "actions"
56 set srcfile $testfile.c
57 set binfile $objdir/$subdir/$testfile
58 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
fc91c6c2 59 executable {debug nowarnings}] != "" } {
b60f0898
JB
60 untested while-dyn.exp
61 return -1
c906108c
SS
62 }
63 gdb_load $binfile
64 gdb_test "tstop" "" ""
65 gdb_test "tfind none" "" ""
66 runto_main
67}
68gdb_reinitialize_dir $srcdir/$subdir
69
70# We generously give ourselves one "pass" if we successfully
71# detect that this test cannot be run on this target!
72if { ![gdb_target_supports_trace] } then {
73 pass "Current target does not supporst trace"
74 return 1;
75
76}
77
78# If testing on a remote host, download the source file.
79# remote_download host $srcdir/$subdir/$srcfile
80
81#
82# test while-stepping dynamically (live target)
83#
84
85## verify number of trace frames collected matches stepcount
86
87gdb_delete_tracepoints
88gdb_test "trace gdb_c_test" \
89 "Tracepoint $decimal at .*" \
90 "Set tracepoint at gdb_c_test"
91
92gdb_trace_setactions "5.12: define while-stepping <stepcount>" \
93 "" \
94 "collect \$fp" "^$" \
95 "while-stepping 5" "^$" \
96 "collect p" "^$" \
97 "end" "^$" \
98 "end" ""
99
100gdb_test "tstart" "" ""
101
102if [istarget "m68k-*-elf"] then {
103 gdb_emclaptop_command "85,1,2,3,4,5,6"
104 sleep 5
105} else {
106 gdb_test "break end" "" ""
107 gdb_test "continue" \
108 "Continuing.*Breakpoint $decimal, end.*" \
109 "run trace experiment"
110}
111
112gdb_test "tstop" "" ""
113
114gdb_tfind_test "5.12: frame 5 should be the last one collected" "5" "5"
115
116send_gdb "tfind 6\n"
117gdb_expect {
118 -re "failed to find.*$gdb_prompt $" {
119 pass "5.12: trace stopped after 5 stepping frames"
120 }
121 -re ".*$gdb_prompt $" {
122 fail "5.12: trace stopped after 5 stepping frames"
123 }
124}
125
126gdb_test "tfind none" "" ""