If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Apple Open-Sources Its Unwinder For LLVM

Phoronix: Apple Open-Sources Its Unwinder For LLVM

Earlier this week there was the news of Intel contributing their OpenMP Runtime to LLVM in order to advance the open-source compiler project. Now to end off the week is news that Apple, who continues to invest significantly into LLVM and employs many of the key contributors, has open-sourced their stack unwinder for the project...

Most architectures now use "zero cost" exceptions for C++. The zero cost means there are no extra instructions executed if no exceptions are thrown. But if an exception is thrown, the runtime must consult side tables and figure out how to restore registers and "unwind" from the current stack frame to the catch clause. That ability to modify the stack frames and cause the thread to resume in a catch clause with all registers restored properly is the main purpose of libunwind.

"Unwinding" in general means going back up the stack trace and properly setting up everything - in a debugger, for example, you can go back up the stack trace to see where code is being called from, and at each point you can see local variables that are set in that function rather than what is set at the point where your breakpoint is at.

"Unwinding" in general means going back up the stack trace and properly setting up everything - in a debugger, for example, you can go back up the stack trace to see where code is being called from, and at each point you can see local variables that are set in that function rather than what is set at the point where your breakpoint is at.

Thanks, i had a feeling it was about debuggin but how was unclear to me.

Thanks, i had a feeling it was about debuggin but how was unclear to me.

This isn't about debugging. Walking the stack and unwinding the stack are completely different. This library is not used for walking or inspecting the stack. Unwinding is _not_ required to inspect variables in other stack frames; the debugging information (full DWARF sections) are required for that. Unwinding the stack is a runtime thing languages like C++ need to support catching exceptions efficiently. Unwinding the stack is done is when the runtime invokes local variables' destructors up until the frame containing the invoked exception handler.

Earlier this week there was the news of Intel contributing their OpenMP Runtime to LLVM in order to advance the open-source compiler project. Now to end off the week is news that Apple, who continues to invest significantly into LLVM and employs many of the key contributors, has open-sourced their stack unwinder for the project...

Most certainly it is a complete rewrite and may compliant for C++ 2011/2014 specs within the LLVM/Clang project for all platforms to leverage.

Yeah, frpm the article:

Apple's unwind code uses the same low-level APIs for the unwind functions but do not share code with the old libunwind. Apple pushed their unwinder code into the LLVM libcxxabi sub-project and is under the LLVM and MIT licenses.

Must be a typo, though, since everyone knows that companies never contribute to BSD-licensed code.</sarcasm>

Most certainly it is a complete rewrite and may compliant for C++ 2011/2014 specs within the LLVM/Clang project for all platforms to leverage.

Thanks for the answer.
But it's far from a complete rewrite, in fact if I understand correctly, the only new thing is that Apple has agreed to dual license the code so it can be included in the LLVM's libcxxabi project... but it was already opensource, so this is: