require allow_shlib_tests
+# Check that the target supports trace.
+require gdb_trace_common_supports_arch
+
standard_testfile
-set executable $testfile
-set expfile $testfile.exp
# make check RUNTESTFLAGS='gdb.trace/ftrace-lock.exp NUM_THREADS=2'
if ![info exists NUM_THREADS] {
# Some targets have leading underscores on assembly symbols.
set additional_flags [gdb_target_symbol_prefix_flags]
-set options [list debug [gdb_target_symbol_prefix_flags] \
+set options [list debug pthreads [gdb_target_symbol_prefix_flags] \
additional_flags=-DNUM_THREADS=$NUM_THREADS]
-# Check that the target supports trace.
-require gdb_trace_common_supports_arch
-if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
- untested "failed to compile"
- return -1
-}
-
-clean_restart ${testfile}
+with_test_prefix "runtime trace support check" {
+ if { [prepare_for_testing "prepare for testing" ${binfile}-check \
+ $srcfile $options] } {
+ return
+ }
-if ![runto_main] {
- return -1
-}
+ if ![runto_main] {
+ return -1
+ }
-if ![gdb_target_supports_trace] {
- unsupported "target does not support trace"
- return -1
+ if ![gdb_target_supports_trace] {
+ unsupported "target does not support trace"
+ return -1
+ }
}
# Compile the test case with the in-process agent library.
lappend options shlib=$libipa
-if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
- untested "failed to compile with in-process agent library"
- return -1
+if { [prepare_for_testing "prepare for testing with libipa" \
+ $binfile $srcfile $options] } {
+ return
}
-clean_restart ${executable}
-
if ![runto_main] {
return -1
}
gdb_test "ftrace set_point" "Fast tracepoint .*" \
"fast tracepoint at a long insn"
-gdb_test "tstart" ""
+gdb_test_no_output "tstart"
# If NUM_THREADS is high then this test case may timeout. Increase the
# timeout temporarily.
"do not hit the fail function"
}
-gdb_test "tstop" ""
+gdb_test_no_output "tstop"
load_lib "trace-support.exp"
standard_testfile
-set executable $testfile
-set expfile $testfile.exp
# Some targets have leading underscores on assembly symbols.
set additional_flags [gdb_target_symbol_prefix_flags]
require gdb_trace_common_supports_arch
-if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile \
- executable [list debug $additional_flags] ] != "" } {
- # gdb_compile_pthreads provides an appropriate unsupported message.
- return -1
-}
-
-clean_restart ${testfile}
+with_test_prefix "runtime trace support check" {
+ if { [prepare_for_testing "prepare for testing" ${binfile} $srcfile \
+ [list debug pthreads $additional_flags]] } {
+ return
+ }
-if ![runto_main] {
- return -1
-}
+ if ![runto_main] {
+ return -1
+ }
-if ![gdb_target_supports_trace] {
- unsupported "target does not support trace"
- return -1
+ if ![gdb_target_supports_trace] {
+ unsupported "target does not support trace"
+ return -1
+ }
}
-proc step_over_tracepoint { trace_type } \
+proc step_over_tracepoint { binfile trace_type } \
{with_test_prefix "step over $trace_type" \
{
- global executable
global hex
# Start with a fresh gdb.
- clean_restart ${executable}
+ clean_restart $binfile
+
# Make sure inferior is running in all-stop mode.
gdb_test_no_output "set non-stop 0"
if ![runto_main] {
# Set breakpoint and tracepoint at the same address.
-proc break_trace_same_addr { trace_type option } \
+proc break_trace_same_addr { binfile trace_type option } \
{with_test_prefix "$trace_type $option" \
{
- global executable
global hex
# Start with a fresh gdb.
- clean_restart ${executable}
+ clean_restart $binfile
if ![runto_main] {
return -1
}
}}
foreach break_always_inserted { "on" "off" } {
- break_trace_same_addr "trace" ${break_always_inserted}
+ break_trace_same_addr $binfile "trace" ${break_always_inserted}
}
-step_over_tracepoint "trace"
+step_over_tracepoint $binfile "trace"
require allow_shlib_tests
set remote_libipa [gdb_load_shlib $libipa]
# Compile test case again with IPA.
-if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile \
- executable [list debug $additional_flags shlib=$libipa] ] != "" } {
- untested "failed to compile with in-process agent library"
- return -1
+set binfile_ipa ${binfile}-ipa
+if { [prepare_for_testing "prepare for testing" $binfile_ipa $srcfile \
+ [list debug pthreads $additional_flags shlib=$libipa]] } {
+ return
}
-clean_restart ${executable}
if ![runto_main] {
return 0
}
-gdb_reinitialize_dir $srcdir/$subdir
if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 0 } {
untested "could not find IPA lib loaded"
} else {
foreach break_always_inserted { "on" "off" } {
- break_trace_same_addr "ftrace" ${break_always_inserted}
+ break_trace_same_addr $binfile_ipa "ftrace" ${break_always_inserted}
}
- step_over_tracepoint "ftrace"
+ step_over_tracepoint $binfile_ipa "ftrace"
}