Imported Upstream version 7.9
[platform/upstream/gdb.git] / gdb / testsuite / gdb.trace / range-stepping.exp
1 # Copyright 2013-2015 Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>.
15
16 load_lib "trace-support.exp"
17 load_lib "range-stepping-support.exp"
18
19 standard_testfile
20 set executable $testfile
21
22 if [prepare_for_testing $testfile.exp $executable $srcfile \
23         {debug nowarnings}] {
24     return -1
25 }
26
27 if ![runto_main] {
28     fail "Can't run to main to check for trace support"
29     return -1
30 }
31
32 if ![gdb_target_supports_trace] {
33     unsupported "target does not support trace"
34     return -1
35 }
36
37 # Check that range stepping works well with tracepoints.
38
39 proc range_stepping_with_tracepoint { type } {
40     with_test_prefix "${type}" {
41         gdb_breakpoint [gdb_get_line_number "location 1"]
42         gdb_continue_to_breakpoint "location 1"
43         delete_breakpoints
44
45         gdb_test "${type} *set_point" ".*"
46         gdb_test_no_output "tstart"
47
48         # Step a line with a tracepoint in the middle.  The tracepoint
49         # itself shouldn't have any effect on range stepping.  We
50         # should see one vCont;r and no vCont;s's.
51         exec_cmd_expect_vCont_count "step" 0 1
52         gdb_test_no_output "tstop"
53         gdb_test "tfind" "Found trace frame .*" "first tfind"
54         gdb_test "tfind" \
55             "Target failed to find requested trace frame.*" \
56             "second tfind"
57
58         delete_breakpoints
59     }
60 }
61
62 range_stepping_with_tracepoint "trace"
63
64 set libipa [get_in_proc_agent]
65 gdb_load_shlibs $libipa
66
67 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
68           executable [list debug nowarnings shlib=$libipa] ] != "" } {
69     untested "failed to compile ftrace tests"
70     return -1
71 }
72
73 clean_restart ${executable}
74
75 if ![runto_main] {
76     fail "Can't run to main for ftrace tests"
77     return 0
78 }
79
80 gdb_reinitialize_dir $srcdir/$subdir
81 if { [gdb_test "info sharedlibrary" ".*${libipa}.*" "IPA loaded"] != 0 } {
82     untested "Could not find IPA lib loaded"
83 } else {
84     range_stepping_with_tracepoint "ftrace"
85 }