From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B7643385AC22; Tue, 5 Oct 2021 18:32:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B7643385AC22 From: "cel at us dot ibm.com" To: gdb-prs@sourceware.org Subject: [Bug gdb/28424] New: step reverse over array expression requires two steps to complete Date: Tue, 05 Oct 2021 18:32:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cel at us dot ibm.com X-Bugzilla-Status: UNCONFIRMED 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 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 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Oct 2021 18:32:15 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28424 Bug ID: 28424 Summary: step reverse over array expression requires two steps to complete Product: gdb Version: unknown Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: cel at us dot ibm.com Target Milestone: --- When stepping in the reverse direction a C statement like: a[2] =3D a[2] - a[3]; requires two step commands to step over the line. The following is a stripped down version of gdb.reverse/step-reverse.c. int main () { int w,x,y,z; int a[10], b[10]; w =3D 0; /* BREAK AT MAIN */ x =3D 1; /* NEXT TEST 1 */ y =3D 2; /* STEP TEST 1 */ a[1] =3D 3; a[2] =3D a[2] - a[3]; /* TEST */ a[3] =3D a[2] - a[3]; /* TEST */ exit (0); /* end of main */ } Compile the test program with -g and run on gdb. The following shows that stepping in the forward direction works as expected (gdb) break main Breakpoint 1 at 0x838: file test-error.c, line 6. (gdb) r Starting program: /home/carll/test-error=20 Breakpoint 1, main () at test-error.c:6 6 int main () { (gdb) record (gdb) step 10 w =3D 0; /* BREAK AT MAIN */ (gdb) step 11 x =3D 1; /* NEXT TEST 1 */ (gdb) step 12 y =3D 2; /* STEP TEST 1 */ (gdb) step 13 a[1] =3D 3; (gdb) step 14 a[2] =3D a[2] - a[3]; /* TEST */ (gdb) step 15 a[3] =3D a[2] - a[3]; /* TEST */ (gdb) step 17 exit (0); /* end of main */ Now reverse and step (gdb) set exec-dir reverse (gdb) step 15 a[3] =3D a[2] - a[3]; /* TEST */ (gdb) step 15 a[3] =3D a[2] - a[3]; /* TEST */ (gdb) step 14 a[2] =3D a[2] - a[3]; /* TEST */ (gdb) step 14 a[2] =3D a[2] - a[3]; /* TEST */ (gdb) step 13 a[1] =3D 3; (gdb) step 12 y =3D 2; /* STEP TEST 1 */ (gdb) step 11 x =3D 1; /* NEXT TEST 1 */ (gdb) step 10 w =3D 0; /* BREAK AT MAIN */ (gdb) step No more reverse-execution history. main () at test-error.c:6 6 int main () { I took two step commands, instead of only one step command, to step over li= nes=20 14 and 15 but only one step instruction for the other lines. The error seems to occur only when there is an array expression on the right hand side.=20=20 This issue is causing the regression test step-precsave.exp to fail. The t= est works when an extra step command is added.=20=20 diff --git a/gdb/testsuite/gdb.reverse/step-precsave.exp b/gdb/testsuite/gdb.rev erse/step-precsave.exp index 43f6ab3a11a..3f4413ea353 100644 --- a/gdb/testsuite/gdb.reverse/step-precsave.exp +++ b/gdb/testsuite/gdb.reverse/step-precsave.exp @@ -249,7 +249,7 @@ gdb_test_multiple "stepi" "$test_message" { } # step backward into function (thru return) - +gdb_test "step" ".*FINISH TEST.*" "Extra step should not be needed. BUG" gdb_test "step" "(RETURN FROM CALLEE|ARRIVED IN CALLEE).*" \ "reverse step into fn call" -- --=20 You are receiving this mail because: You are on the CC list for the bug.=