diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 9f65a4eaa82..a9c28522511 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-14  Tom de Vries  <tdevries@suse.de>
+
+	* lib/gdb.exp (supports_statement_frontiers): New proc.
+	* gdb.cp/step-and-next-inline.exp: Use supports_statement_frontiers.
+
 2020-03-14  Tom de Vries  <tdevries@suse.de>
 
 	* gdb.base/printcmds.exp: Add missing quoting for "print
diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.exp b/gdb/testsuite/gdb.cp/step-and-next-inline.exp
index acec48ba81d..3733fa75570 100644
--- a/gdb/testsuite/gdb.cp/step-and-next-inline.exp
+++ b/gdb/testsuite/gdb.cp/step-and-next-inline.exp
@@ -15,6 +15,10 @@
 
 standard_testfile .cc
 
+if { ![supports_statement_frontiers] } {
+    return -1
+}
+
 # Compile the test source with USE_NEXT_INLINE_H defined (when
 # use_header is true), or not defined.
 proc do_test { use_header } {
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index ae2d810a1eb..b14b3a968e1 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6947,5 +6947,16 @@ gdb_caching_proc skip_ctf_tests {
     } executable "additional_flags=-gt"]
 }
 
+# Return 1 if compiler supports -gstatement-frontiers.  Otherwise,
+# return 0.
+
+gdb_caching_proc supports_statement_frontiers {
+    return [gdb_can_simple_compile supports_statement_frontiers {
+	int main () {
+	    return 0;
+	}
+    } executable "additional_flags=-gstatement-frontiers"]
+}
+
 # Always load compatibility stuff.
 load_lib future.exp