On Fri, Jun 14, 2013 at 4:54 AM, Nick Wellnhofer <[email protected]> wrote:
> On 14/06/2013 12:48, Nathan Kurz wrote:
>>
>> But why is it being pushed and popped with no intervening function
>> call?  Is the ghost it leaves on the stack used for something?
>
>
> Yes, it's used to get backtraces for not-so-smart debuggers or if there's no
> debugging information in the binary. Newer GCC/GDB versions can debug
> without frame pointer, so it's omitted by default when compiling with -O2.

I understand the general use, but was confused as to why the tail call
optimization would be made without also optimizing this out.  Since
the point of the optimization is to share the same stack frame, it
seems odd that this part is not shared as well.  I'm still confused by
this, but probably shouldn't be.  I guess it would allow you to get a
correct backtrace if there was a segfault or breakpoint in the single
'mov' instruction before the 'jmp'.

Thanks!

--nate

Reply via email to