public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed] [gdb/testsuite] Fix gdb.python/py-breakpoint.exp timeouts
Date: Tue, 28 Feb 2023 15:50:38 +0100	[thread overview]
Message-ID: <20230228145038.27149-1-tdevries@suse.de> (raw)

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   | 2 ++
 gdb/testsuite/gdb.python/py-breakpoint.exp | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.python/py-breakpoint.c b/gdb/testsuite/gdb.python/py-breakpoint.c
index 0f791da9c27..1fb341660e9 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.c
+++ b/gdb/testsuite/gdb.python/py-breakpoint.c
@@ -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. */
diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp
index 9535040e3a2..ab81b7ade85 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-breakpoint.exp
@@ -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

base-commit: eae679b9c7760e994c85695946c6b69a227dc69b
-- 
2.35.3


                 reply	other threads:[~2023-02-28 14:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230228145038.27149-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).