[gdb/testsuite] Fix gdb.python/py-breakpoint.exp timeouts
authorTom de Vries <tdevries@suse.de>
Tue, 28 Feb 2023 14:50:23 +0000 (15:50 +0100)
committerTom de Vries <tdevries@suse.de>
Tue, 28 Feb 2023 14:50:23 +0000 (15:50 +0100)
On powerpc64le-linux, I run into two timeouts:
...
FAIL: gdb.python/py-breakpoint.exp: test_watchpoints: \
  Test watchpoint write (timeout)
FAIL: gdb.python/py-breakpoint.exp: test_bkpt_internal: \
  Test watchpoint write (timeout)
...

In this case, hw watchpoints are not supported, and using sw watchpoints
is slow.

Most of the time is spent in handling a try-catch, which triggers a malloc.  I
think this bit is more relevant for the "catch throw" part of the test-case,
so fix the timeouts by setting the watchpoints after the try-catch.

Tested on x86_64-linux and powerpc64le-linux.

gdb/testsuite/gdb.python/py-breakpoint.c
gdb/testsuite/gdb.python/py-breakpoint.exp

index 0f791da9c27a9d5bf065876a03eb49e4d1bbc412..1fb341660e9f78b9436e607fca5375d700538f15 100644 (file)
@@ -60,6 +60,8 @@ int main (int argc, char *argv[])
       /* Nothing.  */
     }
 
+  i = -1; /* Past throw-catch.  */
+
   for (i = 0; i < 10; i++)
     {
       result += multiply (foo);  /* Break at multiply. */
index 9535040e3a24f22b022f5a3cea6d21d7b984c524..ab81b7ade8575e1935b2f9be367cfd88cf80425e 100644 (file)
@@ -36,6 +36,8 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} ${options}]
     return -1
 }
 
+set past_throw_catch_line [gdb_get_line_number "Past throw-catch."]
+
 proc_with_prefix test_bkpt_basic { } {
     global srcfile testfile hex decimal
 
@@ -293,7 +295,7 @@ proc_with_prefix test_watchpoints { } {
        gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
 
-    if {![runto_main]} {
+    if {![runto $srcfile:$::past_throw_catch_line]} {
        return 0
     }
 
@@ -316,7 +318,7 @@ proc_with_prefix test_bkpt_internal { } {
     if {!$allow_hw_watchpoint_tests_p} {
        gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
-    if {![runto_main]} {
+    if {![runto $srcfile:$::past_throw_catch_line]} {
        return 0
     }
     delete_breakpoints