File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
Sources/Testing/SourceAttribution Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -40,16 +40,6 @@ public struct Backtrace: Sendable {
4040 self . addresses = addresses. map { Address ( UInt ( bitPattern: $0) ) }
4141 }
4242
43- #if os(Android) && !SWT_NO_DYNAMIC_LINKING
44- /// The `backtrace()` function.
45- ///
46- /// This function was added to Android with API level 33, which is higher than
47- /// our minimum deployment target, so we look it up dynamically at runtime.
48- private static let _backtrace = symbol ( named: " backtrace " ) . map {
49- castCFunction ( at: $0, to: ( @convention( c) ( UnsafeMutablePointer < UnsafeMutableRawPointer ? > , CInt) - > CInt) . self)
50- }
51- #endif
52-
5343 /// Get the current backtrace.
5444 ///
5545 /// - Parameters:
@@ -77,8 +67,10 @@ public struct Backtrace: Sendable {
7767 }
7868#elseif os(Android)
7969#if !SWT_NO_DYNAMIC_LINKING
80- if let _backtrace {
81- initializedCount = . init( clamping: _backtrace ( addresses. baseAddress!, . init( clamping: addresses. count) ) )
70+ if #available( Android 33 , * ) {
71+ initializedCount = addresses. withMemoryRebound ( to: UnsafeMutableRawPointer . self) { addresses in
72+ . init( clamping: backtrace ( addresses. baseAddress!, . init( clamping: addresses. count) ) )
73+ }
8274 }
8375#endif
8476#elseif os(Linux) || os(FreeBSD) || os(OpenBSD)
You can’t perform that action at this time.
0 commit comments