[Bug gdb/30338] New: GDB skips line when using "stepi" but keeps line when using "step".

hluaw at connect dot ust.hk sourceware-bugzilla@sourceware.org
Wed Apr 12 13:12:50 GMT 2023


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

            Bug ID: 30338
           Summary: GDB skips line when using "stepi" but keeps line when
                    using "step".
           Product: gdb
           Version: 13.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: hluaw at connect dot ust.hk
  Target Milestone: ---

Given the code:
int a, b;
int c(void) { a = b & 5; }
int d() { c(); }
int func_1() {
  char e;
  for (; e;);
}
int main() {
  int f;
  func_1();
  for (; f < 10; f++)
    d();
}

Compile with GCC 12.2.0 -O1

Break at func_1, using step and stepi yield different result.
Specifically, step will stop at line 12, while stepi skips line 12.

step
6         for (; e;);
(gdb) s
main () at r.c:11
11        for (; f < 10; f++)
(gdb) s
12          d();
(gdb) s
d () at r.c:3
3       int d() { c(); }

stepi
6         for (; e;);
(gdb) si
main () at r.c:11
11        for (; f < 10; f++)
(gdb)
d () at r.c:3
3       int d() { c(); }

readelf yields this.
[0x0000007c]  Special opcode 76: advance Address by 5 to 0x40112d and Line by 1
to 12
[0x0000007d]  Advance Line by -9 to 3

It seems that line 12 contains no code?
Is it expected that stepi and step diverges?

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


More information about the Gdb-prs mailing list