Skip to content
Open
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
01eb6e1
fix: split inproc with a handler thread
supervacuus Nov 6, 2025
7eb3ca8
prevent warning on write() return value
supervacuus Nov 6, 2025
0cff127
get rid of unsused dispatch parameter
supervacuus Nov 6, 2025
1265007
and another unused return value for write()
supervacuus Nov 6, 2025
b57995c
fix trivial windows compile def issues to run tests locally
supervacuus Nov 7, 2025
5a11ea2
make tests a bit less brittle
supervacuus Nov 7, 2025
b83fc37
ensure that find_cp_path isn't built on windows.
supervacuus Nov 7, 2025
ea527ca
clean up backends
supervacuus Nov 7, 2025
c78f425
eliminate local handler strategy declaration in signal handler
supervacuus Nov 10, 2025
116c4a5
turn off painful warning noise
supervacuus Nov 10, 2025
b4747c7
add libunwind to the CI dependencies
supervacuus Nov 10, 2025
d21c180
ensure we build the example with PIE disabled when doing a static bui…
supervacuus Nov 10, 2025
b0822d3
extend handler crash to windows
supervacuus Nov 10, 2025
8b93cca
further clean of inproc
supervacuus Nov 10, 2025
c4f662a
review and fix/remove remaining TODOs from branch changes
supervacuus Nov 10, 2025
84b3a7a
eliminate multichar warning in crashpad backend when using GCC
supervacuus Nov 10, 2025
ef7b03b
ensure libunwind in benchmark and codeql workflows
supervacuus Nov 10, 2025
6ae25c3
fix Linux ARM64 build (warning in libunwind)
supervacuus Nov 10, 2025
a0195db
provide an x86_64 ucontext stackwalker for macOS
supervacuus Nov 10, 2025
8a63e64
bump lower-end GCC to 10.5.0
supervacuus Nov 10, 2025
c1fd0a8
remove obsolete ASAN patch from CI
supervacuus Nov 10, 2025
7c97dbb
ensure lower-end GCC also finds libunwind
supervacuus Nov 10, 2025
524d8b4
disable LTO for the example too
supervacuus Nov 10, 2025
1c378c3
use clang diagnostics only for __clang__
supervacuus Nov 10, 2025
4912a82
install 32-bit libunwind package for 32-bit Linux CI test config
supervacuus Nov 10, 2025
0c24c4f
fix weird linker asymmetry
supervacuus Nov 10, 2025
70dd979
provide empty path-suffix so that CMake can find libunwind on platfor…
supervacuus Nov 10, 2025
4449859
remove can_lock mechanism from the handler block API
supervacuus Nov 10, 2025
4ce7940
use PRIx64 without ull cast in sentry__value_new_addr()
supervacuus Nov 10, 2025
8954928
fix off-by-one bug when returning the trace length after walking the …
supervacuus Nov 10, 2025
e633f26
clean up cmake configure stage in pytest
supervacuus Nov 11, 2025
f7f4b4e
skip tests if zlib wasn't found during cmake configure stage
supervacuus Nov 11, 2025
66618cd
fix stupid comparison error that led to all failing Linux tests
supervacuus Nov 11, 2025
3432dea
exclude `logger_level` from transport unit tests.
supervacuus Nov 11, 2025
c0aa399
let find_path search the library architecture
supervacuus Nov 11, 2025
96afd3d
support i386 multilib on Ubuntu/Debian
supervacuus Nov 11, 2025
bea2b65
add 32-bit lzma package to Linux 32-bit build
supervacuus Nov 11, 2025
dc117e5
typo
supervacuus Nov 11, 2025
14af96d
make even more elaborate multilib triplet and suffice handling based …
supervacuus Nov 11, 2025
2e921a0
be even more careful wrt to max_frames in the fp walker and check on …
supervacuus Nov 11, 2025
e3643c7
eliminate the non-atomic access to g_handler_thread_ready from has_ha…
supervacuus Nov 11, 2025
3ffe195
bring spinlock and pageallocator into the atomic fold
supervacuus Nov 11, 2025
7eff2d1
fix: add GNU-stack note to crashpad_info_note.S
supervacuus Nov 11, 2025
01061fd
update crashpad
supervacuus Nov 11, 2025
fd58403
remove deprecated macOS 13 and replace it with macOS 26
supervacuus Nov 11, 2025
e8a393e
update crashpad after merging to getsentry
supervacuus Nov 12, 2025
b197e1e
simplify signal handler blocker by leaving and entering around the di…
supervacuus Nov 12, 2025
4ff5a6e
remove left-over handler switch
supervacuus Nov 12, 2025
192e033
reintroduce handling thread into cleaned up signal blocker for the re…
supervacuus Nov 12, 2025
2ef97e1
add valgrind suppression for false-positive deep in libunwind
supervacuus Nov 12, 2025
d72fb87
track failing ARM64/Linux clang-tsan build across available toolchain…
supervacuus Nov 12, 2025
3e51843
let valgrind match any frame between the libunwind obj matcher and th…
supervacuus Nov 13, 2025
21697c9
move the check for a crashed handler thread into dispatch_ucontext() …
supervacuus Nov 13, 2025
9388b49
isolate the libunwind walker as a tsan cause in CI
supervacuus Nov 13, 2025
37477ba
exclude walker variables to prevent unused variables Werror
supervacuus Nov 13, 2025
fcee5a5
isolation pinpoint fine, but only exclude when using ucontext.
supervacuus Nov 13, 2025
eda314b
silence clang-20 warning for crashpad
supervacuus Nov 13, 2025
89d95d2
update `crashpad` after merging to `getsentry`
supervacuus Nov 14, 2025
4d5114b
we know the walk crashes in aarch64 tsan, now introduce stack bound r…
supervacuus Nov 14, 2025
13dfdbc
format
supervacuus Nov 14, 2025
72612cf
add unistd.h for musl
supervacuus Nov 14, 2025
df92728
eliminate the logs and ensure we never walk the callers if the SP is …
supervacuus Nov 14, 2025
bdf6b25
format
supervacuus Nov 14, 2025
7e4e1fa
fix invalid `find_mem_range()` return value check
supervacuus Nov 14, 2025
0966118
remove macOS left-overs in the `libbacktrace` unwinder module
supervacuus Nov 14, 2025
549293a
extract fp_walk for the macOS unwinder so we can also provide a stack…
supervacuus Nov 14, 2025
be0b245
for targets that must use `backtrace()` as an unwinder we fall back u…
supervacuus Nov 14, 2025
1c8dbf9
instead of spinning on atomic in the signal-handler add ACK pipe/sema…
supervacuus Nov 17, 2025
1d85149
actually check the FP against mach_vm_region bounds in the validation
supervacuus Nov 17, 2025
206294a
Merge branch 'master' into fix/split_inproc_handler_thread
supervacuus Nov 17, 2025
cd130d3
check mach_vm_region bounds only on macOS builds
supervacuus Nov 17, 2025
9e9d933
ensure we conditionally return on acquire in block_for_signal_handler
supervacuus Nov 18, 2025
6b6e545
move chain-first strategy completely outside the signal handler reent…
supervacuus Nov 18, 2025
a011327
update changelog
supervacuus Nov 18, 2025
fdc82a8
Merge branch 'master' into fix/split_inproc_handler_thread
supervacuus Nov 20, 2025
4a62c6e
add inproc module-level docs for developers
supervacuus Nov 20, 2025
7d6142f
fix: return the number of frames when doing a stack walk from an FP d…
supervacuus Nov 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt update
sudo apt install -y libcurl4-openssl-dev
sudo apt install -y libcurl4-openssl-dev libunwind-dev

