Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions include/sentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -3510,8 +3510,8 @@ SENTRY_API sentry_metrics_result_t sentry_scope_capture_metric(
/**
* Returns the currently set strategy for the handler.
*
* This option works for the `inproc` backend on `Linux` and `Android`, and for
* the `native` backend on `Linux`.
* This option works for the `inproc` and `native` backends on `Linux` and
* `Android`.
*
* The main use-case is when the Native SDK is used in the context of the
* CLR/Mono runtimes which convert some POSIX signals into managed-code
Expand Down
2 changes: 1 addition & 1 deletion src/backends/native/sentry_crash_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ crash_signal_handler(int signum, siginfo_t *info, void *context)
sentry__enter_crash_handler();
ucontext_t *uctx = (ucontext_t *)context;

# if defined(SENTRY_PLATFORM_LINUX) && !defined(SENTRY_PLATFORM_ANDROID)
# if defined(SENTRY_PLATFORM_LINUX) || defined(SENTRY_PLATFORM_ANDROID)
if (g_handler_strategy == SENTRY_HANDLER_STRATEGY_CHAIN_AT_START
&& signum != SIGABRT && uctx) {
uintptr_t ip = sentry__ucontext_get_ip(uctx);
Expand Down
15 changes: 14 additions & 1 deletion src/backends/sentry_backend_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# include <mach-o/dyld.h>
# include <spawn.h>
# endif
# if defined(SENTRY_PLATFORM_ANDROID)
# include <android/api-level.h>
# endif
#endif

#include <inttypes.h>
Expand Down Expand Up @@ -1006,10 +1009,20 @@ native_backend_startup(
}

sentry_handler_strategy_t strategy =
# if defined(SENTRY_PLATFORM_LINUX) && !defined(SENTRY_PLATFORM_ANDROID)
# if defined(SENTRY_PLATFORM_LINUX) || defined(SENTRY_PLATFORM_ANDROID)
options ? sentry_options_get_handler_strategy(options) :
# endif
SENTRY_HANDLER_STRATEGY_DEFAULT;
# if defined(SENTRY_PLATFORM_ANDROID)
// CHAIN_AT_START invokes the previous handler and expects to regain
// control. On Android API < 26, the old debuggerd daemon kills the
// crashing process via SIGKILL after the chained handler triggers
// it, so we fall back to DEFAULT which chains at the end instead.
if (strategy == SENTRY_HANDLER_STRATEGY_CHAIN_AT_START
&& android_get_device_api_level() < 26) {
strategy = SENTRY_HANDLER_STRATEGY_DEFAULT;
}
# endif
if (sentry__crash_handler_init(state->ipc, strategy, NULL) < 0) {
SENTRY_WARN("failed to initialize crash handler");
# if defined(SENTRY_PLATFORM_UNIX)
Expand Down
Loading