This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA 2/2] Modify gdb.base/commands.exp to test multi breakpoint command setting/clearing.


gdb/testsuite/ChangeLog
2018-08-02  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.base/commands.exp: Test multi breakpoints setting
	and clearing.
---
 gdb/testsuite/gdb.base/commands.exp | 44 +++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index 259b89b803..57d9348244 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -281,6 +281,49 @@ proc_with_prefix breakpoint_command_test {} {
     gdb_test "print value" " = 5"
 }
 
+# Test clearing the commands of several breakpoints with one single "end".
+# As this test uses breakpoint numbers, we better run it first to ensure
+# the breakpoint numbers are not changing if other tests are added/changed
+# so that breakpoint numbers are also changed.
+proc_with_prefix run_me_first_breakpoint_clear_command_test {} {
+    # The below creates breakpoint nr 1.
+    runto_or_return factorial
+
+    set any "\[^\r\n\]*"
+    delete_breakpoints
+    gdb_test "break factorial" "Breakpoint.*at.*"
+    gdb_test "break main" "Breakpoint.*at.*"
+    gdb_test \
+	[multi_line_input \
+	     {commands 2 3} \
+	     {  print 1234321} \
+	     {end}] \
+	"End with.*" \
+	"commands"
+    gdb_test "info breakpoints" \
+	[multi_line \
+	     "${any}What${any}" \
+	     "${any}in factorial${any}" \
+	     "${any}print 1234321${any}" \
+	     "${any}in main${any}" \
+	     "${any}print 1234321${any}" \
+	    ] \
+	"check print 1234321 is there."
+    gdb_test \
+	[multi_line_input \
+	     {commands 2 3} \
+	     {end}] \
+	"End with.*" \
+	"commands"
+    gdb_test "info breakpoints" \
+	[multi_line \
+	     "${any}What${any}" \
+	     "${any}in factorial${any}" \
+	     "${any}in main${any}" \
+	    ] \
+	"check print 1234321 is not there anymore."
+    }
+
 # Test a simple user defined command (with arguments)
 proc_with_prefix user_defined_command_test {} {
     global valnum_re
@@ -1125,6 +1168,7 @@ proc_with_prefix backslash_in_multi_line_command_test {} {
     gdb_test "print 1" "" "run command"
 }
 
+run_me_first_breakpoint_clear_command_test
 gdbvar_simple_if_test
 gdbvar_simple_while_test
 gdbvar_complex_if_while_test
-- 
2.18.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]