public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/28424] New: step reverse over array expression requires two steps to complete
@ 2021-10-05 18:32 cel at us dot ibm.com
  2021-10-05 18:45 ` [Bug gdb/28424] " cel at us dot ibm.com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: cel at us dot ibm.com @ 2021-10-05 18:32 UTC (permalink / raw)
  To: gdb-prs

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

            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] = 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 = 0;       /* BREAK AT MAIN */
   x = 1;       /* NEXT TEST 1 */
   y = 2;       /* STEP TEST 1 */
   a[1] = 3;
   a[2] = a[2] - a[3]; /* TEST */
   a[3] = 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 

Breakpoint 1, main () at test-error.c:6
6       int main () {
(gdb) record
(gdb) step
10         w = 0;       /* BREAK AT MAIN */
(gdb) step
11         x = 1;       /* NEXT TEST 1 */
(gdb) step
12         y = 2;       /* STEP TEST 1 */
(gdb) step
13         a[1] = 3;
(gdb) step
14         a[2] = a[2] - a[3]; /* TEST */
(gdb) step
15         a[3] = 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] = a[2] - a[3]; /* TEST */
(gdb) step
15         a[3] = a[2] - a[3]; /* TEST */
(gdb) step
14         a[2] = a[2] - a[3]; /* TEST */
(gdb) step
14         a[2] = a[2] - a[3]; /* TEST */
(gdb) step
13         a[1] = 3;
(gdb) step
12         y = 2;       /* STEP TEST 1 */
(gdb) step
11         x = 1;       /* NEXT TEST 1 */
(gdb) step
10         w = 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 lines 
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.  

This issue is causing the regression test step-precsave.exp to fail.  The test
works when an extra step command is added.  

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"

--

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

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

* [Bug gdb/28424] step reverse over array expression requires two steps to complete
  2021-10-05 18:32 [Bug gdb/28424] New: step reverse over array expression requires two steps to complete cel at us dot ibm.com
@ 2021-10-05 18:45 ` cel at us dot ibm.com
  2024-02-09 17:46 ` cel at linux dot ibm.com
  2024-02-09 17:49 ` cel at linux dot ibm.com
  2 siblings, 0 replies; 4+ messages in thread
From: cel at us dot ibm.com @ 2021-10-05 18:45 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Carl E Love <cel at us dot ibm.com> ---
Note, I have observed the bug on Power and Intel.

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

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

* [Bug gdb/28424] step reverse over array expression requires two steps to complete
  2021-10-05 18:32 [Bug gdb/28424] New: step reverse over array expression requires two steps to complete cel at us dot ibm.com
  2021-10-05 18:45 ` [Bug gdb/28424] " cel at us dot ibm.com
@ 2024-02-09 17:46 ` cel at linux dot ibm.com
  2024-02-09 17:49 ` cel at linux dot ibm.com
  2 siblings, 0 replies; 4+ messages in thread
From: cel at linux dot ibm.com @ 2024-02-09 17:46 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Carl E Love <cel at linux dot ibm.com> ---
Various patches have been committed for the reverse stepping issues.

Tried to go back and verify which one fixed this one.  I got back to end of
April 2023 and it worked before I start hitting build issues and can't go back
anymore.

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

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

* [Bug gdb/28424] step reverse over array expression requires two steps to complete
  2021-10-05 18:32 [Bug gdb/28424] New: step reverse over array expression requires two steps to complete cel at us dot ibm.com
  2021-10-05 18:45 ` [Bug gdb/28424] " cel at us dot ibm.com
  2024-02-09 17:46 ` cel at linux dot ibm.com
@ 2024-02-09 17:49 ` cel at linux dot ibm.com
  2 siblings, 0 replies; 4+ messages in thread
From: cel at linux dot ibm.com @ 2024-02-09 17:49 UTC (permalink / raw)
  To: gdb-prs

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

Carl E Love <cel at linux dot ibm.com> changed:

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

--- Comment #3 from Carl E Love <cel at linux dot ibm.com> ---
Marking as resolved as I can not reproduce the issue any more.

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

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

end of thread, other threads:[~2024-02-09 17:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05 18:32 [Bug gdb/28424] New: step reverse over array expression requires two steps to complete cel at us dot ibm.com
2021-10-05 18:45 ` [Bug gdb/28424] " cel at us dot ibm.com
2024-02-09 17:46 ` cel at linux dot ibm.com
2024-02-09 17:49 ` cel at linux dot ibm.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).