From: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb/testsuite] Fix another timeout in gdb.base/bg-execution-repeat.exp
Date: Wed, 16 Apr 2025 17:26:55 +0200 [thread overview]
Message-ID: <CAJVr-EOk6b4Tn7Lq3Mdr62LifWcx2k4wpe5kvMAzn7oqWxW1zQ@mail.gmail.com> (raw)
In-Reply-To: <20250414115102.1991-1-tdevries@suse.de>
[-- Attachment #1: Type: text/plain, Size: 2002 bytes --]
On Mon, Apr 14, 2025 at 1:51 PM Tom de Vries <tdevries@suse.de> wrote:
> 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.
> ---
>
Hi Tom,
I also tested this on aarch64 and it works as expected, I think it's a
reasonable change.
Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
[-- Attachment #2: Type: text/html, Size: 2633 bytes --]
next prev parent reply other threads:[~2025-04-16 15:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-14 11:51 Tom de Vries
2025-04-16 15:26 ` Alexandra Petlanova Hajkova [this message]
2025-04-16 15:40 ` Tom de Vries
-- strict thread matches above, loose matches on Subject: below --
2025-04-10 3:09 Tom de Vries
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=CAJVr-EOk6b4Tn7Lq3Mdr62LifWcx2k4wpe5kvMAzn7oqWxW1zQ@mail.gmail.com \
--to=ahajkova@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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