gdb/testsuite: Fix race condition in gdb.base/skip.exp
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / skip.exp
index 6b74f51135e7b3aa83b389fb62f198066eafaa8e..513c9fcc82eabca70f621c8449c2acfa0b798dc8 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 2011-2019 Free Software Foundation, Inc.
+#   Copyright 2011-2020 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
@@ -141,9 +141,12 @@ with_test_prefix "step after disabling 3" {
     }
 
     gdb_test "step" "bar \\(\\) at.*" "step 1"
-    gdb_test "step" ".*" "step 2"; # Return from foo()
-    gdb_test "step" "foo \\(\\) at.*" "step 3"
-    gdb_test "step" ".*" "step 4"; # Return from bar()
+    gdb_test "step" ".*" "step 2"; # Return from bar()
+    # With gcc 9.2.0 we jump once back to main before entering foo here.
+    # If that happens try to step a second time.
+    gdb_test "step" "foo \\(\\) at.*" "step 3" \
+       "main \\(\\) at .*\r\n$gdb_prompt " "step"
+    gdb_test "step" ".*" "step 4"; # Return from foo()
     gdb_test "step" "main \\(\\) at.*" "step 5"
 }
 
@@ -261,7 +264,10 @@ with_test_prefix "step using -fu for baz" {
     gdb_test_no_output "skip enable 7"
     gdb_test "step" "bar \\(\\) at.*" "step 1"
     gdb_test "step" ".*" "step 2"; # Return from bar()
-    gdb_test "step" "foo \\(\\) at.*" "step 3"
+    # With gcc 9.2.0 we jump once back to main before entering foo here.
+    # If that happens try to step a second time.
+    gdb_test "step" "foo \\(\\) at.*" "step 3" \
+       "main \\(\\) at .*\r\n$gdb_prompt " "step"
     gdb_test "step" ".*" "step 4"; # Return from foo()
     gdb_test "step" "main \\(\\) at.*" "step 5"
 }
@@ -276,7 +282,10 @@ with_test_prefix "step using -rfu for baz" {
     gdb_test_no_output "skip enable 8"
     gdb_test "step" "bar \\(\\) at.*" "step 1"
     gdb_test "step" ".*" "step 2"; # Return from bar()
-    gdb_test "step" "foo \\(\\) at.*" "step 3"
+    # With gcc 9.2.0 we jump once back to main before entering foo here.
+    # If that happens try to step a second time.
+    gdb_test "step" "foo \\(\\) at.*" "step 3" \
+       "main \\(\\) at .*\r\n$gdb_prompt " "step"
     gdb_test "step" ".*" "step 4"; # Return from foo()
     gdb_test "step" "main \\(\\) at.*" "step 5"
 }
This page took 0.02614 seconds and 4 git commands to generate.