Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2013-2020 Free Software Foundation, Inc. |
bc5065a7 PA |
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 | ||
5b362f04 | 22 | if [prepare_for_testing "failed to prepare" $executable $srcfile \ |
bc5065a7 PA |
23 | {debug nowarnings}] { |
24 | return -1 | |
25 | } | |
26 | ||
27 | if ![runto_main] { | |
bc6c7af4 | 28 | fail "can't run to main to check for trace support" |
bc5065a7 PA |
29 | return -1 |
30 | } | |
31 | ||
32 | if ![gdb_target_supports_trace] { | |
33 | unsupported "target does not support trace" | |
4ec70201 | 34 | return -1 |
bc5065a7 PA |
35 | } |
36 | ||
42422cc7 PL |
37 | if ![gdb_range_stepping_enabled] { |
38 | unsupported "range stepping not supported by the target" | |
39 | return -1 | |
40 | } | |
41 | ||
bc5065a7 PA |
42 | # Check that range stepping works well with tracepoints. |
43 | ||
44 | proc range_stepping_with_tracepoint { type } { | |
45 | with_test_prefix "${type}" { | |
46 | gdb_breakpoint [gdb_get_line_number "location 1"] | |
47 | gdb_continue_to_breakpoint "location 1" | |
48 | delete_breakpoints | |
49 | ||
50 | gdb_test "${type} *set_point" ".*" | |
51 | gdb_test_no_output "tstart" | |
52 | ||
53 | # Step a line with a tracepoint in the middle. The tracepoint | |
54 | # itself shouldn't have any effect on range stepping. We | |
80f0110c YQ |
55 | # should see one vCont;r. |
56 | exec_cmd_expect_vCont_count "step" 1 | |
bc5065a7 PA |
57 | gdb_test_no_output "tstop" |
58 | gdb_test "tfind" "Found trace frame .*" "first tfind" | |
59 | gdb_test "tfind" \ | |
60 | "Target failed to find requested trace frame.*" \ | |
61 | "second tfind" | |
62 | ||
63 | delete_breakpoints | |
64 | } | |
65 | } | |
66 | ||
67 | range_stepping_with_tracepoint "trace" | |
68 | ||
8bca2978 SL |
69 | if {[skip_shlib_tests]} { |
70 | return 0 | |
71 | } | |
72 | ||
bc5065a7 | 73 | set libipa [get_in_proc_agent] |
952ebca5 | 74 | set remote_libipa [gdb_load_shlib $libipa] |
bc5065a7 PA |
75 | |
76 | if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ | |
77 | executable [list debug nowarnings shlib=$libipa] ] != "" } { | |
84c93cd5 | 78 | untested "failed to compile" |
bc5065a7 PA |
79 | return -1 |
80 | } | |
81 | ||
82 | clean_restart ${executable} | |
83 | ||
84 | if ![runto_main] { | |
bc6c7af4 | 85 | fail "can't run to main for ftrace tests" |
bc5065a7 PA |
86 | return 0 |
87 | } | |
88 | ||
89 | gdb_reinitialize_dir $srcdir/$subdir | |
952ebca5 | 90 | if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 0 } { |
bc6c7af4 | 91 | untested "could not find IPA lib loaded" |
bc5065a7 PA |
92 | } else { |
93 | range_stepping_with_tracepoint "ftrace" | |
94 | } |