Fix "info registers" regexes in gdb.base/jit-reader.exp
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.trace / pending.exp
index 750c0317c16e2a1b2ae0eaeea60a3117c0cde2a3..bb039df4bd5c002fd6c5470bcaf1aed957d8d739 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011-2012 Free Software Foundation, Inc.
+# Copyright 2011-2018 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
@@ -12,7 +12,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-load_lib "trace-support.exp";
+load_lib "trace-support.exp"
 
 if {[skip_shlib_tests]} {
     return 0
@@ -31,134 +31,144 @@ set lib_opts [gdb_target_symbol_prefix_flags]
 
 if { [gdb_compile_shlib $libsrc1 $lib_sl1 $lib_opts] != ""
      || [gdb_compile_shlib $libsrc2 $lib_sl2 $lib_opts] != ""} {
-    untested "Could not compile either $libsrc1 or $libsrc2"
+    untested "failed to compile shared library"
     return -1
 }
 
 set exec_opts [list debug shlib=$lib_sl1 shlib_load]
 if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != "" } {
-    untested "Failed to compile $srcfile"
+    untested "failed to compile"
     return -1
 }
 
 clean_restart $executable
 
-gdb_load_shlibs $lib_sl1
-gdb_load_shlibs $lib_sl2
+gdb_load_shlib $lib_sl1
+gdb_load_shlib $lib_sl2
 
 if ![runto_main] {
-    fail "Can't run to main to check for trace support"
+    fail "can't run to main to check for trace support"
     return -1
 }
 
 if ![gdb_target_supports_trace] {
-    unsupported "Current target does not support trace"
-    return -1;
+    unsupported "current target does not support trace"
+    return -1
 }
 
 # Verify pending tracepoint is resolved to running to main.
 
-proc pending_tracepoint_resolved { trace_type } { with_test_prefix "$trace_type resolved" {
-    global srcdir
-    global subdir
-    global binfile
-    global srcfile
-    global lib_sl1
-
-    # Start with a fresh gdb.
-    gdb_exit
-    gdb_start
-    gdb_reinitialize_dir $srcdir/$subdir
-
-    gdb_test_multiple "$trace_type set_point1" "set pending tracepoint" {
-       -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" {
-           gdb_test "y" "\(Fast t|T\)racepoint.*set_point1.*pending." \
-               "set pending tracepoint (without symbols)"
+proc pending_tracepoint_resolved { trace_type } {
+    with_test_prefix "$trace_type resolved" {
+       global srcdir
+       global subdir
+       global binfile
+       global srcfile
+       global lib_sl1
+
+       # Start with a fresh gdb.
+       gdb_exit
+       gdb_start
+       gdb_reinitialize_dir $srcdir/$subdir
+
+       gdb_test_multiple "$trace_type set_point1" "set pending tracepoint" {
+           -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" {
+               gdb_test "y" "\(Fast t|T\)racepoint.*set_point1.*pending." \
+                   "set pending tracepoint (without symbols)"
+           }
        }
-    }
 
-    gdb_test "info trace" \
-       "Num     Type\[ \]+Disp Enb Address\[ \]+What.*
+       gdb_test "info trace" \
+           "Num     Type\[ \]+Disp Enb Address\[ \]+What.*
 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*PENDING.*set_point1.*" \
-       "single pending tracepoint info (without symbols)"
+           "single pending tracepoint info (without symbols)"
 
-    gdb_load ${binfile}
+       gdb_load ${binfile}
 
-    gdb_test "break main" "Breakpoint.*at.* file .*$srcfile, line.*" \
-       "breakpoint function"
+       gdb_test "break main" "Breakpoint.*at.* file .*$srcfile, line.*" \
+           "breakpoint function"
 
-    gdb_run_cmd
-    gdb_test "" "Breakpoint 2, main.*"
+       gdb_run_cmd
+       gdb_test "" "Breakpoint 2, main.*"
 
-    # Run to main which should resolve a pending tracepoint
-    gdb_test "info trace" \
-       "Num     Type\[ \]+Disp Enb Address\[ \]+What.*
+       # Run to main which should resolve a pending tracepoint
+       gdb_test "info trace" \
+           "Num     Type\[ \]+Disp Enb Address\[ \]+What.*
 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*pendfunc.*" \
-       "single tracepoint info"
-}}
+           "single tracepoint info"
+    }
+}
 
 # Verify pending tracepoint is resolved and works as expected.
 
