diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ed7cd68b49..91da52f495e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Added breadcrumb.origin private field (#4358) - Custom redact modifier for SwiftUI (#4362) +- Add support for arm64e (#3398) - Add mergeable libraries support to dynamic libraries (#4381) ### Improvements diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index 6b3bc884795..531e1489808 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -101,6 +101,7 @@ D8AE48CF2C57E0BD0092A2A6 /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8AE48C82C57DC2F0092A2A6 /* WebViewController.swift */; }; D8B56CF0273A8D97004DF238 /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630853322440C44F00DDE4CE /* Sentry.framework */; }; D8B56CF1273A8D97004DF238 /* Sentry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 630853322440C44F00DDE4CE /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + D8BC843E2B021C5200A662B7 /* SwiftUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4F33F7271EBD2500C8591E /* SwiftUIView.swift */; }; D8C33E1F29FBB1F70071B75A /* UIEventBreadcrumbsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8C33E1E29FBB1F70071B75A /* UIEventBreadcrumbsController.swift */; }; D8C33E2629FBB8D90071B75A /* UIEventBreadcrumbTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8C33E2529FBB8D90071B75A /* UIEventBreadcrumbTests.swift */; }; D8D7BB4A2750067900044146 /* UIAssert.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D7BB492750067900044146 /* UIAssert.swift */; }; @@ -1146,6 +1147,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + D8BC843E2B021C5200A662B7 /* SwiftUIView.swift in Sources */, D8832B1A2AF5000F00C522B0 /* TopViewControllerInspector.swift in Sources */, D8AE48CF2C57E0BD0092A2A6 /* WebViewController.swift in Sources */, 84BA71F22C8F73FD0045B828 /* DSNDisplayViewController.swift in Sources */, @@ -1417,7 +1419,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 8.37.0-beta.1; + MARKETING_VERSION = "8.37.0-beta.1"; PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.sample.iOS-Swift"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = "match Development io.sentry.sample.iOS-Swift"; @@ -1446,7 +1448,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 8.37.0-beta.1; + MARKETING_VERSION = "8.37.0-beta.1"; PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.sample.iOS-Swift"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = "match AppStore io.sentry.sample.iOS-Swift"; @@ -1730,11 +1732,16 @@ 84D4FE8528ECD1EA00EDAAFE /* Test */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64e, + ); ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "iOS13-Swift/iOS13-Swift.entitlements"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 97JCY7859U; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "iOS13-Swift/Info.plist"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; @@ -1762,8 +1769,10 @@ 84D4FE8628ECD1EA00EDAAFE /* Test */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 97JCY7859U; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -1774,6 +1783,7 @@ MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.Sentry.iOS13-SwiftTests"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_EMIT_LOC_STRINGS = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -1955,11 +1965,16 @@ 84D4FE8D28ECD1ED00EDAAFE /* TestCI */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64e, + ); ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "iOS13-Swift/iOS13-Swift.entitlements"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 97JCY7859U; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "iOS13-Swift/Info.plist"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; @@ -1987,8 +2002,10 @@ 84D4FE8E28ECD1ED00EDAAFE /* TestCI */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 97JCY7859U; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -1999,6 +2016,7 @@ MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.Sentry.iOS13-SwiftTests"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_EMIT_LOC_STRINGS = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -2009,11 +2027,16 @@ D8269A4A274C096000BD5BD5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64e, + ); ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "iOS13-Swift/iOS13-Swift.entitlements"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 97JCY7859U; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "iOS13-Swift/Info.plist"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; @@ -2041,11 +2064,16 @@ D8269A4B274C096000BD5BD5 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64e, + ); ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "iOS13-Swift/iOS13-Swift.entitlements"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 97JCY7859U; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "iOS13-Swift/Info.plist"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; @@ -2095,7 +2123,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 8.37.0-beta.1; + MARKETING_VERSION = "8.37.0-beta.1"; PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.sample.iOS-Swift.Clip"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = "match Development io.sentry.sample.iOS-Swift.Clip"; @@ -2130,7 +2158,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 8.37.0-beta.1; + MARKETING_VERSION = "8.37.0-beta.1"; PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.sample.iOS-Swift.Clip"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = "match AppStore io.sentry.sample.iOS-Swift.Clip"; @@ -2143,8 +2171,10 @@ D85DAA52274C244F004DF43C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 97JCY7859U; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -2155,6 +2185,7 @@ MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.Sentry.iOS13-SwiftTests"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_EMIT_LOC_STRINGS = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -2165,8 +2196,10 @@ D85DAA53274C244F004DF43C /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 97JCY7859U; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -2177,6 +2210,7 @@ MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = "io.sentry.Sentry.iOS13-SwiftTests"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_EMIT_LOC_STRINGS = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; diff --git a/Samples/iOS-Swift/iOS13-Swift/AppDelegate.swift b/Samples/iOS-Swift/iOS13-Swift/AppDelegate.swift index dac028ce399..2032de1ea5a 100644 --- a/Samples/iOS-Swift/iOS13-Swift/AppDelegate.swift +++ b/Samples/iOS-Swift/iOS13-Swift/AppDelegate.swift @@ -21,10 +21,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate { SentrySDK.start { options in options.dsn = dsn options.debug = true - options.tracesSampleRate = 1.0 - if ProcessInfo.processInfo.arguments.contains("--io.sentry.profiling.enable") { - options.profilesSampleRate = 1 + if #available(iOS 15.0, *) { + options.enableMetricKit = true } + // Sampling 100% - In Production you probably want to adjust this + options.tracesSampleRate = 1.0 + options.sessionTrackingIntervalMillis = 5_000 + options.profilesSampleRate = 1.0 + options.attachScreenshot = true + options.attachViewHierarchy = true + options.environment = "test-app" + options.enableTimeToFullDisplayTracing = true options.initialScope = { scope in scope.injectGitInformation() return scope diff --git a/Samples/iOS-Swift/iOS13-SwiftTests/LaunchUITest.swift b/Samples/iOS-Swift/iOS13-SwiftTests/LaunchUITest.swift index 7eb93026a9c..2b07ed9904e 100644 --- a/Samples/iOS-Swift/iOS13-SwiftTests/LaunchUITest.swift +++ b/Samples/iOS-Swift/iOS13-SwiftTests/LaunchUITest.swift @@ -25,6 +25,11 @@ class LaunchUITests: XCTestCase { XCTAssertTrue(app.staticTexts["SwiftUI!"].waitForExistence(timeout: timeout), "SwiftUI not loaded.") } + func testNavigationTransaction() { + app.buttons["Test Navigation Transaction"].tap() + XCTAssertEqual(app.state, .runningForeground) + } + private func waitForExistenceOfMainScreen() { XCTAssertTrue(app.buttons["captureMessage"].waitForExistence(timeout: timeout), "Home Screen doesn't exist.") } diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index 70964f92086..9a77b69818e 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -5402,7 +5402,6 @@ GCC_WARN_SHADOW = YES; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)"; - ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-DCARTHAGE_$(CARTHAGE)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -5440,7 +5439,6 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = "-DCARTHAGE_$(CARTHAGE)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; @@ -5600,7 +5598,6 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-DCARTHAGE_$(CARTHAGE)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -5727,7 +5724,6 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-DCARTHAGE_$(CARTHAGE)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -5776,7 +5772,6 @@ baseConfigurationReference = D8199DCF29376FF40074249E /* SentrySwiftUI.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; CLANG_ENABLE_MODULES = YES; @@ -6207,7 +6202,6 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = "-DCARTHAGE_$(CARTHAGE)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; @@ -6437,7 +6431,6 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-DCARTHAGE_$(CARTHAGE)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; diff --git a/Sources/Configuration/Sentry.xcconfig b/Sources/Configuration/Sentry.xcconfig index 894aa15beeb..5bda006b0a1 100644 --- a/Sources/Configuration/Sentry.xcconfig +++ b/Sources/Configuration/Sentry.xcconfig @@ -19,3 +19,5 @@ PRODUCT_MODULE_NAME = $(PRODUCT_MODULE_NAME_$(CONFIGURATION)) PRODUCT_NAME = $(PRODUCT_MODULE_NAME) PRODUCT_BUNDLE_IDENTIFIER = io.sentry.$(PRODUCT_MODULE_NAME) MODULEMAP_FILE = $(SRCROOT)/Sources/Resources/$(PRODUCT_MODULE_NAME_$(CONFIGURATION)).modulemap +ARCHS = $(ARCHS_STANDARD) arm64e +ARCHS[sdk=*simulator] = $(ARCHS_STANDARD) diff --git a/Sources/Configuration/SentrySwiftUI.xcconfig b/Sources/Configuration/SentrySwiftUI.xcconfig index 6c76b66635e..1c0ebcc9373 100644 --- a/Sources/Configuration/SentrySwiftUI.xcconfig +++ b/Sources/Configuration/SentrySwiftUI.xcconfig @@ -14,3 +14,5 @@ OTHER_LDFLAGS_Test = -framework Sentry OTHER_LDFLAGS_TestCI = -framework Sentry OTHER_LDFLAGS_Release = -framework Sentry OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(CONFIGURATION)) +ARCHS = $(ARCHS_STANDARD) arm64e +ARCHS[sdk=*simulator] = $(ARCHS_STANDARD) diff --git a/Sources/Sentry/SentryBacktrace.cpp b/Sources/Sentry/SentryBacktrace.cpp index 32cb54e27d2..1b82dacb11b 100644 --- a/Sources/Sentry/SentryBacktrace.cpp +++ b/Sources/Sentry/SentryBacktrace.cpp @@ -110,8 +110,8 @@ namespace profiling { } void - enumerateBacktracesForAllThreads(const std::function &f, - const std::shared_ptr &cache) + enumerateBacktracesForAllThreads( + const std::function &f, ThreadMetadataCache *cache) { const auto pair = ThreadHandle::allExcludingCurrent(); for (const auto &thread : pair.first) { diff --git a/Sources/Sentry/SentryProfiler.mm b/Sources/Sentry/SentryProfiler.mm index a46f1a73373..77c4e52c85a 100644 --- a/Sources/Sentry/SentryProfiler.mm +++ b/Sources/Sentry/SentryProfiler.mm @@ -56,7 +56,7 @@ } @implementation SentryProfiler { - std::shared_ptr _samplingProfiler; + std::unique_ptr _samplingProfiler; } + (void)load @@ -165,7 +165,7 @@ - (void)start SentryProfilerState *const state = [[SentryProfilerState alloc] init]; self.state = state; - _samplingProfiler = std::make_shared( + _samplingProfiler = std::make_unique( [state](auto &backtrace) { Backtrace backtraceCopy = backtrace; backtraceCopy.absoluteTimestamp diff --git a/Sources/Sentry/SentrySamplingProfiler.cpp b/Sources/Sentry/SentrySamplingProfiler.cpp index ecba14ae855..1f006e12f04 100644 --- a/Sources/Sentry/SentrySamplingProfiler.cpp +++ b/Sources/Sentry/SentrySamplingProfiler.cpp @@ -21,7 +21,7 @@ namespace profiling { mach_port_t port; clock_serv_t clock; mach_timespec_t delaySpec; - std::shared_ptr cache; + ThreadMetadataCache *cache; std::function callback; std::atomic_uint64_t &numSamples; std::function onThreadStart; @@ -77,7 +77,7 @@ namespace profiling { SamplingProfiler::SamplingProfiler( std::function callback, std::uint32_t samplingRateHz) : callback_(std::move(callback)) - , cache_(std::make_shared()) + , cache_(std::make_unique()) , isInitialized_(false) , isSampling_(false) , port_(0) @@ -139,8 +139,8 @@ namespace profiling { SENTRY_ASYNC_SAFE_LOG_ERRNO_RETURN(pthread_attr_setschedparam(&attr, ¶m)); } - const auto params = new SamplingThreadParams { port_, clock_, delaySpec_, cache_, callback_, - std::ref(numSamples_), std::move(onThreadStart) }; + const auto params = new SamplingThreadParams { port_, clock_, delaySpec_, cache_.get(), + callback_, std::ref(numSamples_), std::move(onThreadStart) }; if (SENTRY_ASYNC_SAFE_LOG_ERRNO_RETURN( pthread_create(&thread_, &attr, samplingThreadMain, params)) != 0) { diff --git a/Sources/Sentry/include/SentryBacktrace.hpp b/Sources/Sentry/include/SentryBacktrace.hpp index 211a213d1ff..11fc51129f2 100644 --- a/Sources/Sentry/include/SentryBacktrace.hpp +++ b/Sources/Sentry/include/SentryBacktrace.hpp @@ -57,8 +57,8 @@ namespace profiling { * @param f The function to call for each entry. * @param cache The cache used to look up thread metadata. */ - void enumerateBacktracesForAllThreads(const std::function &f, - const std::shared_ptr &cache); + void enumerateBacktracesForAllThreads( + const std::function &f, ThreadMetadataCache *cache); } // namespace profiling } // namespace sentry diff --git a/Sources/Sentry/include/SentrySamplingProfiler.hpp b/Sources/Sentry/include/SentrySamplingProfiler.hpp index 4d56ded6b78..62a1f2f2509 100644 --- a/Sources/Sentry/include/SentrySamplingProfiler.hpp +++ b/Sources/Sentry/include/SentrySamplingProfiler.hpp @@ -21,7 +21,7 @@ namespace profiling { * Samples the stacks on all threads at a specified interval, using the mach clock * alarm API for scheduling. */ - class SamplingProfiler : public std::enable_shared_from_this { + class SamplingProfiler { public: /** * Creates a new sampling profiler that samples at the specified rate. @@ -56,7 +56,7 @@ namespace profiling { private: mach_timespec_t delaySpec_; std::function callback_; - std::shared_ptr cache_; + std::unique_ptr cache_; bool isInitialized_; std::mutex isSamplingLock_; bool isSampling_; diff --git a/Sources/Sentry/include/SentryThreadState.hpp b/Sources/Sentry/include/SentryThreadState.hpp index f6f8f99634e..19023411cb2 100644 --- a/Sources/Sentry/include/SentryThreadState.hpp +++ b/Sources/Sentry/include/SentryThreadState.hpp @@ -69,7 +69,7 @@ namespace profiling { # elif CPU(ARM64) // fp is an alias for frame pointer register x29: // https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html - return context->__ss.__fp; + return arm_thread_state64_get_fp(context->__ss); # elif CPU(ARM) // https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv6FunctionCallingConventions.html#//apple_ref/doc/uid/TP40009021-SW1 return context->__ss.__r[7]; @@ -104,7 +104,7 @@ namespace profiling { getLinkRegister(const MachineContext *context) noexcept { // https://stackoverflow.com/a/8236974 - return context->__ss.__lr; + return arm_thread_state64_get_lr(context->__ss); # else ALWAYS_INLINE std::uintptr_t getLinkRegister(__unused const MachineContext *context) noexcept @@ -123,7 +123,7 @@ namespace profiling { getProgramCounter(const MachineContext *context) noexcept { # if CPU(ARM64) || CPU(ARM) - return context->__ss.__pc; + return arm_thread_state64_get_pc(context->__ss); # elif CPU(X86_64) return context->__ss.__rip; # elif CPU(X86) diff --git a/Sources/SentryCrash/Recording/Tools/SentryCrashCPU_arm64.c b/Sources/SentryCrash/Recording/Tools/SentryCrashCPU_arm64.c index d6f5ef4cbd9..8c18a24ccdd 100644 --- a/Sources/SentryCrash/Recording/Tools/SentryCrashCPU_arm64.c +++ b/Sources/SentryCrash/Recording/Tools/SentryCrashCPU_arm64.c @@ -52,7 +52,7 @@ sentrycrashcpu_framePointer(const SentryCrashMachineContext *const context) // We don't want this from stopping us to enable warnings as errors. This needs to be fixed. # pragma clang diagnostic push # pragma GCC diagnostic ignored "-Wshorten-64-to-32" - return context->machineContext.__ss.__fp; + return arm_thread_state64_get_fp(context->machineContext.__ss); # pragma clang diagnostic pop } @@ -62,7 +62,7 @@ sentrycrashcpu_stackPointer(const SentryCrashMachineContext *const context) // We don't want this from stopping us to enable warnings as errors. This needs to be fixed. # pragma clang diagnostic push # pragma GCC diagnostic ignored "-Wshorten-64-to-32" - return context->machineContext.__ss.__sp; + return arm_thread_state64_get_sp(context->machineContext.__ss); # pragma clang diagnostic pop } @@ -72,7 +72,7 @@ sentrycrashcpu_instructionAddress(const SentryCrashMachineContext *const context // We don't want this from stopping us to enable warnings as errors. This needs to be fixed. # pragma clang diagnostic push # pragma GCC diagnostic ignored "-Wshorten-64-to-32" - return context->machineContext.__ss.__pc; + return arm_thread_state64_get_pc(context->machineContext.__ss); # pragma clang diagnostic pop } @@ -82,7 +82,7 @@ sentrycrashcpu_linkRegister(const SentryCrashMachineContext *const context) // We don't want this from stopping us to enable warnings as errors. This needs to be fixed. # pragma clang diagnostic push # pragma GCC diagnostic ignored "-Wshorten-64-to-32" - return context->machineContext.__ss.__lr; + return arm_thread_state64_get_lr(context->machineContext.__ss); # pragma clang diagnostic pop } @@ -122,13 +122,13 @@ sentrycrashcpu_registerValue(const SentryCrashMachineContext *const context, con switch (regNumber) { case 29: - return context->machineContext.__ss.__fp; + return arm_thread_state64_get_fp(context->machineContext.__ss); case 30: - return context->machineContext.__ss.__lr; + return arm_thread_state64_get_lr(context->machineContext.__ss); case 31: - return context->machineContext.__ss.__sp; + return arm_thread_state64_get_sp(context->machineContext.__ss); case 32: - return context->machineContext.__ss.__pc; + return arm_thread_state64_get_pc(context->machineContext.__ss); case 33: return context->machineContext.__ss.__cpsr; } diff --git a/Tests/SentryProfilerTests/SentryBacktraceTests.mm b/Tests/SentryProfilerTests/SentryBacktraceTests.mm index 2246c610f5b..3615f9dbdfa 100644 --- a/Tests/SentryProfilerTests/SentryBacktraceTests.mm +++ b/Tests/SentryProfilerTests/SentryBacktraceTests.mm @@ -199,7 +199,7 @@ - (void)testCollectsMultiThreadBacktrace XCTAssertEqual( pthread_create(&thread2, nullptr, threadEntry, reinterpret_cast(bc_d)), 0); - const auto cache = std::make_shared(); + ThreadMetadataCache cache; bool foundThread1 = false, foundThread2 = false; // Try up to 3 times. for (int i = 0; i < 3; i++) { @@ -230,7 +230,7 @@ - (void)testCollectsMultiThreadBacktrace } } }, - cache); + &cache); if (foundThread1 && foundThread2) { break; }