swiftlang / swift-testing

A modern, expressive testing package for Swift
Apache License 2.0
1.69k stars 68 forks source link

Optionally symbolicate backtraces. #676

Closed grynspan closed 5 days ago

grynspan commented 1 week ago

This PR adds the ability to symbolicate backtraces on Darwin and Windows. A few different modes are provided: mangled, demangled, and "precise demangled" (which includes symbol addresses and instruction pointer offsets.) Tools such as the Swift VS Code plugin will be able to adopt this new feature along with VS Code's new call stacks API (https://github.com/microsoft/vscode/pull/222126).

Note that on Linux, it is not currently possible to symbolicate backtraces meaningfully. The standard library's Backtrace type has the ability to do this for us, but we'll need some tweaks to its interface before we can adopt it.

Note also that Apple's internal Core Symbolication framework is not used; we may be able to add support for it in a future PR (or Apple may opt to use it in their internal fork of Swift Testing.)

There is no way to emit backtraces to the command line right now. I considered having --very-verbose imply backtraces, but it's something I'm going to reserve for a future PR after discussion with the community.

Checklist:

grynspan commented 1 week ago

@swift-ci test

grynspan commented 1 week ago

@swift-ci test

grynspan commented 6 days ago

@swift-ci test

grynspan commented 6 days ago

@swift-ci test