Skip to content

Commit 56017f6

Browse files
authored
older swift support (#101)
1 parent dac2665 commit 56017f6

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

ETTrace/TracerSwift/ThreadHelper.swift

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,24 @@ public class ThreadHelper: NSObject {
191191
symbolAddressTuples.append((UInt(nlist.n_value) + UInt(slide), string))
192192
}
193193
}
194-
194+
195+
#if swift(>=5.10)
195196
@_noLocks static func getStacktrace(
196197
forThread thread: thread_t,
197198
frames: UnsafeMutablePointer<UInt64>,
198199
maxFrames: UInt64,
199200
frameCount: UnsafeMutablePointer<UInt64>) {
200201
FIRCLSWriteThreadStack(thread, frames, maxFrames, frameCount)
201202
}
203+
#else
204+
static func getStacktrace(
205+
forThread thread: thread_t,
206+
frames: UnsafeMutablePointer<UInt64>,
207+
maxFrames: UInt64,
208+
frameCount: UnsafeMutablePointer<UInt64>) {
209+
FIRCLSWriteThreadStack(thread, frames, maxFrames, frameCount)
210+
}
211+
#endif
202212
}
203213

204214
@_silgen_name("swift_demangle")
@@ -229,5 +239,10 @@ public func _stdlib_demangleName(_ mangledName: String) -> String {
229239
}
230240
}
231241

242+
#if swift(>=5.10)
232243
@_silgen_name("FIRCLSWriteThreadStack")
233244
@_noLocks func FIRCLSWriteThreadStack(_ thread: thread_t, _ frames: UnsafeMutablePointer<UInt64>, _ framesCapacity: UInt64, _ framesWritten: UnsafeMutablePointer<UInt64>)
245+
#else
246+
@_silgen_name("FIRCLSWriteThreadStack")
247+
func FIRCLSWriteThreadStack(_ thread: thread_t, _ frames: UnsafeMutablePointer<UInt64>, _ framesCapacity: UInt64, _ framesWritten: UnsafeMutablePointer<UInt64>)
248+
#endif

0 commit comments

Comments
 (0)