Files
zoneminder/cmake/Modules/FindLibUnwind.cmake
Isaac Connor 981c6d685e fix: improve crash backtrace on ARM and fix misleading signal info
- Add optional libunwind support for better stack traces on ARM
  (glibc's backtrace() doesn't work well on ARM due to missing
  frame pointers)
- Fix misleading signal info: si_pid/si_uid/si_status are only
  valid for SIGCHLD, not for SIGSEGV/SIGBUS - they were showing
  garbage values (the fault address misinterpreted as PID)
- Add human-readable fault descriptions for SIGSEGV, SIGBUS,
  SIGFPE, and SIGILL signals
- Use clearer terminology in error messages

To enable libunwind on ARM: apt install libunwind-dev

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:09:02 -05:00

37 lines
1.2 KiB
CMake

# FindLibUnwind.cmake
# Find the libunwind library for better stack traces on ARM and other platforms
#
# Sets:
# LIBUNWIND_FOUND - True if libunwind was found
# LIBUNWIND_INCLUDE_DIR - Include directory for libunwind
# LIBUNWIND_LIBRARIES - Libraries to link against
find_path(LIBUNWIND_INCLUDE_DIR
NAMES libunwind.h
PATHS /usr/include /usr/local/include
)
find_library(LIBUNWIND_LIBRARY
NAMES unwind
PATHS /usr/lib /usr/local/lib /usr/lib/arm-linux-gnueabihf /usr/lib/aarch64-linux-gnu
)
# On some platforms, we also need libunwind-generic or platform-specific libs
find_library(LIBUNWIND_GENERIC_LIBRARY
NAMES unwind-generic unwind-arm unwind-aarch64 unwind-x86_64 unwind-x86
PATHS /usr/lib /usr/local/lib /usr/lib/arm-linux-gnueabihf /usr/lib/aarch64-linux-gnu
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibUnwind
REQUIRED_VARS LIBUNWIND_LIBRARY LIBUNWIND_INCLUDE_DIR
)
if(LIBUNWIND_FOUND)
set(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARY})
if(LIBUNWIND_GENERIC_LIBRARY)
list(APPEND LIBUNWIND_LIBRARIES ${LIBUNWIND_GENERIC_LIBRARY})
endif()
mark_as_advanced(LIBUNWIND_INCLUDE_DIR LIBUNWIND_LIBRARY LIBUNWIND_GENERIC_LIBRARY)
endif()