- name: Benchmark
shell: bash
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
fail-fast: false
matrix:
include:
# toolchain per runner-image availability:
# toolchain per runner-image availability:
# ubuntu 22.04
# GCC: 9-12
# clang: 11-15
Expand Down Expand Up @@ -140,6 +140,10 @@ jobs:
os: macos-14
ERROR_ON_WARNINGS: 1
SYSTEM_VERSION_COMPAT: 0
- name: macOS 26 (xcode llvm)
os: macos-26
ERROR_ON_WARNINGS: 1
SYSTEM_VERSION_COMPAT: 0
- name: macOS 14 (xcode llvm + universal)
os: macos-14
ERROR_ON_WARNINGS: 1
Expand Down Expand Up @@ -222,7 +226,7 @@ jobs:
run: |
sudo apt update
# Install common dependencies
sudo apt install cmake llvm valgrind zlib1g-dev libcurl4-openssl-dev
sudo apt install cmake llvm valgrind zlib1g-dev libcurl4-openssl-dev libunwind-dev
# For GCC, install both gcc-X and g++-X. For Clang, only install clang-X (includes C++ compiler)
if [[ "$CC" == gcc-* ]]; then
sudo apt install "${CC}" "${CXX}"
Expand Down Expand Up @@ -253,19 +257,14 @@ jobs:
run: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install cmake "${CC}-multilib" "${CXX}-multilib" zlib1g-dev:i386 libssl-dev:i386 libcurl4-openssl-dev:i386
sudo apt install cmake "${CC}-multilib" "${CXX}-multilib" zlib1g-dev:i386 libssl-dev:i386 libcurl4-openssl-dev:i386 libunwind-dev:i386 liblzma-dev:i386

