Automatic date update in version.in
[binutils-gdb.git] / gdb / testsuite / gdb.trace / while-dyn.exp
blob05e546a70200b9664475708f97bca8ee5acbb369
1 #   Copyright 1998-2024 Free Software Foundation, Inc.
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 3 of the License, or
6 # (at your option) any later version.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 # This file was written by Michael Snyder (msnyder@cygnus.com)
18 load_lib "trace-support.exp"
20 standard_testfile actions.c
21 set executable $testfile
22 require gdb_trace_common_supports_arch
23 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
24           executable {debug nowarnings}] != "" } {
25     untested "failed to compile"
26     return -1
29 clean_restart $binfile
30 runto_main
32 if {![gdb_target_supports_trace]} {
33     unsupported "current target does not support trace"
34     return 1
38 # test while-stepping dynamically (live target)
41 proc test_while_stepping { while_stepping } {
42     global fpreg
43     global decimal
44     global gdb_prompt
45     global executable
47     with_test_prefix "$while_stepping" {
48         clean_restart $executable
50         runto_main
52         ## verify number of trace frames collected matches stepcount
54         gdb_delete_tracepoints
55         gdb_test "trace gdb_c_test" \
56             "Tracepoint $decimal at .*" \
57             "Set tracepoint at gdb_c_test"
59         gdb_trace_setactions "define $while_stepping <stepcount>" \
60             "" \
61             "collect \$$fpreg" "^$" \
62             "$while_stepping 5" "^$" \
63             "collect p" "^$" \
64             "end" "^$" \
65             "end" ""
67         gdb_test "tstart" ".*"
69         gdb_breakpoint "end" qualified
70         gdb_test "continue" \
71             "Continuing.*Breakpoint $decimal, end.*" \
72             "run trace experiment"
74         gdb_test "tstop" ".*"
76         gdb_tfind_test "frame 5 should be the last one collected" "5" "5"
78         gdb_test "tfind 6" "failed to find.*" \
79             "trace stopped after 5 stepping frames"
81         gdb_test "tfind none" ".*"
82     }
85 # Test all while-stepping aliases.
87 test_while_stepping "while-stepping"
88 test_while_stepping "stepping"
89 test_while_stepping "ws"