From: Tom de Vries <tdevries@suse.de>
To: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
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:40:18 +0200 [thread overview]
Message-ID: <fb283ff9-8b96-487a-84b4-00cb9e2c19fa@suse.de> (raw)
In-Reply-To: <CAJVr-EOk6b4Tn7Lq3Mdr62LifWcx2k4wpe5kvMAzn7oqWxW1zQ@mail.gmail.com>
On 4/16/25 17:26, Alexandra Petlanova Hajkova wrote:
>
>
> On Mon, Apr 14, 2025 at 1:51 PM Tom de Vries <tdevries@suse.de
> <mailto: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.
>
Hi Alexandra,
thanks for the review, pushed.
- Tom
> Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com
> <mailto:ahajkova@redhat.com>>
next prev parent reply other threads:[~2025-04-16 15:40 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
2025-04-16 15:40 ` Tom de Vries [this message]
-- 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=fb283ff9-8b96-487a-84b4-00cb9e2c19fa@suse.de \
--to=tdevries@suse.de \
--cc=ahajkova@redhat.com \
--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