gdb/testsuite/gdb.base/break.exp: split test_break_nonexistent_line
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 23 Nov 2022 18:39:56 +0000 (13:39 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 24 Nov 2022 15:22:40 +0000 (10:22 -0500)
Change-Id: I4390dd5da23bae83ccc513ad0de0169ddff7df12
Approved-By: Kevin Buettner <kevinb@redhat.com>
gdb/testsuite/gdb.base/break.exp

index b4d12cb56a92572af429caf04572315651647e54..a5ef521a4b0a2edc9003a693a354c786277461d0 100644 (file)
@@ -496,11 +496,21 @@ gdb_continue_to_end
 
 # Verify that GDB responds gracefully when asked to set a breakpoint
 # on a nonexistent source line.
-#
-gdb_test_no_output "set breakpoint pending off"
-gdb_test "break 999" \
-    "No line 999 in the current file." \
-    "break on non-existent source line"
+
+proc_with_prefix test_break_nonexistent_line {} {
+    clean_restart break
+
+    if ![runto_main] then {
+       return
+    }
+
+    gdb_test_no_output "set breakpoint pending off"
+    gdb_test "break 999" \
+       "No line 999 in the current file." \
+       "break on non-existent source line"
+}
+
+test_break_nonexistent_line
 
 proc_with_prefix test_break_default {} {
     clean_restart break