From fb25b5916557d4b1d3c2726c69fa6100a6f44c89 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Mon, 3 Jan 2022 13:05:49 +0100 Subject: [PATCH] feat: Support for fatalError, assert, precondition (#1596) The SDK was not able to retrieve the messages from Swifts fatalError, assert, or precondition. This is fixed now by getting the message from the crashInfoMessage of the binary image of libswiftCore.dylib. Fixes GH-662 Co-authored-by: Dhiogo Brustolin --- CHANGELOG.md | 1 + .../iOS-Swift/Base.lproj/Main.storyboard | 49 +- .../iOS-Swift/iOS-Swift/ViewController.swift | 6 +- .../macOS-Swift/ViewController.swift | 2 +- Sentry.xcodeproj/project.pbxproj | 4 + Sources/Sentry/SentryCrashReportConverter.m | 56 + .../SentryCrash/Recording/SentryCrashReport.c | 8 + .../Recording/SentryCrashReportFields.h | 2 + .../Tools/SentryCrashDynamicLinker.c | 99 +- .../Tools/SentryCrashDynamicLinker.h | 15 + .../SentryCrashPlatformSpecificDefines.h | 45 + .../fatal-error-binary-images-iphone.json | 5887 ++++++++++++++ .../fatal-error-binary-images-mac.json | 5827 ++++++++++++++ .../fatal-error-binary-images-message2.json | 7021 +++++++++++++++++ .../fatal-error-binary-images-simulator.json | 7021 +++++++++++++++++ ...json => fatal-error-notable-adresses.json} | 0 .../SentryDebugImageProviderTests.swift | 4 +- .../SentryKSCrashReportConverterTests.m | 42 +- 18 files changed, 26054 insertions(+), 35 deletions(-) create mode 100644 Sources/SentryCrash/Recording/Tools/SentryCrashPlatformSpecificDefines.h create mode 100644 Tests/Resources/fatal-error-binary-images-iphone.json create mode 100644 Tests/Resources/fatal-error-binary-images-mac.json create mode 100644 Tests/Resources/fatal-error-binary-images-message2.json create mode 100644 Tests/Resources/fatal-error-binary-images-simulator.json rename Tests/Resources/{fatalError.json => fatal-error-notable-adresses.json} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9cd446a027..5c7a6c6ae05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- feat: Support for fatalError, assert, precondition (#1596) - feat: Include unfinished spans in transactions (#1592) - build: Disable NSAssertions for Release Builds (#1545) diff --git a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard index a056ad4064f..0f6caa00127 100644 --- a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard +++ b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard @@ -1,9 +1,9 @@ - + - + @@ -18,7 +18,7 @@ - + - - - + + - +