public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "ssbssa at sourceware dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug record/31353] New: gdb hangs when btrace replaying from a conditional breakpoint
Date: Wed, 07 Feb 2024 15:49:47 +0000	[thread overview]
Message-ID: <bug-31353-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 31353
           Summary: gdb hangs when btrace replaying from a conditional
                    breakpoint
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: record
          Assignee: unassigned at sourceware dot org
          Reporter: ssbssa at sourceware dot org
  Target Milestone: ---

Created attachment 15353
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15353&action=edit
testsuite reproducer

gdb can hang when backward/forward stepping in a btrace recording, when on the
recording start is also a breakpoint which doesn't hit because of a condition.

Using gdb.btrace/record_goto.c:
```
void
fun1 (void)
{               /* fun1.1 */
}               /* fun1.2 */

void
fun2 (void)
{               /* fun2.1 */
  fun1 ();      /* fun2.2 */
}               /* fun2.3 */

void
fun3 (void)
{               /* fun3.1 */
  fun1 ();      /* fun3.2 */
  fun2 ();      /* fun3.3 */
}               /* fun3.4 */

void
fun4 (void)
{               /* fun4.1 */
  fun1 ();      /* fun4.2 */
  fun2 ();      /* fun4.3 */
  fun3 ();      /* fun4.4 */
}               /* fun4.5 */

int
main (void)
{               /* main.1 */
  fun4 ();      /* main.2 */
  return 0;     /* main.3 */
}               /* main.4 */
```

And these steps:
```
Reading symbols from record_goto.exe...
(gdb) b *fun4
Breakpoint 1 at 0x140001634: file record_goto.c, line 40.
(gdb) r
Starting program: C:\src\repos\gdb-git-python3\gdb\record_goto.exe
[New Thread 21748.0x3d2c]

Thread 1 hit Breakpoint 1, fun4 () at record_goto.c:40
40      {               /* fun4.1 */
(gdb) record btrace pt
(gdb) n
41        fun1 ();      /* fun4.2 */
(gdb) n
42        fun2 ();      /* fun4.3 */
(gdb) reverse-next
41        fun1 ();      /* fun4.2 */
(gdb) reverse-next

Thread 1 hit Breakpoint 1, fun4 () at record_goto.c:40
40      {               /* fun4.1 */
(gdb) reverse-next

No more reverse-execution history.
fun4 () at record_goto.c:40
40      {               /* fun4.1 */
(gdb) n
41        fun1 ();      /* fun4.2 */
(gdb) cond 1 0
(gdb) reverse-next

No more reverse-execution history.
fun4 () at record_goto.c:40
40      {               /* fun4.1 */
(gdb) n
```

At that point it will hang, and when I press ctrl-c, I get:
```
C:/src/repos/binutils-gdb.git/gdb/inferior.c:394: internal-error:
find_inferior_pid: Assertion `pid != 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)                                           
```

I hit this on Windows, but Tromey confirmed this happens on Linux as well.

I've also attached a testsuite reproducer, where the last test gets in a
timeout:
```
reverse-next

No more reverse-execution history.
fun4 () at
C:/src/repos/binutils-gdb.git/gdb/testsuite/gdb.btrace/record_goto.c:40
40      {               /* fun4.1 */
(gdb) PASS: gdb.btrace/cond-break-on-record-start.exp: reverse to beginning
again
next
FAIL: gdb.btrace/cond-break-on-record-start.exp: replay first step to fun1
again (timeout)
testcase
/c/src/repos/binutils-gdb.git/gdb/testsuite/gdb.btrace/cond-break-on-record-start.exp
completed in 18 seconds

                === gdb Summary ===

# of expected passes            11
# of unexpected failures        1
```

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

             reply	other threads:[~2024-02-07 15:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 15:49 ssbssa at sourceware dot org [this message]
2024-02-07 15:51 ` [Bug record/31353] " ssbssa at sourceware dot 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-31353-4717@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).