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

index cb5831ac6103d766545cd8a86a8b14017a8afc31..c0756cdccc2384a4034ff399e88f967a37c5f4ad 100644 (file)
@@ -897,13 +897,21 @@ with_test_prefix "set line:file breakpoint via convenience variable" {
        "non-integer convenience variable disallowed"
 }
 
-#
 # Test that commands can be cleared without error.
-#
 
-gdb_test "commands\nprint 232323\nend" ">end" "set some breakpoint commands"
-gdb_test "commands\nend" ">end" "clear breakpoint commands"
-# We verify that the commands were cleared by ensuring that the last
-# breakpoint's location ends the output -- if there were commands,
-# they would have been printed after the location.
-gdb_test "info break" "$srcfile:$line_actual" "verify that they were cleared"
+proc_with_prefix test_break_commands_clear {} {
+    clean_restart breako2
+
+    set line [gdb_get_line_number "set breakpoint 1 here"]
+    gdb_breakpoint $line
+
+    gdb_test "commands\nprint 232323\nend" ">end" "set some breakpoint commands"
+    gdb_test "commands\nend" ">end" "clear breakpoint commands"
+
+    # We verify that the commands were cleared by ensuring that the last
+    # breakpoint's location ends the output -- if there were commands,
+    # they would have been printed after the location.
+    gdb_test "info break" "$::srcfile:$::decimal" "verify that they were cleared"
+}
+
+test_break_commands_clear