Re: [PATCHv2 2/2] gdb: remove VALUE_FRAME_ID

Simon Marchi via Gdb-patches
2021-07-05T14:23:21Z

> It was unexpected to me :)
>
> The frame number being reported here is the frame that wants the
> register, not the frame that provides the register, so given a stack
> like this (now with frame numbers):
>
> #1:normal_frame -> #0:inline_frame -> #-1:sentinel_frame
>
> And GDB says:
>
> { value_fetch_lazy (frame=1,regnum=.......
>
> GDB is trying to say that frame #1 asked to read a register, and the
> value returned as .... whatever ....
>
> BUT, what we _actually_ end up saying is:
>
> { value_fetch_lazy (frame=0,regnum=.......
>
> Which just isn't correct, frame 0 didn't cause the lazy register value
> to be created, frame 1 did. A developer reading these logs needs to
> understand that frame 0 is inline, and that the value in frame 1 is
> the same as the value in frame 0.
>
> You are correct that the patch you linked is indeed what introduced
> this mess in the first place, but I think the reasoning behind that
> original patch is still good.
>
> If this makes more sense then I will update the commit message to
> hopefully make things clearer - what do you think?

Ok, I (think) I see what you mean. I think we could adjust the debug
print to print the next frame's (which supplies the values) level
instead (and make it clear that it's the next frame's level that we
print).

Simon