public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug record/29745] New: gdbserver doesn't record changing return address on call instructions
@ 2022-11-03  8:36 blarsen at redhat dot com
  2022-11-04 11:12 ` [Bug record/29745] " cvs-commit at gcc dot gnu.org
  2023-05-04 15:21 ` blarsen at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: blarsen at redhat dot com @ 2022-11-03  8:36 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29745
           Summary: gdbserver doesn't record changing return address on
                    call instructions
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: record
          Assignee: unassigned at sourceware dot org
          Reporter: blarsen at redhat dot com
  Target Milestone: ---

Created attachment 14431
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14431&action=edit
minimal test

When running an inferior in the gdbserver in x86_64, the call instruction only
saves the register changes to $PC and possible parameters, it does not save the
change to the return address in the stack.

This makes it so when trying to next over a function or finish a function, GDB
sets a breakpoint on the wrong address, and may skip multiple functions instead
of just the expected one.

As an example, running the attached test I get the following output:

Temporary breakpoint 1, main () at
testsuite/outputs/gdb.reverse/step-reverse/step-reverse.c:10
10        foo ();
(gdb) record
(gdb) n
11        int x = 0;
(gdb) 
12        foo ();
(gdb) 
13        return 0;
(gdb) rn
12        foo ();
(gdb) 
11        int x = 0;
(gdb) 

No more reverse-execution history.
main () at testsuite/outputs/gdb.reverse/step-reverse/step-reverse.c:10
10        foo ();
(gdb) n

No more reverse-execution history.
main () at testsuite/outputs/gdb.reverse/step-reverse/step-reverse.c:13
13        return 0;

Notice that the final line is 13 when it should be line 11.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug record/29745] gdbserver doesn't record changing return address on call instructions
  2022-11-03  8:36 [Bug record/29745] New: gdbserver doesn't record changing return address on call instructions blarsen at redhat dot com
@ 2022-11-04 11:12 ` cvs-commit at gcc dot gnu.org
  2023-05-04 15:21 ` blarsen at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-04 11:12 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Bruno Larsen <blarsen@sourceware.org>:

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

commit 476410b3bca1389ee69e9c8fa18aaee16793a56d
Author: Bruno Larsen <blarsen@redhat.com>
Date:   Thu Nov 3 10:01:42 2022 +0100

    gdb/testsuite: add KFAILs to gdb.reverse/step-reverse.exp

    Recent changes to gdb.reverse/step-reverse.exp revealed the latent bug
    PR record/29745, where we can't skip one funcion forward if we're using
    native-gdbserver. This commit just adds kfails to the test.

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29745
    Approved-By: Simon Marchi <simon.marchi@efficios.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug record/29745] gdbserver doesn't record changing return address on call instructions
  2022-11-03  8:36 [Bug record/29745] New: gdbserver doesn't record changing return address on call instructions blarsen at redhat dot com
  2022-11-04 11:12 ` [Bug record/29745] " cvs-commit at gcc dot gnu.org
@ 2023-05-04 15:21 ` blarsen at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: blarsen at redhat dot com @ 2023-05-04 15:21 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from B. Larsen <blarsen at redhat dot com> ---
A recent commit from Simon Marchi (2a740b3ba4c9f39c86dd75e0914ee00942cab471)
Fixed this issue

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-04 15:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03  8:36 [Bug record/29745] New: gdbserver doesn't record changing return address on call instructions blarsen at redhat dot com
2022-11-04 11:12 ` [Bug record/29745] " cvs-commit at gcc dot gnu.org
2023-05-04 15:21 ` blarsen at redhat dot com

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).