forked from LuaJIT/LuaJIT
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sysprof: replace
backtrace
with libunwind
`backtrace` fails to unwind the host stack in LuaJIT since there are no frame pointers during the VM calls, even with the `-fno-omit-frame-pointer` option set. Sometimes, those failures cause crashes. Moreover, `backtrace` is not signal-safe, which is vital for the sysprof. This commit replaces it with the libunwind-based unwinder, which makes use of additional runtime information to provide robust unwinding even if there are no frame pointers and is signal-safe. Because Tarantool uses its own fiber unwinder, the new default unwinder is not built into bundled builds. Also, this commit enables C API tests, which used to crash with `backtrace`, and disables an assertion regarding the successful backtracer function setting, as it is unnecessary. Part of tarantool/tarantool#781
- Loading branch information
1 parent
7d5901d
commit 90892bc
Showing
6 changed files
with
146 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#[========================================================================[.rst: | ||
FindLibUnwind | ||
-------- | ||
Finds the libunwind library. | ||
Result Variables | ||
^^^^^^^^^^^^^^^^ | ||
``LIBUNWIND_FOUND`` | ||
True if the system has the libunwind library. | ||
``LIBUNWIND_INCLUDE_DIR`` | ||
Include directory needed to use libunwind. | ||
``LIBUNWIND_LIBRARIES`` | ||
Libraries needed to link to libunwind. | ||
Cache Variables | ||
^^^^^^^^^^^^^^^ | ||
``LIBUNWIND_INCLUDE_DIR`` | ||
The directory containing ``libunwind.h``. | ||
``LIBUNWIND_LIBRARIES`` | ||
The paths to the libunwind libraries. | ||
#]========================================================================] | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
find_package(PkgConfig QUIET) | ||
pkg_check_modules(PC_LIBUNWIND QUIET libunwind) | ||
|
||
find_path(LIBUNWIND_INCLUDE_DIR libunwind.h ${PC_LIBUNWIND_INCLUDE_DIRS}) | ||
if(LIBUNWIND_INCLUDE_DIR) | ||
include_directories(${LIBUNWIND_INCLUDE_DIR}) | ||
endif() | ||
|
||
find_library(LIBUNWIND_LIBRARY NAMES unwind PATHS ${PC_LIBUNWIND_LIBRARY_DIRS}) | ||
|
||
set(LIBUNWIND_PLATFORM_LIBRARY_NAME "unwind-${CMAKE_SYSTEM_PROCESSOR}") | ||
find_library(LIBUNWIND_PLATFORM_LIBRARY ${LIBUNWIND_PLATFORM_LIBRARY_NAME} | ||
${PC_LIBUNWIND_LIBRARY_DIRS}) | ||
set(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARY} ${LIBUNWIND_PLATFORM_LIBRARY}) | ||
|
||
find_package_handle_standard_args(LibUnwind | ||
REQUIRED_VARS LIBUNWIND_INCLUDE_DIR LIBUNWIND_LIBRARIES) | ||
|
||
mark_as_advanced(LIBUNWIND_INCLUDE_DIR LIBUNWIND_LIBRARIES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters