From a0b3d6ad1e6f2edeba1a3f70327a4ae0b0e571dd Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Wed, 29 Dec 2021 11:08:55 +0100 Subject: [PATCH] feat: Support for fatalError, assert, precondition 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 --- .../xcshareddata/xcschemes/iOS-Swift.xcscheme | 2 +- .../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(+), 36 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/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme b/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme index 85036ca1718..7b7d351cf22 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme @@ -41,7 +41,7 @@ - + - + @@ -18,7 +18,7 @@ - + - - - + + - +