public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/gdb] gdb-17.2-rebase-f44: Backport "Fix another timeout in gdb.base/bg-execution-repeat.exp"
Date: Sun, 28 Jun 2026 00:02:08 GMT	[thread overview]
Message-ID: <178260492847.1.3743679366133741529.rpms-gdb-0481d32251c3@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/gdb
            Branch : gdb-17.2-rebase-f44
            Commit : 0481d32251c31ba231909da785010fb6cb561ed4
            Author : Alexandra Hájková <ahajkova@redhat.com>
            Date   : 2025-04-25T10:44:49+02:00
            Stats  : +85/-0 in 5 file(s)
            URL    : https://src.fedoraproject.org/rpms/gdb/c/0481d32251c31ba231909da785010fb6cb561ed4?branch=gdb-17.2-rebase-f44

            Log:
            Backport "Fix another timeout in gdb.base/bg-execution-repeat.exp"

(Tom de Vries)

---
diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include
index b752f77..53f7fc1 100644
--- a/_gdb.spec.Patch.include
+++ b/_gdb.spec.Patch.include
@@ -36,3 +36,6 @@ Patch006: gdb-add-index.patch
 # RPMs to install when GDB finds an objfile with no debug info.
 Patch007: gdb-add-rpm-suggestion-script.patch
 
+# Backport "Fix another timeout in gdb.base/bg-execution-repeat.exp"
+Patch008: gdb-fix-bg-execution-repeat.patch
+

diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include
index f6a9246..53b05cc 100644
--- a/_gdb.spec.patch.include
+++ b/_gdb.spec.patch.include
@@ -5,3 +5,4 @@
 %patch -p1 -P005
 %patch -p1 -P006
 %patch -p1 -P007
+%patch -p1 -P008

diff --git a/_patch_order b/_patch_order
index d42dbdd..75114ed 100644
--- a/_patch_order
+++ b/_patch_order
@@ -5,3 +5,4 @@ gdb-archer-next-over-throw-cxx-exec.patch
 gdb-rhbz1149205-catch-syscall-after-fork-test.patch
 gdb-add-index.patch
 gdb-add-rpm-suggestion-script.patch
+gdb-fix-bg-execution-repeat.patch

diff --git a/gdb-fix-bg-execution-repeat.patch b/gdb-fix-bg-execution-repeat.patch
new file mode 100644
index 0000000..d255c25
--- /dev/null
+++ b/gdb-fix-bg-execution-repeat.patch
@@ -0,0 +1,76 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
+Date: Fri, 25 Apr 2025 10:31:16 +0200
+Subject: gdb-fix-bg-execution-repeat.patch
+
+;; Backport "Fix another timeout in gdb.base/bg-execution-repeat.exp"
+
+[gdb/testsuite] Fix another timeout in gdb.base/bg-execution-repeat.exp
+
+With test-case gdb.base/bg-execution-repeat.exp, occasionally I run into a
+timeout:
+...
+(gdb) c 1&
+Will stop next time breakpoint 1 is reached.  Continuing.
+(gdb) PASS: $exp: c 1&: c 1&
+
+Breakpoint 2, foo () at bg-execution-repeat.c:23
+23        return 0; /* set break here */
+PASS: $exp: c 1&: breakpoint hit 1
+
+Will stop next time breakpoint 2 is reached.  Continuing.
+(gdb) PASS: $exp: c 1&: repeat bg command
+print 1
+$1 = 1
+(gdb) PASS: $exp: c 1&: input still accepted
+interrupt
+(gdb) PASS: $exp: c 1&: interrupt
+
+Program received signal SIGINT, Interrupt.
+foo () at bg-execution-repeat.c:24
+24      }
+PASS: $exp: c 1&: interrupt received
+set var do_wait=0
+(gdb) PASS: $exp: c 1&: set var do_wait=0
+continue&
+Continuing.
+(gdb) PASS: $exp: c 1&: continue&
+FAIL: $exp: c 1&: breakpoint hit 2 (timeout)
+...
+
+I can reproduce it reliably by adding a "sleep (1)" before the "do_wait = 1"
+in the .c file.
+
+The timeout happens as follows:
+- with the inferior stopped at main, gdb continues (command c 1&)
+- the inferior hits the breakpoint at foo
+- gdb continues (using the repeat command functionality)
+- the inferior is interrupted
+- inferior variable do_wait gets set to 0.  The assumption here is that the
+  inferior has progressed enough that do_wait is set to 1 at that point, but
+  that happens not to be the case.  Consequently, this has no effect.
+- gdb continues
+- the inferior sets do_wait to 1
+- the inferior enters the wait function, and wait for do_wait to become 0,
+  which never happens.
+
+Fix this by moving the "do_wait = 1" to before the first call to foo.
+
+Tested on x86_64-linux.
+
+Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
+
+diff --git a/gdb/testsuite/gdb.base/bg-execution-repeat.c b/gdb/testsuite/gdb.base/bg-execution-repeat.c
+--- a/gdb/testsuite/gdb.base/bg-execution-repeat.c
++++ b/gdb/testsuite/gdb.base/bg-execution-repeat.c
+@@ -37,9 +37,9 @@ main (void)
+ {
+   alarm (60);
+ 
++  do_wait = 1;
+   foo ();
+ 
+-  do_wait = 1;
+   wait ();
+   /* do_wait set to 0 externally.  */
+ 

diff --git a/gdb.spec b/gdb.spec
index 600daee..c1b138f 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -923,6 +923,10 @@ fi
 # endif scl
 
 %changelog
+* Fri Apr 25 2025 Alexandra Hájková <ahajkova@redhat.com>
+- Backport "Fix another timeout in gdb.base/bg-execution-repeat.exp"
+  (Tom de Vries)
+
 * Wed Apr 23 2025 Alexandra Hájková <ahajkova@redhat.com> - 16.3-1
 - Rebase to FSF GDB 16.3.
   Deleted: core-target-open-segfault.patch

                 reply	other threads:[~2026-06-28  0:02 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=178260492847.1.3743679366133741529.rpms-gdb-0481d32251c3@fedoraproject.org \
    --to=git-commits@fedoraproject.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