Skip to content

Commit b3a430d

Browse files
committed
[swift-inspect] On Darwin, don't try to inspect processes that don't have Swift.
When we locate libswiftCore.dylib in the remote process, check for failure and give up immediately if we don't find one. If the process doesn't have Swift, there's no point in trying to inspect anything in it. rdar://143978694
1 parent 859ef15 commit b3a430d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/swift-inspect/Sources/swift-inspect/DarwinRemoteProcess.swift

+5
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ internal final class DarwinRemoteProcess: RemoteProcess {
163163
self.swiftCore =
164164
CSSymbolicatorGetSymbolOwnerWithNameAtTime(self.symbolicator,
165165
"libswiftCore.dylib", kCSNow)
166+
if CSIsNull(self.swiftCore) {
167+
print("pid \(processId) does not have libswiftCore.dylib loaded")
168+
return nil
169+
}
170+
166171
self.swiftConcurrency = CSSymbolicatorGetSymbolOwnerWithNameAtTime(
167172
symbolicator, "libswift_Concurrency.dylib", kCSNow)
168173
_ = task_start_peeking(self.task)

0 commit comments

Comments
 (0)