Skip to content

Capture Swift error messages from fatalError, assert, and precondition crashes #522

@ioannisj

Description

@ioannisj

Description

Problem

Swift crashes from fatalError(), assert(), precondition(), and force unwraps currently appear as SIGTRAP signals without the actual Swift error message. While the stack trace and symbolication work correctly, the specific error context is lost.

For example, a crash from:

fatalError("A critical session has expired")

Shows up as a generic SIGTRAP instead of including the message "A critical session has expired".

References

Swift stores crash messages in the __crash_info Mach-O section of libswiftCore.dylib. At crash time, we can read this section to extract the error message.

Sentry: getsentry/sentry-cocoa#1596
Bugsnag: bugsnag/bugsnag-cocoa#948

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions