Answers for "how to check if not running in debufgger swift"

0

how to check if not running in debufgger swift

func amIBeingDebugged() -> Bool {

    var info = kinfo_proc()
    var mib : [Int32] = [CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()]
    var size = strideofValue(info)
    let junk = sysctl(&mib, UInt32(mib.count), &info, &size, nil, 0)
    assert(junk == 0, "sysctl failed")
    return (info.kp_proc.p_flag & P_TRACED) != 0
}
Posted by: Guest on October-16-2020

Code answers related to "how to check if not running in debufgger swift"

Code answers related to "Swift"

Browse Popular Code Answers by Language