public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "blarsen at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/28426] Step reverse over line with multiple executable statements
Date: Wed, 25 Jan 2023 10:04:32 +0000	[thread overview]
Message-ID: <bug-28426-4717-mm9q8WpUaK@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28426-4717@http.sourceware.org/bugzilla/>

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

B. Larsen <blarsen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |blarsen at redhat dot com

--- Comment #3 from B. Larsen <blarsen at redhat dot com> ---
As explained by Pedro Alves in this email thread
(https://sourceware.org/pipermail/gdb-patches/2023-January/196110.html), it is
possible to reproduce this bug in x86_64, with a modified reproducer. Consider
the following code:

void func1 ()
{
}

void func 2 ()
{
}

int main ()
{
  int v = 0;
  func 1 (); func 2 ();
  return v;
}

and the debug session:

(gdb) start
Temporary breakpoint 1 at 0x40111c: file t.c, line 10.
Starting program: /home/blarsen/Documents/downstream_build/gdb/reverse 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Temporary breakpoint 1, main () at t.c:10
10          int v = 0;
(gdb) record
(gdb) n
11          func1 (); func2 ();
(gdb) 
12          return v;
(gdb) rn
11          func1 (); func2 ();
(gdb) 
11          func1 (); func2 ();
(gdb) rn

No more reverse-execution history.
main () at t.c:10
10          int v = 0;
(gdb) 


Without a line before the `func1 (); func2 ()` GDB mistakenly reports that
we've reached the end of the recorded history, but that is an unrelated bug.
Compiling the example program with no column information, we get instead the
following session:

(gdb) start
Temporary breakpoint 1 at 0x40111c: file t.c, line 10.
Starting program: /home/blarsen/Documents/downstream_build/gdb/reverse 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Temporary breakpoint 1, main () at t.c:10
10          int v = 0;
(gdb) record
(gdb) n
11          func1 (); func2 ();
(gdb) 
12          return v;
(gdb) rn
11          func1 (); func2 ();
(gdb) 

No more reverse-execution history.
main () at t.c:10
10          int v = 0;
(gdb)

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

  parent reply	other threads:[~2023-01-25 10:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05 22:12 [Bug gdb/28426] New: Step reverse over line with multiple cel at us dot ibm.com
2021-10-05 23:15 ` [Bug gdb/28426] Step reverse over line with multiple executable statements cel at us dot ibm.com
2022-10-26 14:00 ` vries at gcc dot gnu.org
2022-10-26 14:29 ` vries at gcc dot gnu.org
2023-01-25 10:04 ` blarsen at redhat dot com [this message]
2024-02-09 17:47 ` cel at linux dot ibm.com

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-28426-4717-mm9q8WpUaK@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).