- name: Installing Alpine Linux Dependencies
if: ${{ contains(matrix.container, 'alpine') }}
run: |
apk update
apk add curl-dev libunwind-dev libunwind-static xz-dev

# https://github.com/actions/runner-images/issues/9491
- name: Decrease vm.mmap_rnd_bit to prevent ASLR ASAN issues
if: ${{ runner.os == 'Linux' && contains(env['RUN_ANALYZER'], 'asan') }}
run: sudo sysctl vm.mmap_rnd_bits=28

- name: Installing CodeChecker
if: ${{ contains(env['RUN_ANALYZER'], 'code-checker') }}
run: sudo snap install codechecker --classic
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Installing Linux Dependencies
run: |
sudo apt update
sudo apt install cmake clang-14 clang-tools llvm kcov g++-12 valgrind zlib1g-dev libcurl4-openssl-dev
sudo apt install cmake clang-14 clang-tools llvm kcov g++-12 valgrind zlib1g-dev libcurl4-openssl-dev libunwind-dev

- if: matrix.language == 'java'
name: Setup Java Version
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@

## Unreleased

**Breaking**:

- inproc(Linux): the `inproc` backend on Linux now depends on "nognu" `libunwind`. ([#1446](https://github.com/getsentry/sentry-native/pull/1446))
- inproc: since we split `inproc` into signal-handler/UEF part and a separate handler thread, `before_send` and `on_crash` could be called from other threads than the one that crashed. While this was never part of the contract, if your code relies on this, it will no longer work. ([#1446](https://github.com/getsentry/sentry-native/pull/1446))

**Features**:

- Add custom attributes API for logs. When `logs_with_attributes` is set to `true`, treats the first `varg` passed into `sentry_logs_X(message,...)` as a `sentry_value_t` object of attributes. ([#1435](https://github.com/getsentry/sentry-native/pull/1435))
- Add runtime API to query user consent requirement. ([#1443](https://github.com/getsentry/sentry-native/pull/1443))
- Add logs flush on `sentry_flush()`. ([#1434](https://github.com/getsentry/sentry-native/pull/1434))

**Fixes**:

- Make the signal-handler synchronization fully atomic to fix rare race scenarios. ([#1446](https://github.com/getsentry/sentry-native/pull/1446))
- Reintroduce an FP-based stack-walker for macOS that can start from a user context. This also makes `inproc` backend functional again on macOS 13+. ([#1446](https://github.com/getsentry/sentry-native/pull/1446))
- Split the `inproc` signal handler (and UEF on Windows) into a safe handler part and an "unsafe" handler thread. This minimizes exposure to undefined behavior inside the signal handler. ([#1446](https://github.com/getsentry/sentry-native/pull/1446))

## 0.12.1

**Fixes**:
Expand Down
74 changes: 58 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,6 @@ if(LINUX)
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -m32 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE")
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
endif()

execute_process(
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
OUTPUT_VARIABLE TARGET_TRIPLET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(TARGET_TRIPLET MATCHES "musl")
set(MUSL TRUE)
endif()
endif()

# CMAKE_POSITION_INDEPENDENT_CODE must be set BEFORE adding any libraries (including subprojects)
Expand Down Expand Up @@ -266,9 +257,12 @@ endif()

if(ANDROID)
set(SENTRY_WITH_LIBUNWINDSTACK TRUE)
elseif(MUSL)
elseif(LINUX)
set(SENTRY_WITH_LIBUNWIND TRUE)
elseif(APPLE)
set(SENTRY_WITH_LIBUNWIND_MAC TRUE)
elseif(NOT WIN32 AND NOT PROSPERO)
# this should never be true, but we keep it as fallback
set(SENTRY_WITH_LIBBACKTRACE TRUE)
endif()

Expand Down Expand Up @@ -621,12 +615,30 @@ endif()
if(SENTRY_WITH_LIBUNWIND)
if(LINUX)
option(SENTRY_LIBUNWIND_SHARED "Link to shared libunwind" ${SENTRY_BUILD_SHARED_LIBS})
find_path(LIBUNWIND_INCLUDE_DIR libunwind.h PATH_SUFFIXES libunwind REQUIRED)

# ensure suffix and search paths for include and library search (specifically for multilib)
if(SENTRY_BUILD_FORCE32)
set(_unwind_triplet "i386-linux-gnu")
set(_i386_libpaths /usr/lib/i386-linux-gnu /lib/i386-linux-gnu /usr/lib32 /lib32)
else()
set(_unwind_triplet "${CMAKE_LIBRARY_ARCHITECTURE}")
endif()

find_path(LIBUNWIND_INCLUDE_DIR libunwind.h
PATH_SUFFIXES
${_unwind_triplet}
libunwind # some distros put the libunwind headers into a subdirectory
REQUIRED)
if(SENTRY_LIBUNWIND_SHARED)
find_library(LIBUNWIND_LIBRARIES unwind REQUIRED)
find_library(LIBUNWIND_LIBRARIES unwind PATH_SUFFIXES ${_unwind_triplet} REQUIRED)
else()
find_library(LIBUNWIND_LIBRARIES libunwind.a REQUIRED)
find_library(LZMA_LIBRARY lzma)
find_library(LIBUNWIND_LIBRARIES libunwind.a PATH_SUFFIXES ${_unwind_triplet} REQUIRED)
if(SENTRY_BUILD_FORCE32)
find_library(LZMA_LIBRARY lzma PATHS ${_i386_libpaths} NO_DEFAULT_PATH)
else()
find_library(LZMA_LIBRARY lzma PATH_SUFFIXES ${_unwind_triplet})
endif()

if(LZMA_LIBRARY)
list(APPEND LIBUNWIND_LIBRARIES ${LZMA_LIBRARY})
endif()
Expand Down Expand Up @@ -685,6 +697,15 @@ if(SENTRY_BACKEND_CRASHPAD)
$<BUILD_INTERFACE:crashpad::client>
$<INSTALL_INTERFACE:sentry_crashpad::client>
)

# ignore #include_next <signal.h> warning being a GCC extension via pedantic
if (LINUX)
target_include_directories(sentry
SYSTEM PRIVATE
external/crashpad/compat/linux
)
endif()

install(EXPORT crashpad_export NAMESPACE sentry_crashpad:: FILE sentry_crashpad-targets.cmake
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
)
Expand Down Expand Up @@ -813,6 +834,21 @@ if(SENTRY_BUILD_EXAMPLES)
# Disable all optimizations for the `sentry_example` in gcc/clang. This allows us to keep crash triggers simple.
# The effects besides reproducible code-gen across compiler versions, will be negligible for build- and runtime.
target_compile_options(sentry_example PRIVATE $<BUILD_INTERFACE:-O0>)

# Most Linux distros will build executables with PIE. However, if we build a static library, not all static
# dependencies being packaged with the same distro, are built with PIC enabled. This will lead `ld` to error on
# relocation data, thus failing the build/tests. There is no need to build the example with PIE enabled.
# Similarly, LTO must be disabled since the static library archive might have different LTO bytecode version.
if (LINUX AND NOT SENTRY_BUILD_SHARED_LIBS)
target_link_options(sentry_example PRIVATE
-no-pie
-fno-lto
)
target_compile_options(sentry_example PRIVATE
-fno-pie
-fno-lto
)
endif()
endif()

# set static runtime if enabled
Expand All @@ -824,11 +860,17 @@ if(SENTRY_BUILD_EXAMPLES)
set_target_properties(sentry_example PROPERTIES FOLDER ${SENTRY_FOLDER})
endif()

if(CMAKE_GENERATOR STREQUAL "Xcode")
set(SENTRY_FIXTURE_OUTPUT_DIR "$<TARGET_BUNDLE_DIR:sentry_example>/..")
else()
set(SENTRY_FIXTURE_OUTPUT_DIR "$<TARGET_FILE_DIR:sentry_example>")
endif()

add_custom_command(TARGET sentry_example POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/tests/fixtures/minidump.dmp" "$<TARGET_FILE_DIR:sentry_example>/minidump.dmp")
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/tests/fixtures/minidump.dmp" "${SENTRY_FIXTURE_OUTPUT_DIR}/minidump.dmp")

add_custom_command(TARGET sentry_example POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/tests/fixtures/view-hierarchy.json" "$<TARGET_FILE_DIR:sentry_example>/view-hierarchy.json")
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/tests/fixtures/view-hierarchy.json" "${SENTRY_FIXTURE_OUTPUT_DIR}/view-hierarchy.json")
endif()

# Limit the exported symbols when sentry is built as a shared library to those with a "sentry_" prefix:
Expand Down
10 changes: 10 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ elseif(SENTRY_BACKEND_NONE)
endif()

# unwinder
sentry_target_sources_cwd(sentry
unwinder/sentry_unwinder.h
)
if(SENTRY_WITH_LIBBACKTRACE)
target_compile_definitions(sentry PRIVATE SENTRY_WITH_UNWINDER_LIBBACKTRACE)
sentry_target_sources_cwd(sentry
Expand All @@ -167,6 +170,13 @@ if(SENTRY_WITH_LIBUNWIND)
)
endif()

if(SENTRY_WITH_LIBUNWIND_MAC)
target_compile_definitions(sentry PRIVATE SENTRY_WITH_UNWINDER_LIBUNWIND_MAC)
sentry_target_sources_cwd(sentry
unwinder/sentry_unwinder_libunwind_mac.c
)
endif()

if(SENTRY_WITH_LIBUNWINDSTACK)
target_compile_definitions(sentry PRIVATE SENTRY_WITH_UNWINDER_LIBUNWINDSTACK)
sentry_target_sources_cwd(sentry
Expand Down
16 changes: 8 additions & 8 deletions src/backends/sentry_backend_breakpad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,22 +261,22 @@ breakpad_backend_startup(
&& defined(SENTRY_THREAD_STACK_GUARANTEE_AUTO_INIT)
sentry__set_default_thread_stack_guarantee();
# endif
backend->data = new google_breakpad::ExceptionHandler(
backend->data = new (std::nothrow) google_breakpad::ExceptionHandler(
current_run_folder->path_w, nullptr, breakpad_backend_callback, nullptr,
google_breakpad::ExceptionHandler::HANDLER_EXCEPTION);
#elif defined(SENTRY_PLATFORM_MACOS)
// If process is being debugged and there are breakpoints set it will cause
// task_set_exception_ports to crash the whole process and debugger
backend->data = new google_breakpad::ExceptionHandler(
current_run_folder->path, nullptr, breakpad_backend_callback, nullptr,
!IsDebuggerActive(), nullptr);
backend->data = new (std::nothrow)
google_breakpad::ExceptionHandler(current_run_folder->path, nullptr,
breakpad_backend_callback, nullptr, !IsDebuggerActive(), nullptr);
#elif defined(SENTRY_PLATFORM_IOS)
backend->data
= new google_breakpad::ExceptionHandler(current_run_folder->path,
nullptr, breakpad_backend_callback, nullptr, true, nullptr);
backend->data = new (std::nothrow)
google_breakpad::ExceptionHandler(current_run_folder->path, nullptr,
breakpad_backend_callback, nullptr, true, nullptr);
#else
google_breakpad::MinidumpDescriptor descriptor(current_run_folder->path);
backend->data = new google_breakpad::ExceptionHandler(
backend->data = new (std::nothrow) google_breakpad::ExceptionHandler(
descriptor, nullptr, breakpad_backend_callback, nullptr, true, -1);
#endif
return backend->data == nullptr;
Expand Down
25 changes: 11 additions & 14 deletions src/backends/sentry_backend_crashpad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ extern "C" {
#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
# pragma GCC diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
# pragma GCC diagnostic ignored "-Wfour-char-constants"
# pragma GCC diagnostic ignored "-Wmultichar"
#elif defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4100) // unreferenced formal parameter
Expand Down Expand Up @@ -310,11 +309,11 @@ flush_scope_from_handler(

# ifdef SENTRY_PLATFORM_WINDOWS
static bool
sentry__crashpad_handler(EXCEPTION_POINTERS *ExceptionInfo)
crashpad_handler(EXCEPTION_POINTERS *ExceptionInfo)
{
# else
static bool
sentry__crashpad_handler(int signum, siginfo_t *info, ucontext_t *user_context)
crashpad_handler(int signum, siginfo_t *info, ucontext_t *user_context)
{
sentry__page_allocator_enable();
sentry__enter_signal_handler();
Expand Down Expand Up @@ -540,7 +539,7 @@ crashpad_backend_startup(
// Initialize database first, flushing the consent later on as part of
// `sentry_init` will persist the upload flag.
data->db = crashpad::CrashReportDatabase::Initialize(database).release();
data->client = new crashpad::CrashpadClient;
data->client = new (std::nothrow) crashpad::CrashpadClient;
char *minidump_url
= sentry__dsn_get_minidump_url(options->dsn, options->user_agent);
if (minidump_url) {
Expand Down Expand Up @@ -581,8 +580,7 @@ crashpad_backend_startup(
}

#if defined(SENTRY_PLATFORM_LINUX) || defined(SENTRY_PLATFORM_WINDOWS)
crashpad::CrashpadClient::SetFirstChanceExceptionHandler(
&sentry__crashpad_handler);
crashpad::CrashpadClient::SetFirstChanceExceptionHandler(&crashpad_handler);
#endif
#ifdef SENTRY_PLATFORM_LINUX
// Crashpad was recently changed to register its own signal stack, which for
Expand All @@ -593,7 +591,7 @@ crashpad_backend_startup(
if (g_signal_stack.ss_sp) {
g_signal_stack.ss_size = SIGNAL_STACK_SIZE;
g_signal_stack.ss_flags = 0;
sigaltstack(&g_signal_stack, 0);
sigaltstack(&g_signal_stack, nullptr);
}
#endif

Expand Down Expand Up @@ -632,9 +630,9 @@ crashpad_backend_shutdown(sentry_backend_t *backend)

#ifdef SENTRY_PLATFORM_LINUX
g_signal_stack.ss_flags = SS_DISABLE;
sigaltstack(&g_signal_stack, 0);
sigaltstack(&g_signal_stack, nullptr);
sentry_free(g_signal_stack.ss_sp);
g_signal_stack.ss_sp = NULL;
g_signal_stack.ss_sp = nullptr;
#endif
}

Expand Down Expand Up @@ -745,8 +743,8 @@ crashpad_backend_prune_database(sentry_backend_t *backend)
// large.
data->db->CleanDatabase(60 * 60 * 24 * 2);
crashpad::BinaryPruneCondition condition(crashpad::BinaryPruneCondition::OR,
new crashpad::DatabaseSizePruneCondition(1024 * 8),
new crashpad::AgePruneCondition(2));
new (std::nothrow) crashpad::DatabaseSizePruneCondition(1024 * 8),
new (std::nothrow) crashpad::AgePruneCondition(2));
crashpad::PruneCrashReportDatabase(data->db, &condition);
}

Expand Down Expand Up @@ -825,12 +823,11 @@ sentry__backend_new(void)
}
memset(backend, 0, sizeof(sentry_backend_t));

auto *data = SENTRY_MAKE(crashpad_state_t);
auto *data = new (std::nothrow) crashpad_state_t {};
if (!data) {
sentry_free(backend);
return nullptr;
}
memset(data, 0, sizeof(crashpad_state_t));
data->scope_flush = false;
data->crashed = false;

Expand Down
Loading
Loading