This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] gas: Improve documentation for cfi_remember/restore_state


On Thu, Apr 14, 2016 at 3:39 AM, Alan Modra <amodra@gmail.com> wrote:
> Control flow in a program has no effect on interpretation of
> debug/eh_frame info.  I think your wording here is giving the
> impression that it does..

Yeah, definitely. It's actually kind of tricky to explain, more so
when I last used this years ago :)

> giving a DWARF "program" that is the same size but should execute a
> little faster when unwinding.  Would you please update your example to
> something that does benefit from using .cfi_remember_state?  The
> simplest one I can think of is if your example restored a register or
> two before adjusting sp, then you might want to describe that with
> .cfi_restore.  That then would require a larger DWARF program to
> recreate the register save locations if you wanted to do so "by hand"
> and thus use of remember_state/restore_state is justified.

Yeah, I guess you're right. I actually based my example on something
generated by gcc -S.

You mean something like:

    je label
    popq %rbx
    .cfi_remember_state
    .cfi_restore %rbx
    popq %rbp
    .cfi_restore %rbp
    popq %r12
    .cfi_restore %r12
    ret

label:
    .cfi_restore_state
    /* Do something else */

In that case we're using .cfi_restore_state to save us having to use
multiple CFI directives to recreate the original save locations.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]