Hi, here's the original email:
http://lists.nongnu.org/archive/html/libunwind-devel/2014-04/msg00000.html

This "rsp=rbp" situation can occur if you have a small function, which
requires no stack-saved variables, that calls some other function that then
unwinds.  Here's a contrived example:

test.cpp:
int functionThatMightUnwind();

int test() {
    return functionThatMightUnwind() + 1;
}

g++ test.cpp -c -S -o test.s -O1 -fno-omit-frame-pointer

test.s:
.file "test.cpp"
 .text
.globl _Z4testv
.type _Z4testv, @function
_Z4testv:
.LFB0:
.cfi_startproc
pushq %rbp
 .cfi_def_cfa_offset 16
movq %rsp, %rbp
.cfi_offset 6, -16
 .cfi_def_cfa_register 6
call _Z23functionThatMightUnwindv
 addl $1, %eax
leave
.cfi_def_cfa 7, 8
 ret
.cfi_endproc

If functionThatMightUnwind does, in fact, unwind, then the unwinder will
hit the frame for test(), and see that rsp=rbp and judge it to be an
invalid frame.
_______________________________________________
Libunwind-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/libunwind-devel

Reply via email to