This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] gas: Improve documentation for cfi_remember/restore_state
- From: Martin Galvan <martin dot galvan at tallertechnologies dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: binutils at sourceware dot org, nickc at redhat dot com
- Date: Thu, 14 Apr 2016 11:23:08 -0300
- Subject: Re: [PATCH] gas: Improve documentation for cfi_remember/restore_state
- Authentication-results: sourceware.org; auth=none
- References: <1460584160-17648-1-git-send-email-martin dot galvan at tallertechnologies dot com> <20160414063908 dot GE12302 at bubble dot grove dot modra dot org>
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.