Skip to content

Commit

Permalink
older swift support (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahsmartin authored Oct 15, 2024
1 parent dac2665 commit 56017f6
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion ETTrace/TracerSwift/ThreadHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,24 @@ public class ThreadHelper: NSObject {
symbolAddressTuples.append((UInt(nlist.n_value) + UInt(slide), string))
}
}


#if swift(>=5.10)
@_noLocks static func getStacktrace(
forThread thread: thread_t,
frames: UnsafeMutablePointer<UInt64>,
maxFrames: UInt64,
frameCount: UnsafeMutablePointer<UInt64>) {
FIRCLSWriteThreadStack(thread, frames, maxFrames, frameCount)
}
#else
static func getStacktrace(
forThread thread: thread_t,
frames: UnsafeMutablePointer<UInt64>,
maxFrames: UInt64,
frameCount: UnsafeMutablePointer<UInt64>) {
FIRCLSWriteThreadStack(thread, frames, maxFrames, frameCount)
}
#endif
}

@_silgen_name("swift_demangle")
Expand Down Expand Up @@ -229,5 +239,10 @@ public func _stdlib_demangleName(_ mangledName: String) -> String {
}
}

#if swift(>=5.10)
@_silgen_name("FIRCLSWriteThreadStack")
@_noLocks func FIRCLSWriteThreadStack(_ thread: thread_t, _ frames: UnsafeMutablePointer<UInt64>, _ framesCapacity: UInt64, _ framesWritten: UnsafeMutablePointer<UInt64>)
#else
@_silgen_name("FIRCLSWriteThreadStack")
func FIRCLSWriteThreadStack(_ thread: thread_t, _ frames: UnsafeMutablePointer<UInt64>, _ framesCapacity: UInt64, _ framesWritten: UnsafeMutablePointer<UInt64>)
#endif

0 comments on commit 56017f6

Please sign in to comment.