Fix: Null pointer dereference in ldlex.l
[binutils-gdb.git] / gdb / testsuite / gdb.trace / ftrace-lock.exp
blobb795d6d4011b0a49bfdfb440e2f8ce3e7aebe5aa
1 # Copyright 2015-2023 Free Software Foundation, Inc.
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.
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.
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/>.
15 load_lib "trace-support.exp"
17 require allow_shlib_tests
19 standard_testfile
20 set executable $testfile
21 set expfile $testfile.exp
23 # make check RUNTESTFLAGS='gdb.trace/ftrace-lock.exp NUM_THREADS=2'
24 if ![info exists NUM_THREADS] {
25 set NUM_THREADS 2
28 # Some targets have leading underscores on assembly symbols.
29 set additional_flags [gdb_target_symbol_prefix_flags]
30 set options [list debug [gdb_target_symbol_prefix_flags] \
31 additional_flags=-DNUM_THREADS=$NUM_THREADS]
33 # Check that the target supports trace.
34 require gdb_trace_common_supports_arch
35 if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
36 untested "failed to compile"
37 return -1
40 clean_restart ${testfile}
42 if ![runto_main] {
43 return -1
46 if ![gdb_target_supports_trace] {
47 unsupported "target does not support trace"
48 return -1
51 # Compile the test case with the in-process agent library.
52 set libipa [get_in_proc_agent]
53 set remote_libipa [gdb_load_shlib $libipa]
55 lappend options shlib=$libipa
57 if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
58 untested "failed to compile with in-process agent library"
59 return -1
62 clean_restart ${executable}
64 if ![runto_main] {
65 return -1
68 if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 0 } {
69 untested "could not find IPA lib loaded"
70 return 1
73 gdb_breakpoint "end" qualified
74 gdb_breakpoint "fail" qualified
76 gdb_test "ftrace set_point" "Fast tracepoint .*" \
77 "fast tracepoint at a long insn"
79 gdb_test "tstart" ""
81 # If NUM_THREADS is high then this test case may timeout. Increase the
82 # timeout temporarily.
83 with_timeout_factor $NUM_THREADS {
84 # If the fail function is hit, then the testcase will fail.
85 gdb_test "continue" ".*Breakpoint \[0-9\]+, end \(\).*" \
86 "do not hit the fail function"
89 gdb_test "tstop" ""