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