diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e2779c31..042db3bad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 modifying attachments after `sentry_init` on macOS. ([#1429](https://github.com/getsentry/sentry-native/pull/1429)) + **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)) diff --git a/external/crashpad b/external/crashpad index b160f39e9..8ffbd55a2 160000 --- a/external/crashpad +++ b/external/crashpad @@ -1 +1 @@ -Subproject commit b160f39e9cea7b365d963d9e4774e0fa22c03725 +Subproject commit 8ffbd55a2fd8359c66682f7bff70f5f2f9c72f3d diff --git a/include/sentry.h b/include/sentry.h index 0548fa667..586e34427 100644 --- a/include/sentry.h +++ b/include/sentry.h @@ -42,9 +42,6 @@ * attachment paths will be resolved according to the current working directory * at the time of envelope creation. When adding and removing attachments, they * are matched according to their given `path`. No normalization is performed. - * When using the `crashpad` backend on macOS, the list of attachments that will - * be added at the time of a hard crash will be frozen at the time of - * `sentry_init`, and later modifications will not be reflected. */ #ifndef SENTRY_H_INCLUDED diff --git a/src/backends/sentry_backend_crashpad.cpp b/src/backends/sentry_backend_crashpad.cpp index b8d0069ef..f4ce5b941 100644 --- a/src/backends/sentry_backend_crashpad.cpp +++ b/src/backends/sentry_backend_crashpad.cpp @@ -742,7 +742,8 @@ crashpad_backend_prune_database(sentry_backend_t *backend) crashpad::PruneCrashReportDatabase(data->db, &condition); } -#if defined(SENTRY_PLATFORM_WINDOWS) || defined(SENTRY_PLATFORM_LINUX) +#if defined(SENTRY_PLATFORM_WINDOWS) || defined(SENTRY_PLATFORM_LINUX) \ + || defined(SENTRY_PLATFORM_MACOS) static bool ensure_unique_path(sentry_attachment_t *attachment) { @@ -835,7 +836,8 @@ sentry__backend_new(void) backend->user_consent_changed_func = crashpad_backend_user_consent_changed; backend->get_last_crash_func = crashpad_backend_last_crash; backend->prune_database_func = crashpad_backend_prune_database; -#if defined(SENTRY_PLATFORM_WINDOWS) || defined(SENTRY_PLATFORM_LINUX) +#if defined(SENTRY_PLATFORM_WINDOWS) || defined(SENTRY_PLATFORM_LINUX) \ + || defined(SENTRY_PLATFORM_MACOS) backend->add_attachment_func = crashpad_backend_add_attachment; backend->remove_attachment_func = crashpad_backend_remove_attachment; #endif diff --git a/tests/assertions.py b/tests/assertions.py index b7c0e0a4e..a09f178b0 100644 --- a/tests/assertions.py +++ b/tests/assertions.py @@ -461,11 +461,9 @@ def assert_crashpad_upload(req, expect_attachment=False, expect_view_hierarchy=F assert_event_meta(attachments.event, integration="crashpad") if expect_attachment: assert attachments.cmake_cache > 0 - else: - assert attachments.cmake_cache == -1 - if expect_attachment and (sys.platform == "win32" or sys.platform == "linux"): assert attachments.bytes_bin == b"\xc0\xff\xee" else: + assert attachments.cmake_cache == -1 assert attachments.bytes_bin == None if expect_view_hierarchy: assert_attachment_content_view_hierarchy(attachments.view_hierarchy) diff --git a/tests/test_integration_crashpad.py b/tests/test_integration_crashpad.py index 6bec1c279..9b556ad6d 100644 --- a/tests/test_integration_crashpad.py +++ b/tests/test_integration_crashpad.py @@ -352,18 +352,10 @@ def test_crashpad_wer_crash(cmake, httpserver, run_args): pytest.param( ["attach-after-init"], {}, - marks=pytest.mark.skipif( - sys.platform == "darwin", - reason="crashpad doesn't support dynamic attachments on macOS", - ), ), pytest.param( ["attachment", "attach-after-init", "clear-attachments"], {}, - marks=pytest.mark.skipif( - sys.platform == "darwin", - reason="crashpad doesn't support dynamic attachments on macOS", - ), ), ], )