-proc pending_tracepoint_works { trace_type } { with_test_prefix "$trace_type works" {
-    global executable
-    global srcfile
-    global lib_sl1
-    global gdb_prompt
+proc pending_tracepoint_works { trace_type } {
+    with_test_prefix "$trace_type works" {
+       global executable
+       global srcfile
+       global lib_sl1
+       global gdb_prompt
 
-    # Restart with a fresh gdb.
-    clean_restart $executable
+       # Restart with a fresh gdb.
+       clean_restart $executable
 
-    # Test setting and querying pending tracepoints
+       # Test setting and querying pending tracepoints
 
-    gdb_test_multiple "$trace_type set_point1" "set pending tracepoint" {
-       -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" {
-           gdb_test "y" "\(Fast t|T\)racepoint.*set_point1.*pending." "set pending tracepoint"
+       gdb_test_multiple "$trace_type set_point1" "set pending tracepoint" {
+           -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" {
+               gdb_test "y" \
+                   "\(Fast t|T\)racepoint.*set_point1.*pending." \
+                   "set pending tracepoint"
+           }
        }
-    }
 
-    gdb_test "info trace" \
-       "Num     Type\[ \]+Disp Enb Address\[ \]+What.*
+       gdb_test "info trace" \
+           "Num     Type\[ \]+Disp Enb Address\[ \]+What.*
 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*PENDING.*set_point1.*" \
-       "single pending tracepoint info"
+           "single pending tracepoint info"
 
-    # Run to main which should resolve a pending tracepoint
-    gdb_test "break main" "Breakpoint.*at.* file .*$srcfile, line.*" \
-       "breakpoint function"
-    gdb_run_cmd
-    gdb_test "" "Breakpoint 2, main.*"
+       # Run to main which should resolve a pending tracepoint
+       gdb_test "break main" "Breakpoint.*at.* file .*$srcfile, line.*" \
+           "breakpoint function"
+       gdb_run_cmd
+       gdb_test "" "Breakpoint 2, main.*"
 
-    gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \
-       "breakpoint on marker"
+       gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \
+           "breakpoint on marker"
 
-    set test "start trace experiment"
-    gdb_test_multiple "tstart" $test {
-       -re "^tstart\r\n$gdb_prompt $" {
-           pass $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)"
-               # Skip the rest of the tests.
-               return
-           } else {
-               fail $test
+       set test "start trace experiment"
+       gdb_test_multiple "tstart" $test {
+           -re "^tstart\r\n$gdb_prompt $" {
+               pass $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)"
+                   # Skip the rest of the tests.
+                   return
+               } else {
+                   fail $test
+               }
            }
-       }
 
-    }
+       }
 
-    gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*" \
-       "continue to marker"
+       gdb_test "continue" "Continuing.\r\n\r\n(Thread .* hit )?Breakpoint.*marker.*at.*$srcfile.*" \
+           "continue to marker"
 
-    gdb_test "tstop" "\[\r\n\]+" "stop trace experiment"
+       gdb_test "tstop" "\[\r\n\]+" "stop trace experiment"
 
-    gdb_test "tfind start" "#0 .*" "tfind test frame 0"
-    gdb_test "tfind" "Found trace frame 1, tracepoint 1.*" "tfind test frame 1"
-    gdb_test "tfind" "Found trace frame 2, tracepoint 1.*" "tfind test frame 2"
-    gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind test frame"
-}}
+       gdb_test "tfind start" "#0 .*" "tfind test frame 0"
+       gdb_test "tfind" "Found trace frame 1, tracepoint 1.*" \
+           "tfind test frame 1"
+       gdb_test "tfind" "Found trace frame 2, tracepoint 1.*" \
+           "tfind test frame 2"
+       gdb_test "tfind" \
+           "Target failed to find requested trace frame..*" \
+           "tfind test frame"
+    }
+}
 
 # Verify pending tracepoint is resolved during trace.
 
@@ -173,7 +183,7 @@ proc pending_tracepoint_resolved_during_trace { trace_type } \
     # Start with a fresh gdb.
     clean_restart $executable
     if ![runto_main] {
-       fail "Can't run to main"
+       fail "can't run to main"
        return -1
     }
 
@@ -194,7 +204,7 @@ proc pending_tracepoint_resolved_during_trace { trace_type } \
 
     gdb_test_no_output "tstart" "start trace experiment"
 
-    gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*pending.c.*" \
+    gdb_test "continue" "Continuing.\r\n\r\n(Thread .* hit )?Breakpoint.*marker.*at.*pending.c.*" \
        "continue to marker 1"
 
     set test "continue to marker 2"
@@ -211,7 +221,7 @@ proc pending_tracepoint_resolved_during_trace { trace_type } \
                fail $test
            }
        }
-       -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" {
+       -re "Continuing.\r\n(Reading .* from remote target...\r\n)?\r\n(Thread .* hit )?Breakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" {
            pass $test
        }
     }
@@ -242,7 +252,7 @@ proc pending_tracepoint_installed_during_trace { trace_type } \
     # Start with a fresh gdb.
     clean_restart $executable
     if ![runto_main] {
-       fail "Can't run to main"
+       fail "can't run to main"
        return -1
     }
 
@@ -254,7 +264,7 @@ proc pending_tracepoint_installed_during_trace { trace_type } \
 
     gdb_test_no_output "tstart" "start trace experiment"
 
