Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- If you use a narrow string path interface (for instance, `sentry_options_set_database_path()`) on _Windows_ rather than one of the wide string variants (`sentry_options_set_database_pathw()`), then the expected encoding is now UTF-8. ([#1413](https://github.com/getsentry/sentry-native/pull/1413))

**Features**:

- Support optional usage of stack pointer for captured stack frame ([#1427](https://github.com/getsentry/sentry-native/pull/1427))

**Fixes**:

- Add logs flush on crash. This is not available for macOS with the `crashpad` backend. ([#1404](https://github.com/getsentry/sentry-native/pull/1404))
Expand Down
14 changes: 14 additions & 0 deletions include/sentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -1573,6 +1573,20 @@ SENTRY_API void sentry_options_set_system_crash_reporter_enabled(
SENTRY_API void sentry_options_set_crashpad_wait_for_upload(
sentry_options_t *opts, int wait_for_upload);

/**
* Enables stack capture adjustment for the Crashpad backend.
* When enabled, Crashpad will adjust the stack capture range based on the
* current stack pointer instead of using TEB StackLimit/StackBase values.
*
* This is useful when running under Wine/Proton where the TEB values may
* be incorrect, leading to excessively large stack captures. This is
* disabled by default.
*
* This setting only has an effect when using the `crashpad` backend on Windows.
*/
SENTRY_API void sentry_options_set_crashpad_adjust_stack_capture(
sentry_options_t *opts, int enabled);

/**
* Sets the maximum time (in milliseconds) to wait for the asynchronous
* tasks to end on shutdown before attempting a forced termination.
Expand Down
11 changes: 9 additions & 2 deletions src/backends/sentry_backend_crashpad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,14 +597,21 @@ crashpad_backend_startup(
}
#endif

crashpad::CrashpadInfo *crashpad_info
= crashpad::CrashpadInfo::GetCrashpadInfo();

if (!options->system_crash_reporter_enabled) {
// Disable the system crash reporter. Especially on macOS, it takes
// substantial time *after* crashpad has done its job.
crashpad::CrashpadInfo *crashpad_info
= crashpad::CrashpadInfo::GetCrashpadInfo();
crashpad_info->set_system_crash_reporter_forwarding(
crashpad::TriState::kDisabled);
}

if (options->crashpad_adjust_stack_capture) {
// Enable stack capture adjustment to work around Wine/Proton TEB issues
crashpad_info->set_adjust_stack_capture(crashpad::TriState::kEnabled);
}

return 0;
}

Expand Down
8 changes: 8 additions & 0 deletions src/sentry_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ sentry_options_new(void)
opts->crashpad_wait_for_upload = false;
opts->enable_logging_when_crashed = true;
opts->propagate_traceparent = false;
opts->crashpad_adjust_stack_capture = false;
opts->symbolize_stacktraces =
// AIX doesn't have reliable debug IDs for server-side symbolication,
// and the diversity of Android makes it infeasible to have access to debug
Expand Down Expand Up @@ -488,6 +489,13 @@ sentry_options_set_crashpad_wait_for_upload(
opts->crashpad_wait_for_upload = !!wait_for_upload;
}

void
sentry_options_set_crashpad_adjust_stack_capture(
sentry_options_t *opts, int enabled)
{
opts->crashpad_adjust_stack_capture = !!enabled;
}

void
sentry_options_set_shutdown_timeout(
sentry_options_t *opts, uint64_t shutdown_timeout)
Expand Down
1 change: 1 addition & 0 deletions src/sentry_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct sentry_options_s {
bool crashpad_wait_for_upload;
bool enable_logging_when_crashed;
bool propagate_traceparent;
bool crashpad_adjust_stack_capture;

sentry_attachment_t *attachments;
sentry_run_t *run;
Expand Down
Loading