libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libunwind-devel] On "Unwinding through 0-length frames"


From: Kevin Modzelewski
Subject: Re: [Libunwind-devel] On "Unwinding through 0-length frames"
Date: Mon, 12 May 2014 16:03:27 -0700

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]