Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: William Tambe <tambewilliam@gmail.com>,
	Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb@sourceware.org
Subject: Re: gdb command "next" wrongly working as command "step"
Date: Fri, 23 Aug 2019 21:54:00 -0000	[thread overview]
Message-ID: <ca3b5f71-7493-6d63-e1c2-e74cd48583a8@redhat.com> (raw)
In-Reply-To: <CAF8i9mMEsHE4C2FJnzBgL2mF8AoMrE5JP22LbVAKVKOCNwNs-Q@mail.gmail.com>

On 8/23/19 10:33 PM, William Tambe wrote:
> On Sun, Aug 18, 2019 at 4:06 AM Jan Kratochvil
> <jan.kratochvil@redhat.com> wrote:
>> On Sun, 18 Aug 2019 10:31:54 +0200, William Tambe wrote:
>>> Can I have suggestions of locations within the gdb code where I could
>>> put breakpoints to trace where the issue I am having is occurring ?
>> Check what "set debug infrun 1" says and grep the sources for the displayed
>> messages.
>>
> Using "set debug infrun 1", I can see that GDB stops only after
> printing the following message:
> infrun: stepped to a different line.
> When the above event happens, GDB has stepped inside the function,
> which is obviously going to be on a different line; however, I am
> expecting GDB to step over the function.

Do a backtrace at this point.  GDB should see the caller in frame #1.
Sounds like it doesn't.

Or to be more accurate, use "stepi" to step to the first instruction
of the called function, and run "bt" there.

As Jan said, for "next" to work properly, backtrace/unwinding must work
properly.  When "next" behaves like "step", the most frequent reason
is that unwinding is broken.  "next" does a "backtrace" to detect whether
you've stepped into called function, and if you did, then it continues
execution to the address where the called function returns.

Thanks,
Pedro Alves


  reply	other threads:[~2019-08-23 21:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-18  3:36 William Tambe
2019-08-18  4:16 ` Jan Kratochvil
2019-08-18  8:32   ` William Tambe
2019-08-18  9:06     ` Jan Kratochvil
2019-08-23 21:33       ` William Tambe
2019-08-23 21:54         ` Pedro Alves [this message]
2019-08-24  3:36           ` William Tambe
2019-08-25 19:04             ` William Tambe

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=ca3b5f71-7493-6d63-e1c2-e74cd48583a8@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=tambewilliam@gmail.com \
    /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