gdb command "next" wrongly working as command "step"

William Tambe tambewilliam@gmail.com
Fri Aug 23 21:33:00 GMT 2019


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.

Within the single-step function gdbarch_software_single_step_ftype()
is there a way to tell whether GDB is stepping-into or stepping-over a
function ?

In fact within my implementation of
gdbarch_software_single_step_ftype() when the instruction
jump-and-link (used when calling a function) is decoded, the
breakpoint is placed at the jump target; I could instead place the
breakpoint after the instruction jump-and-link if I could tell whether
the GDB command "step"/"stepi" or "next"/"nexti" was used.

So within gdbarch_software_single_step_ftype(), is there a way to tell
whether GDB is stepping-into or stepping-over a function ?

>
> Jan



More information about the Gdb mailing list