I'm working on a PR to swift-container-plugin to add the backtracing binary into the container. Right now, it seems to be shipped with the toolchain, and in swift:6.2.3-jammy-slim I can find it too. I can't find it in the swift:6.2.3-jammy image though, which I expected to be a superset of -slim.
However, there are scenarios, like non-containerized Linux environments (like VMs for example), regular Embedded Linux or even alpine containers, that need to source this binary from somewhere else. That begs the question, where are you supposed to aquire it from if now from a specific swift:6.x.x-jammy-slim image?
In addition, I'm curious if we should bundle it alongside Swift SDKs, since I don't think we have a way to source it on Android either right now.
In swift:6.2-noble it's housed at /usr/libexec/swift/linux/swift-backtrace and a static variant at /usr/libexec/swift/linux/swift-backtrace-static
And in swift:6.2-slim it looks like they're in the same locations.
I just pulled and popped open the swift:6.2.3-jammy and verified they're in the same location, and it looks like that holds true for it's slim variant as well.
It seems more of a server tool, don't think it would make sense in mobile app environs like iOS or Android. In any case, its source has not been ported to Android, so it doesn't even build there.
If you look in the SDK bundle, in musl-<version>.sdk/<architecture>/usr/libexec/swift/linux-static you will find a swift-backtrace-static executable. If you copy that into the same directory as your program and rename it to swift-backtrace, I think the runtime will find it and you should get a backtrace.
But last time I checked, it gave incorrect and unusable output. It also requires you to not strip debug symbols from the binary.