New libunwind implementation in libc++abi

New libunwind implementation in libc++abi

Today we are happy to announce that the LLVM family of C++ support libraries is more complete than ever. To enable clang++ to port to platforms that do not have a system unwinder, Apple has contributed their unwinder implementation to LLVM. It is now dual licensed under LLVM and MIT license which is the same license as the rest of LLVM’s runtime support libraries.

The new unwinder has been added to the libcxxabi.llvm.org project. The unwinder has two levels of API. The high level APIs are the Unwind* functions which the cxa_* exception functions in libcxxabi require. The low level APIs are the unw_* functions which are an interface defined by the the old HP libunwind project (which shares no code with this libunwind).

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.

The new unwinder sources are known to build on Darwin, but will need some #defines configured to build on other platforms (patches welcome!). The low level libunwind API was designed to work either in-process (aka local) or to operate on another process (aka remote), but only the local path has been completed, as that is all that C++ exceptions require.

-Nick Kledzik

Posted by Nick Kledzik at 11:26 AM

Labels: C++, new-in-llvm-3.4

發佈了18 篇原創文章 · 獲贊 22 · 訪問量 8900
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章