public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "hluaw at connect dot ust.hk" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/30338] New: GDB skips line when using "stepi" but keeps line when using "step".
Date: Wed, 12 Apr 2023 13:12:50 +0000	[thread overview]
Message-ID: <bug-30338-4717@http.sourceware.org/bugzilla/> (raw)

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.

                 reply	other threads:[~2023-04-12 13:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30338-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).