]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.trace/change-loc.exp
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.trace / change-loc.exp
index d01f71cc72c2a259aecf3783a8fed0ef3d570190..6e05da1d22671341ce81ee49f48b237da045a3c0 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011-2013 Free Software Foundation, Inc.
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3 of the License, or
 
 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,25 @@ 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.*\tinstalled on target\r\n(4\.2.* in func4.*\tinstalled on target\r\n4\.3.* \<PENDING\>\[\t \]+set_tracepoint|4\.2.* \<PENDING\>\[\t \]+set_tracepoint.*4\.3.* in func4.*\tinstalled on target).*" \
         "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
@@ -178,10 +187,11 @@ proc tracepoint_change_loc_2 { trace_type } {
     gdb_trace_setactions "set action for tracepoint" "" \
        "collect \$$pcreg" "^$"
 
-    # tracepoint has no location information now.
+    # tracepoint has no location information now.  Make sure nothing
+    # else is displayed.
     gdb_test "info trace" \
        "Num     Type\[ \]+Disp Enb Address\[ \]+What.*
-\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*PENDING.*set_tracepoint.*" \
+\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*PENDING.*set_tracepoint\r\n\[\t \]+collect \\$$pcreg\r" \
        "single pending tracepoint info (without symbols)"
 
     gdb_load ${binfile}
@@ -214,19 +224,27 @@ 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"
 
@@ -242,7 +260,8 @@ 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.*\tinstalled on target\r\n(1\.2.* in func4.*\tinstalled on target\r\n1\.3.* \<PENDING\>\[\t \]+set_tracepoint|1\.2.* \<PENDING\>\[\t \]+set_tracepoint\r\n1\.3.* in func4.*\tinstalled on target).*" \
        "tracepoint with two locations (unload)"
 
     gdb_test_no_output "tstop"
@@ -251,15 +270,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 \