There is a bug of libdispatch on my APP, which is similar to this post, but it's on iOS across versions from 13.x to 16.x.
Now I downloaded the opensource code of libdispatch from here, and I want to look into the details of source code to figure out the root cause.
How can I know the branch or commit of the libdispatch code the specific iOS version (like 15.6.1) uses.
crash_info_0 BUG IN CLIENT OF LIBDISPATCH: Unexpected EV_VANISHED (do not destroy random mach ports or file descriptors)
fault_address 0x0000000001a37b9bc4
mach_code 0x000000000000000001
mach_subcode 0x0000000001a37b9bc4
name EXC_BREAKPOINT (SIGTRAP)
reason EXC_BREAKPOINT EXC_ARM_BREAKPOINT fault_address:0x00000001a37b9bc4
type MACH_Exception
0 libdispatch.dylib __dispatch_source_merge_evt.cold.1 (in libdispatch.dylib) +36
1 libdispatch.dylib __dispatch_source_merge_evt (in libdispatch.dylib) +192
2 libdispatch.dylib __dispatch_event_loop_merge (in libdispatch.dylib) +144
3 libdispatch.dylib __dispatch_workloop_worker_thread (in libdispatch.dylib) +392
4 libsystem_pthread.dylib __pthread_wqthread (in libsystem_pthread.dylib) +284
5 libsystem_pthread.dylib _start_wqthread (in libsystem_pthread.dylib) +4
By the way, what's the difference between "__dispatch_source_merge_evt.cold.1" and "__dispatch_source_merge_evt"
How can I know the branch or commit of the libdispatch code the specific iOS version (like 15.6.1) uses.
Apple does not guarantee that the exact code use to build a specific OS release is available in Darwin. Indeed, there are some projects where certain chunks of code are specifically redacted from the Darwin source.
However, a good general approach is to go to this page, look up the version of macOS that matches the version of iOS you’re interested in, and follow the link from there. So:
-
iOS 15.6.1 was released on 17 Aug 2022 which correlates to macOS 12.5.1.
-
There is no Darwin source for 12.5.1, but there is for 12.5.
-
It points to
libdispatch-1325.120.2
.
If you need to get more specific, you can often find the build number (that’s the 1325.120.2
in the above example) in error messages, embedded strings, or Info.plist
values.
what’s the difference between
__dispatch_source_merge_evt.cold.1
and__dispatch_source_merge_evt
Symbols with the suffix .cold.nnn
contain code from the routine that’s been moved off the ‘hot’ path by the compiler. For example, if you have a function like this:
func divide(value numerator: Int, by denominator: Int) -> Int {
guard denominator != 0 else {
print("failed to device \(numerator) by \(denominator)")
fatalError()
}
return numerator / denominator
}
the compiler might determine that the code inside the guard
block is cold — that is, unlikely to be run — and move it out of the way so that more hot code fits into the instruction cache.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"