From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A82003858403; Thu, 3 Nov 2022 08:36:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A82003858403 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667464607; bh=fkLYZYAaNZF05kNcZKf/bTmx5f/e2mRIddL7p0fDoJU=; h=From:To:Subject:Date:From; b=uFVwKATmoL8dJ943Qy3+4ydGJUjpLTkWLmn6C2H2ozg+wIXiooXxk6oDQ3M2MBHOX xfQDxfMk9kVrGlPJlDY1x1BJLujknqSPvM/oqe4KyzpanZXuZtzYx7aDzZrNN1bgBP atzQ7Xt2LwUqiTtjJKRSMQU29e0VDBDaDJRlgYEg= From: "blarsen at redhat dot com" To: gdb-prs@sourceware.org Subject: [Bug record/29745] New: gdbserver doesn't record changing return address on call instructions Date: Thu, 03 Nov 2022 08:36:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: record X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: blarsen at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29745 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=3D14431&action=3Ded= it minimal test When running an inferior in the gdbserver in x86_64, the call instruction o= nly 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 ins= tead 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 =3D 0; (gdb)=20 12 foo (); (gdb)=20 13 return 0; (gdb) rn 12 foo (); (gdb)=20 11 int x =3D 0; (gdb)=20 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. --=20 You are receiving this mail because: You are on the CC list for the bug.=