public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30338] New: GDB skips line when using "stepi" but keeps line when using "step".
@ 2023-04-12 13:12 hluaw at connect dot ust.hk
  0 siblings, 0 replies; only message in thread
From: hluaw at connect dot ust.hk @ 2023-04-12 13:12 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-12 13:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-12 13:12 [Bug gdb/30338] New: GDB skips line when using "stepi" but keeps line when using "step" hluaw at connect dot ust.hk

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).