I've watched video from WWDC20 about triaging test failures with XCTIssue, and it's said there that because of swift runtime improvements XCTest framework can now extract call stack from swift error, and record it.
I couldn't find any other info about it, but that sounds very useful. What are those new swift APIs to accomplish it?
Btw, I've found a way to do this, there is a new global variable called
_swift_willThrow. It is an optional callback that gets called before any of swift error is thrown. So, in this callback, one can save some information (for example current stacktrace) and then extract it from top level code. Here is a test that shows this functionality: https://github.com/apple/swift/blob/master/test/stdlib/Error.swift#L206
This variable is public in linker sense, but not part of official public API, so must be used with extreme caution.