Skip to content

Commit 82696c4

Browse files
committed
feat(crashpad): support modidying attachments after init on macOS
1 parent a0feb6d commit 82696c4

File tree

4 files changed

+5
-16
lines changed

4 files changed

+5
-16
lines changed

include/sentry.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@
4242
* attachment paths will be resolved according to the current working directory
4343
* at the time of envelope creation. When adding and removing attachments, they
4444
* are matched according to their given `path`. No normalization is performed.
45-
* When using the `crashpad` backend on macOS, the list of attachments that will
46-
* be added at the time of a hard crash will be frozen at the time of
47-
* `sentry_init`, and later modifications will not be reflected.
4845
*/
4946

5047
#ifndef SENTRY_H_INCLUDED

src/backends/sentry_backend_crashpad.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,8 @@ crashpad_backend_prune_database(sentry_backend_t *backend)
742742
crashpad::PruneCrashReportDatabase(data->db, &condition);
743743
}
744744

745-
#if defined(SENTRY_PLATFORM_WINDOWS) || defined(SENTRY_PLATFORM_LINUX)
745+
#if defined(SENTRY_PLATFORM_WINDOWS) || defined(SENTRY_PLATFORM_LINUX) \
746+
|| defined(SENTRY_PLATFORM_MACOS)
746747
static bool
747748
ensure_unique_path(sentry_attachment_t *attachment)
748749
{
@@ -835,7 +836,8 @@ sentry__backend_new(void)
835836
backend->user_consent_changed_func = crashpad_backend_user_consent_changed;
836837
backend->get_last_crash_func = crashpad_backend_last_crash;
837838
backend->prune_database_func = crashpad_backend_prune_database;
838-
#if defined(SENTRY_PLATFORM_WINDOWS) || defined(SENTRY_PLATFORM_LINUX)
839+
#if defined(SENTRY_PLATFORM_WINDOWS) || defined(SENTRY_PLATFORM_LINUX) \
840+
|| defined(SENTRY_PLATFORM_MACOS)
839841
backend->add_attachment_func = crashpad_backend_add_attachment;
840842
backend->remove_attachment_func = crashpad_backend_remove_attachment;
841843
#endif

tests/assertions.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,9 @@ def assert_crashpad_upload(req, expect_attachment=False, expect_view_hierarchy=F
461461
assert_event_meta(attachments.event, integration="crashpad")
462462
if expect_attachment:
463463
assert attachments.cmake_cache > 0
464-
else:
465-
assert attachments.cmake_cache == -1
466-
if expect_attachment and (sys.platform == "win32" or sys.platform == "linux"):
467464
assert attachments.bytes_bin == b"\xc0\xff\xee"
468465
else:
466+
assert attachments.cmake_cache == -1
469467
assert attachments.bytes_bin == None
470468
if expect_view_hierarchy:
471469
assert_attachment_content_view_hierarchy(attachments.view_hierarchy)

tests/test_integration_crashpad.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,18 +352,10 @@ def test_crashpad_wer_crash(cmake, httpserver, run_args):
352352
pytest.param(
353353
["attach-after-init"],
354354
{},
355-
marks=pytest.mark.skipif(
356-
sys.platform == "darwin",
357-
reason="crashpad doesn't support dynamic attachments on macOS",
358-
),
359355
),
360356
pytest.param(
361357
["attachment", "attach-after-init", "clear-attachments"],
362358
{},
363-
marks=pytest.mark.skipif(
364-
sys.platform == "darwin",
365-
reason="crashpad doesn't support dynamic attachments on macOS",
366-
),
367359
),
368360
],
369361
)

0 commit comments

Comments
 (0)