Index: gdb/testsuite/gdb.trace/change-loc.exp |
diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp |
index ec3c555a1f443606b7d6cc8049fd805a886612b8..0064b6ffc3f37ae069b82a3271847b099d6d8805 100644 |
--- a/gdb/testsuite/gdb.trace/change-loc.exp |
+++ b/gdb/testsuite/gdb.trace/change-loc.exp |
@@ -14,28 +14,22 @@ |
load_lib "trace-support.exp"; |
-if $tracelevel then { |
- strace $tracelevel |
-} |
- |
if {[skip_shlib_tests]} { |
return 0 |
} |
-set testfile "change-loc" |
+standard_testfile |
set libfile1 "change-loc-1" |
set libfile2 "change-loc-2" |
-set srcfile $testfile.c |
set executable $testfile |
set libsrc1 $srcdir/$subdir/$libfile1.c |
set libsrc2 $srcdir/$subdir/$libfile2.c |
-set binfile $objdir/$subdir/$testfile |
-set lib_sl1 $objdir/$subdir/$libfile1.sl |
-set lib_sl2 $objdir/$subdir/$libfile2.sl |
+set lib_sl1 [standard_output_file $libfile1.sl] |
+set lib_sl2 [standard_output_file $libfile2.sl] |
set lib_opts debug |
-if [get_compiler_info ${binfile}] { |
+if [get_compiler_info] { |
return -1 |
} |
@@ -75,20 +69,15 @@ if [is_amd64_regs_target] { |
# Set tracepoint during tracing experiment. |
-proc tracepoint_change_loc_1 { trace_type } { |
+proc tracepoint_change_loc_1 { trace_type } { with_test_prefix "1 $trace_type" { |
global testfile |
global srcfile |
global pcreg |
global gdb_prompt |
- global pf_prefix |
- |
- set old_pf_prefix $pf_prefix |
- set pf_prefix "$pf_prefix 1 $trace_type:" |
clean_restart ${testfile} |
if ![runto_main] { |
fail "Can't run to main" |
- set pf_prefix $old_pf_prefix |
return -1 |
} |
gdb_test_no_output "delete break 1" |
@@ -107,7 +96,21 @@ proc tracepoint_change_loc_1 { trace_type } { |
gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \ |
"continue to marker 1" |
# Set a tracepoint during tracing. |
- gdb_test "${trace_type} set_tracepoint" ".*" "set tracepoint on set_tracepoint" |
+ set test "set tracepoint on set_tracepoint" |
+ gdb_test_multiple "${trace_type} set_tracepoint" $test { |
+ -re "Target returns error code .* too far .*$gdb_prompt $" { |
+ if [string equal $trace_type "ftrace"] { |
+ # The target was unable to install the fast tracepoint |
+ # (e.g., jump pad too far from tracepoint). |
+ pass "$test (too far)" |
+ } else { |
+ fail $test |
+ } |
+ } |
+ -re "\r\n$gdb_prompt $" { |
+ pass $test |
+ } |
+ } |
gdb_trace_setactions "set action for tracepoint" "" \ |
"collect \$$pcreg" "^$" |
@@ -118,16 +121,27 @@ proc tracepoint_change_loc_1 { trace_type } { |
\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*4\.1.* in func4.*4\.2.* in func4.*" \ |
"tracepoint with two locations" |
- gdb_test_multiple "continue" "continue to marker 2" { |
- -re ".*Breakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" { |
- pass "continue to marker 2" |
- } |
- -re ".*$gdb_prompt $" { |
- kfail "gdb/13392" "continue to marker 2" |
- set pf_prefix $old_pf_prefix |
- return |
- } |
+ set test "continue to marker 2" |
+ gdb_test_multiple "continue" $test { |
+ -re "Target returns error code .* too far .*$gdb_prompt $" { |
+ if [string equal $trace_type "ftrace"] { |
+ # Expected if the target was unable to install the |
+ # fast tracepoint (e.g., jump pad too far from |
+ # tracepoint). |
+ pass "$test (too far)" |
+ # Skip the rest of the tests. |
+ return |
+ } else { |
+ fail "continue to marker 2" |
+ fail $test |
+ } |
+ |
+ } |
+ -re ".*Breakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" { |
+ pass "continue to marker 2" |
+ } |
} |
+ |
# tracepoint has three locations after shlib change-loc-2 is loaded. |
gdb_test "info trace" \ |
"Num Type\[ \]+Disp Enb Address\[ \]+What.* |
@@ -140,30 +154,24 @@ proc tracepoint_change_loc_1 { trace_type } { |
# shlib is unloaded, there are still three locations, but one is pending. |
gdb_test "info trace" \ |
"Num Type\[ \]+Disp Enb Address\[ \]+What.* |
-\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*4\.1.* in func4.*4\.2.* in func4.*4\.3.* \<PENDING\>\[\t \]+set_tracepoint.*" \ |
+\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*4\.1.* in func4.*(4\.2.* in func4.*4\.3.* \<PENDING\>\[\t \]+set_tracepoint|4\.2.* \<PENDING\>\[\t \]+set_tracepoint\r\n4\.3.* in func4).*" \ |
"tracepoint with two locations (unload)" |
gdb_test_no_output "tstop" |
gdb_test "tfind" "Found trace frame 0, tracepoint 4.*" "tfind frame 0" |
gdb_test "tfind" "Target failed to find requested trace frame\\..*" |
- |
- set pf_prefix $old_pf_prefix |
-} |
+}} |
# Set pending tracepoint. |
-proc tracepoint_change_loc_2 { trace_type } { |
+proc tracepoint_change_loc_2 { trace_type } { with_test_prefix "2 $trace_type" { |
global srcdir |
global srcfile |
global subdir |
global pcreg |
global binfile |
global gdb_prompt |
- global pf_prefix |
- |
- set old_pf_prefix $pf_prefix |
- set pf_prefix "$pf_prefix 2 $trace_type:" |
gdb_exit |
gdb_start |
@@ -214,20 +222,28 @@ proc tracepoint_change_loc_2 { trace_type } { |
"breakpoint on marker" |
# tracepoint with two locations will be downloaded and installed. |
- gdb_test_no_output "tstart" |
- |
- gdb_test_multiple "continue" "continue to marker 1" { |
- -re ".*Breakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" { |
- pass "continue to marker 1" |
- } |
- -re ".*$gdb_prompt $" { |
- kfail "gdb/13392" "continue to marker 1" |
- set pf_prefix $old_pf_prefix |
- return |
+ set test "tstart" |
+ gdb_test_multiple "tstart" $test { |
+ -re "^tstart\r\n$gdb_prompt $" { |
+ pass "tstart" |
+ } |
+ -re "Target returns error code .* too far .*$gdb_prompt $" { |
+ if [string equal $trace_type "ftrace"] { |
+ # The target was unable to install the fast tracepoint |
+ # (e.g., jump pad too far from tracepoint). |
+ pass "$test (too far)" |
+ # Skip the rest of the tests. |
+ return |
+ } else { |
+ fail $test |
+ } |
} |
} |
gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \ |
+ "continue to marker 1" |
+ |
+ gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \ |
"continue to marker 2" |
# tracepoint has three locations after shlib change-loc-2 is loaded. |
@@ -242,7 +258,7 @@ proc tracepoint_change_loc_2 { trace_type } { |
# shlib is unloaded, there are still three locations, but one is pending. |
gdb_test "info trace" \ |
"Num Type\[ \]+Disp Enb Address\[ \]+What.* |
-\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*1\.1.* in func4.*1\.2.* in func4.*1\.3.* \<PENDING\>\[\t \]+set_tracepoint.*" \ |
+\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*1\.1.* in func4.*(1\.2.* in func4.*1\.3.* \<PENDING\>\[\t \]+set_tracepoint|1\.2.* \<PENDING\>\[\t \]+set_tracepoint\r\n1\.3.* in func4).*" \ |
"tracepoint with two locations (unload)" |
gdb_test_no_output "tstop" |
@@ -251,15 +267,13 @@ proc tracepoint_change_loc_2 { trace_type } { |
gdb_test "tfind" "Found trace frame 1, tracepoint 1.*" "tfind frame 1" |
gdb_test "tfind" "Found trace frame 2, tracepoint 1.*" "tfind frame 2" |
gdb_test "tfind" "Target failed to find requested trace frame\\..*" |
- |
- set pf_prefix $old_pf_prefix |
-} |
+}} |
tracepoint_change_loc_1 "trace" |
tracepoint_change_loc_2 "trace" |
# Re-compile test case with IPA. |
-set libipa $objdir/../gdbserver/libinproctrace.so |
+set libipa [get_in_proc_agent] |
gdb_load_shlibs $libipa |
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable \ |