Enable crash reporting via Swift on macOS 15

Swift 5.9 includes built in crash reporting, printing stack traces,
libraries, and registers to stdout/err.

https://www.swift.org/blog/swift-5.9-backtraces/

As (Core)Foundation is written in Swift nowadays, we get this feature
for free even in our "C++" apps, as we always link to CoreFoundation.

Our test binaries have been taught how to hook into this, so the
remaining step is to enable it via the SWIFT_BACKTRACE env var.

Pick-to: 6.9
Change-Id: I72dbd9ea934ecc3091766456509f4bd42b2bdab8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Tor Arne Vestbø
2025-01-10 12:45:04 +01:00
parent 2c85a91e07
commit a8b2d9bcdc
2 changed files with 10 additions and 0 deletions

View File

@@ -5,3 +5,8 @@
set -ex
defaults write com.apple.CrashReporter DialogType server
# shellcheck source=../common/unix/SetEnvVar.sh
source "${BASH_SOURCE%/*}/../common/unix/SetEnvVar.sh"
SetEnvVar "SWIFT_BACKTRACE" "enable=yes,output-to=stderr,preset=medium,interactive=false"

View File

@@ -5,3 +5,8 @@
set -ex
defaults write com.apple.CrashReporter DialogType server
# shellcheck source=../common/unix/SetEnvVar.sh
source "${BASH_SOURCE%/*}/../common/unix/SetEnvVar.sh"
SetEnvVar "SWIFT_BACKTRACE" "enable=yes,output-to=stderr,preset=medium,interactive=false"