public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/28426] New: Step reverse over line with multiple
@ 2021-10-05 22:12 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
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: cel at us dot ibm.com @ 2021-10-05 22:12 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28426
           Summary: Step reverse over line with multiple
           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: ---

The gdb command step is supposed to step over the next line in the program.

When executing in reverse, the step command for a line that contains two
executable statements requires two step commands to get to the previous line
not one step command as expected.

The following is a test program to demonstrate the behavior.  It is based on
the regression test gdb.reverese/solib-reverse.c.

int main ()                                                                     
{                                                                               
  int b[2] = {5,8};                                                             

  b[0] = 1;
  b[1] = 2;

  b[0] = 6;   b[1] = 9;         /* generic statement, end part two */           

  b[1] = 10;
  b[0] = 20;

  return 0;
} /* end of main */

Compile the program with -g and run on gdb

Start by enabling recording and stepping forward.

(gdb) break main
Breakpoint 1 at 0x838: file solib-reverse-bug.c, line 2.
(gdb) run
Starting program: /home/carll/solib-reverse-bug 

Breakpoint 1, main () at solib-reverse-bug.c:2
2       {
(gdb) list
1       int main ()
2       {
3         int b[2] = {5,8};
4       
5         b[0] = 1;
6         b[1] = 2;
7       
8         b[0] = 6;   b[1] = 9;         /* generic statement, end part two */
9       
10        b[1] = 10;
(gdb) 
11        b[0] = 20;
12      
13        return 0;
14      }
(gdb) record
(gdb) step
3         int b[2] = {5,8};
(gdb) step
5         b[0] = 1;
(gdb) step
6         b[1] = 2;
(gdb) step
8         b[0] = 6;   b[1] = 9;         /* generic statement, end part two */
(gdb) step
10        b[1] = 10;
(gdb) step
11        b[0] = 20;
(gdb) step
13        return 0;

As expected step advances to the next line each time, specifically line 8.

Set the execution direction to reverse and step

(gdb) set exec-dir reverse
(gdb) step
11        b[0] = 20;
(gdb) step
10        b[1] = 10;
(gdb) step
8         b[0] = 6;   b[1] = 9;         /* generic statement, end part two */
(gdb) step
8         b[0] = 6;   b[1] = 9;         /* generic statement, end part two */
(gdb) step
6         b[1] = 2;
(gdb) step
5         b[0] = 1;
(gdb) step
3         int b[2] = {5,8};
(gdb) step

You will note, that line 8 required two steps to get to the previous line. 
Step over the other lines worked as expected.

This issue has been observed on Power PC and Intel.

Note the above bug results in gdb.reverse/solib-presave.exp and
gdb.reverse/solib-reverse.exp to fail.



./

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

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2024-02-09 17:47 ` 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).