-    gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*${srcfile}.*" \
+    gdb_test "continue" "Continuing.\r\n\r\n(Thread .* hit )?Breakpoint.*marker.*at.*${srcfile}.*" \
        "continue to marker 1"
 
     # Set a pending tracepoint during a tracing experiment.
@@ -284,7 +294,7 @@ proc pending_tracepoint_installed_during_trace { trace_type } \
                fail $test
            }
        }
-       -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" {
+       -re "Continuing.\r\n(Reading .* from remote target...\r\n)?\r\n(Thread .* hit )?Breakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" {
            pass $test
        }
     }
@@ -297,7 +307,8 @@ proc pending_tracepoint_installed_during_trace { trace_type } \
 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*pendfunc2.*" \
        "tracepoint is resolved"
 
-    gdb_test "tfind start" "#0  $hex in pendfunc2 .*" "tfind test frame 0"
+    # powerpc64 shows "in .pendfunc2" here.
+    gdb_test "tfind start" "#0  $hex in .?pendfunc2 .*" "tfind test frame 0"
     gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind test frame"
 }}
 
@@ -315,7 +326,7 @@ proc pending_tracepoint_disconnect_during_trace { trace_type } \
     # Start with a fresh gdb.
     clean_restart $executable
     if ![runto_main] {
-       fail "Can't run to main"
+       fail "can't run to main"
        return -1
     }
 
@@ -331,7 +342,7 @@ proc pending_tracepoint_disconnect_during_trace { trace_type } \
 
     gdb_test_no_output "tstart" "start trace experiment"
 
-    gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*pending.c.*" \
+    gdb_test "continue" "Continuing.\r\n\r\n(Thread .* hit )?Breakpoint.*marker.*at.*pending.c.*" \
        "continue to marker"
 
     set test "disconnect with pending tracepoint"
@@ -363,7 +374,7 @@ proc pending_tracepoint_disconnect_after_resolved { trace_type } \
     # Start with a fresh gdb.
     clean_restart $executable
     if ![runto_main] {
-       fail "Can't run to main"
+       fail "can't run to main"
        return -1
     }
 
@@ -379,9 +390,9 @@ proc pending_tracepoint_disconnect_after_resolved { trace_type } \
 
     gdb_test_no_output "tstart" "start trace experiment"
 
-    gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*pending.c.*" \
+    gdb_test "continue" "Continuing.\r\n\r\n(Thread .* hit )?Breakpoint.*marker.*at.*pending.c.*" \
        "continue to marker 1"
-    gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*pending.c.*" \
+    gdb_test "continue" "Continuing.\r\n(Reading .* from remote target...\r\n)?\r\n(Thread .* hit )?Breakpoint.*marker.*at.*pending.c.*" \
        "continue to marker 2"
 
     # There should be no pending tracepoint, so no warning should be emitted.
@@ -411,11 +422,12 @@ proc pending_tracepoint_with_action_resolved { trace_type } \
     global srcfile
     global lib_sl1
     global gdb_prompt
+    global pcreg
 
     # Start with a fresh gdb.
     clean_restart $executable
     if ![runto_main] {
-       fail "Can't run to main"
+       fail "can't run to main"
        return -1
     }
 
@@ -426,13 +438,6 @@ proc pending_tracepoint_with_action_resolved { trace_type } \
        }
     }
 
-    set pcreg "pc"
-    if [is_amd64_regs_target] {
-       set pcreg "rip"
-    } elseif [is_x86_like_target] {
-       set pcreg "eip"
-    }
-
     gdb_trace_setactions "set action for pending tracepoint" "" \
        "collect \$$pcreg" "^$"
 
@@ -446,7 +451,7 @@ proc pending_tracepoint_with_action_resolved { trace_type } \
 
     gdb_test_no_output "tstart" "start trace experiment"
 
-    gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*pending.c.*" \
+    gdb_test "continue" "Continuing.\r\n\r\n(Thread .* hit )?Breakpoint.*marker.*at.*pending.c.*" \
        "continue to marker 1"
 
     set test "continue to marker 2"
@@ -463,7 +468,7 @@ proc pending_tracepoint_with_action_resolved { trace_type } \
                fail $test
             }
        }
-       -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" {
+       -re "Continuing.\r\n(Reading .* from remote target...\r\n)?\r\n(Thread .* hit )?Breakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" {
            pass "continue to marker 2"
        }
 
@@ -498,12 +503,12 @@ pending_tracepoint_installed_during_trace "trace"
 
 # Re-compile test case with IPA.
 set libipa [get_in_proc_agent]
-gdb_load_shlibs $libipa
+gdb_load_shlib $libipa
 
 lappend exec_opts "shlib=$libipa"
 
 if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != "" } {
-    untested "Failed to compile $srcfile"
+    untested "failed to compile with in-process agent library"
     return -1
 }
 
This page took 0.031421 seconds and 4 git commands to generate.