Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2015-2020 Free Software Foundation, Inc. |
06da0f77 PL |
2 | # This program is free software; you can redistribute it and/or modify |
3 | # it under the terms of the GNU General Public License as published by | |
4 | # the Free Software Foundation; either version 3 of the License, or | |
5 | # (at your option) any later version. | |
6 | # | |
7 | # This program is distributed in the hope that it will be useful, | |
8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
10 | # GNU General Public License for more details. | |
11 | # | |
12 | # You should have received a copy of the GNU General Public License | |
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
14 | ||
15 | load_lib "trace-support.exp" | |
16 | ||
8bca2978 SL |
17 | if {[skip_shlib_tests]} { |
18 | return 0 | |
19 | } | |
20 | ||
06da0f77 PL |
21 | standard_testfile |
22 | set executable $testfile | |
23 | set expfile $testfile.exp | |
24 | ||
25 | # make check RUNTESTFLAGS='gdb.trace/ftrace-lock.exp NUM_THREADS=2' | |
26 | if ![info exists NUM_THREADS] { | |
27 | set NUM_THREADS 2 | |
28 | } | |
29 | ||
30 | # Some targets have leading underscores on assembly symbols. | |
31 | set additional_flags [gdb_target_symbol_prefix_flags] | |
32 | set options [list debug [gdb_target_symbol_prefix_flags] \ | |
33 | additional_flags=-DNUM_THREADS=$NUM_THREADS] | |
34 | ||
35 | # Check that the target supports trace. | |
8bca2978 SL |
36 | if ![gdb_trace_common_supports_arch] { |
37 | unsupported "no trace-common.h support for arch" | |
38 | return -1 | |
39 | } | |
06da0f77 | 40 | if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } { |
84c93cd5 | 41 | untested "failed to compile" |
06da0f77 PL |
42 | return -1 |
43 | } | |
44 | ||
45 | clean_restart ${testfile} | |
46 | ||
47 | if ![runto_main] { | |
bc6c7af4 | 48 | fail "can't run to main to check for trace support" |
06da0f77 PL |
49 | return -1 |
50 | } | |
51 | ||
52 | if ![gdb_target_supports_trace] { | |
53 | unsupported "target does not support trace" | |
54 | return -1 | |
55 | } | |
56 | ||
57 | # Compile the test case with the in-process agent library. | |
58 | set libipa [get_in_proc_agent] | |
952ebca5 | 59 | set remote_libipa [gdb_load_shlib $libipa] |
06da0f77 PL |
60 | |
61 | lappend options shlib=$libipa | |
62 | ||
63 | if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } { | |
84c93cd5 | 64 | untested "failed to compile with in-process agent library" |
06da0f77 PL |
65 | return -1 |
66 | } | |
67 | ||
68 | clean_restart ${executable} | |
69 | ||
70 | if ![runto_main] { | |
bc6c7af4 | 71 | fail "can't run to main to check for trace support" |
06da0f77 PL |
72 | return -1 |
73 | } | |
74 | ||
952ebca5 | 75 | if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 0 } { |
bc6c7af4 | 76 | untested "could not find IPA lib loaded" |
06da0f77 PL |
77 | return 1 |
78 | } | |
79 | ||
194ed413 AA |
80 | gdb_breakpoint "end" qualified |
81 | gdb_breakpoint "fail" qualified | |
06da0f77 PL |
82 | |
83 | gdb_test "ftrace set_point" "Fast tracepoint .*" \ | |
84 | "fast tracepoint at a long insn" | |
85 | ||
86 | gdb_test "tstart" "" | |
87 | ||
88 | # If NUM_THREADS is high then this test case may timeout. Increase the | |
89 | # timeout temporarily. | |
90 | with_timeout_factor $NUM_THREADS { | |
91 | # If the fail function is hit, then the testcase will fail. | |
92 | gdb_test "continue" ".*Breakpoint \[0-9\]+, end \(\).*" \ | |
93 | "do not hit the fail function" | |
94 | } | |
95 | ||
96 | gdb_test "tstop" "" |