I’m having some frustration debugging concurrent code. I’ve run into the same thing before with C++ coroutines: a blocked Task is generally invisible to the debugger because it isn’t occupying a thread or queue. So yesterday when my program mysteriously got stuck, Xcode and LLDB were useless because all threads & dispatch queues were idle. I had to resort to sprinkling print calls through likely places.
What would really help is a function I could call from the debugger that would dump all extant Tasks and what source line they’re blocked at. Is there such a thing?
Or, is there an Xcode GUI feature I don’t know about that will show the equivalent? (Yes, I’ve already turned off the buttons that hide uninteresting threads and stack frames.)
FWIW, I successfully got it to build locally on Darwin by following the Linux instructions from the README:
// cd into the ./tools/swift-inspect dir
swift build -c release \
-Xswiftc -I$(git rev-parse --show-toplevel)/include/swift/SwiftRemoteMirror \
-Xlinker -lswiftRemoteMirror
I have not actually attempted to use it yet however. Edit: I tested it on a simple script and it seemed to work – it dumped out a bunch of task info about the process that looked correct.