public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug testsuite/30074] FAIL: gdb.threads/schedlock.exp: schedlock=on: cmd=continue: stop all threads (with lock) (timeout)
Date: Mon, 06 Feb 2023 11:52:55 +0000	[thread overview]
Message-ID: <bug-30074-4717-vEsLLsqplG@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30074-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=30074

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9af467b82406614deb46151f838c336a7c8604db

commit 9af467b82406614deb46151f838c336a7c8604db
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Feb 6 12:52:50 2023 +0100

    [gdb/testsuite] Fix gdb.threads/schedlock.exp on fast cpu

    Occasionally, I run into:
    ...
    (gdb) PASS: gdb.threads/schedlock.exp: schedlock=on: cmd=continue: \
      set scheduler-locking on
    continue^M
    Continuing.^M
    PASS: gdb.threads/schedlock.exp: schedlock=on: cmd=continue: \
      continue (with lock)
    [Thread 0x7ffff746e700 (LWP 1339) exited]^M
    No unwaited-for children left.^M
    (gdb) Quit^M
    (gdb) FAIL: gdb.threads/schedlock.exp: schedlock=on: cmd=continue: \
      stop all threads (with lock) (timeout)
    ...

    What happens is that this loop which is supposed to run "just short of
forever":
    ...
        /* Don't run forever.  Run just short of it :)  */
        while (*myp > 0)
          {
            /* schedlock.exp: main loop.  */
            MAYBE_CALL_SOME_FUNCTION(); (*myp) ++;
          }
    ...
    finishes after 0x7fffffff iterations (when a signed wrap occurs), which on
my
    system takes only about 1.5 seconds.

    Fix this by:
    - changing the pointed-at type of myp from signed to unsigned, which makes
the
      wrap defined behaviour (and which also make the loop run twice as long,
      which is already enough to make it impossible for me to reproduce the
FAIL.
      But let's try to solve this more structurally).
    - changing the pointed-at type of myp from int to long long, making the
wrap
      unlikely.
    - making sure the loop runs forever, by setting the loop condition to 1.
    - making sure the loop still contains different lines (as far as debug info
is
      concerned) by incrementing a volatile counter in the loop.
    - making sure the program doesn't run forever in case of trouble, by adding
an
      "alarm (30)".

    Tested on x86_64-linux.

    PR testsuite/30074
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30074

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-02-06 11:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03 12:16 [Bug gdb/30074] New: " vries at gcc dot gnu.org
2023-02-05 18:30 ` [Bug gdb/30074] " vries at gcc dot gnu.org
2023-02-06 10:33 ` [Bug testsuite/30074] " vries at gcc dot gnu.org
2023-02-06 11:52 ` cvs-commit at gcc dot gnu.org [this message]
2023-02-06 11:55 ` vries at gcc dot gnu.org

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=bug-30074-4717-vEsLLsqplG@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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).