I am trying to get the Swift runtime's crash backtracing to work for my Swift (Windows App SDK) GUI app (as a starting point for building some crash reporting service around that later on).
I am using a very recent Swift 6.4 Windows toolchain on an Intel machine running Windows 11. My build setup is CMake-based, not SPM-based.
I have read the Backtracing support in Swift documentation, and using the following configuration
set SWIFT_BACKTRACE=interactive=no,output-to=C:\tmp\CrashLogs
I also tried including more flags, like swift-backtrace=C:\Swift\Runtimes\6.4.0\usr\libexec\swift\swift-backtrace.exe, or symbolicate=off, also with quotes around the paths, but none of that made a difference.
To simulate a crash, I am calling fatalError() in my app, I hope that's sufficient; it certainly does crash the app, and Windows Error Reporting kicks in (see below), so I suppose it is.
The behaviour I am seing is that no crash logs are written to the folder specified in the environment variable. I first tried a relwithdebinfo build and later also a debug build, with the same outcome.
Note that my app doesn't have a console window / stdout; I am specifying
target_link_options(Compositor PRIVATE
-Xlinker /SUBSYSTEM:WINDOWS
)
to make this a GUI app (with winMain entry point instead of main) that launches without opening a terminal window (which would be unacceptable for my use case).
After getting no crash logs, I recorded a short app session using Windows Performance Recorder to see what happens around crash time. Windows Error Reporting (WerFault.exe, wermgr.exe) seem to kick in when the crash happens:
And here's what I assume are corresponding logs in the Windows Event Viewer:
But I don't know if that's helpful for diagnosing Swift backtracing.
I will be in tomorrow's Windows Workgroup meeting anyway, but I wanted to write this up beforehand and hopefully give useful information for further diagnosis.
thanks,
Karl
Edit: swift-backtrace.exe does not show up in the list of processes around the crash time; it looks like the runtime wasn't able to launch it (I understand it runs as a process external to the crashing app):



