Re: [PATCH 1/2 version 3] fix for gdb.reverse/finish-precsave.exp and gdb.reverse/finish-reverse.exp

Ulrich Weigand via Gdb-patches
2023-01-25T17:13:40Z

Pedro Alves <pedro@palves.net> wrote:
On 2023-01-25 2:11 p.m., Ulrich Weigand wrote:
> >The effect of "finish" is: skip until the end of the current
> >function and then do a "step". (Semantically equivalently,
> >do a series of "next" until you leave the current function.)
>
>But that this is not actually true -- this is not how finish is implemented.

Ah, you're right. I misremembered - I thought we were still stepping
after the step-resume breakpoint, but looks like we are not.

>Breakpoint 1, func2 (i=1) at finish.c:8
>8 return i + 1;
>(gdb) step
>9 } <<< stopped a line bounary, and stepped over the func1 call as well!
>(gdb) p $pc
>$3 = (void (*)()) 0x55555555514d <func2+17>

So this is still at the return in func2, but you're right,
the next step brings us directly to func1 without stopping
in main at all. This is indeed unlike finish.

>I disagree.

OK, you've convinced me as well. Sorry for the confusion ...

Bye,
Ulrich